Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update get_translated_payload method in ManagementFeature #230

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Vioshim
Copy link

@Vioshim Vioshim commented Apr 13, 2024

Rationale

The function requires the bot's tree for working accordingly. Not ready for merging in master but rather once user apps merges with the main branch.

Summary of changes made

It adds bot.tree as parameter for the function

Checklist

  • This PR changes the jishaku module/cog codebase
    • These changes add new functionality to the module/cog
    • These changes fix an issue or bug in the module/cog
    • I have tested that these changes work on a production bot codebase
    • I have tested these changes against the CI/CD test suite
    • I have updated the documentation to reflect these changes
  • This PR changes the CI/CD test suite
    • I have tested my suite changes are well-formed (all tests can be discovered)
    • These changes adjust existing test cases
    • These changes add new test cases
  • This PR changes prose (such as the documentation, README or other Markdown/RST documents)
    • I have proofread my changes for grammar and spelling issues
    • I have tested that any changes regarding Markdown/RST syntax result in a well formed document

@tuna2134
Copy link
Contributor

I don't know why this function was require.
look this

@Gorialis
Copy link
Owner

The function signature doesn't indicate that this should be necessary. Can you explain why you thought this change was necessary (and ideally include any supporting errors or other info you can about what lead you towards this fix)?

@Vioshim
Copy link
Author

Vioshim commented Apr 16, 2024

image

It errors, but now that I look properly into source code, it has to do with how it works for hybrid commands.
https://github.com/Rapptz/discord.py/blob/425edd2e10b9be3d7799c0df0cd1d43a1a34654e/discord/app_commands/transformers.py#L93, as hybrid commands require the tree and the translator. (Therefore this PR breaks normal app commands, so please don't merge)

@Gorialis
Copy link
Owner

I see. Part of how this code works might need to be rewritten to make it support both cases, I haven't really used hybrid commands so I guess I've never run into this. I imagined there might be some need to refine and update the sync procedure anyway since it deviates from how the discord.py public API intends for the sake of better diagnostics, so I'll probably need to make some kind of test harness to make sure I'm not missing things when maintaining it.

@tuna2134
Copy link
Contributor

I am looking tree.sync function, it looks same.
And I have never seen that report

@pythonmcpi
Copy link

pythonmcpi commented Apr 27, 2024

@Gorialis fyi, this issue is only present in the (currently experimental) feature/user_apps branch of discord.py.

This is caused by a change in app_commands.Command.to_dict's signature, where a new tree argument was added. Permalink to the change | Link to latest feature/user_apps commit

PR for the feature: Rapptz/discord.py#9760

jishaku/features/management.py Outdated Show resolved Hide resolved
Given the information provided, this PR doesn't work on master but rather on user apps branch, this PR will only apply in such case for when that branch merges in master.
@Vioshim
Copy link
Author

Vioshim commented May 5, 2024

Change has been merged in master, jishaku's sync command no longer works with Master Branch

@JDJGInc
Copy link

JDJGInc commented May 8, 2024

Can confirm:

May 07 23:24:59 contabo-vps python[1054883]:     ret = await coro(*args, **kwargs)
May 07 23:24:59 contabo-vps python[1054883]:           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
May 07 23:24:59 contabo-vps python[1054883]:   File "/home/jdjg/JDBot/.venv/lib/python3.11/site-packages/jishaku/features/management.py", line 246, in jsk_sync
May 07 23:24:59 contabo-vps python[1054883]:     payload = [command.to_dict() for command in slash_commands]
May 07 23:24:59 contabo-vps python[1054883]:               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
May 07 23:24:59 contabo-vps python[1054883]:   File "/home/jdjg/JDBot/.venv/lib/python3.11/site-packages/jishaku/features/management.py", line 246, in <listcomp>
May 07 23:24:59 contabo-vps python[1054883]:     payload = [command.to_dict() for command in slash_commands]
May 07 23:24:59 contabo-vps python[1054883]:                ^^^^^^^^^^^^^^^^^
May 07 23:24:59 contabo-vps python[1054883]: TypeError: Command.to_dict() missing 1 required positional argument: 'tree'

@Gorialis
Copy link
Owner

Because this change still hasn't hit PyPI release, this PR can't be merged until it is ensured that this change doesn't break users who aren't on master branch.

@Soheab
Copy link

Soheab commented May 18, 2024

Because this change still hasn't hit PyPI release, this PR can't be merged until it is ensured that this change doesn't break users who aren't on master branch.

It could handle the error? If this gets merged, it will error for dpy <2.4 users anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants