Open johann-lau opened 2 years ago
sorry for the late response, can you try to install the git version instead?
pip install git+https://github.com/discord-py-ui/discord-ui
Unfortunately, I think it is not working either. This time it gives the following error:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nextcord/client.py", line 415, in _run_event
await coro(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord_ui/client.py", line 174, in on_ready
await self.commands.sync()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord_ui/slash/types.py", line 1548, in sync
for i, c in enumerate(data):
TypeError: 'NoneType' object is not iterable
And also
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nextcord/client.py", line 414, in _run_event
await coro(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nextcord/client.py", line 1864, in on_connect
await self.rollout_application_commands()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nextcord/client.py", line 1894, in rollout_application_commands
await self.deploy_application_commands(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nextcord/client.py", line 1808, in deploy_application_commands
await self._connection.deploy_application_commands(data=data, guild_id=None, associate_known=associate_known,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nextcord/state.py", line 619, in deploy_application_commands
await self.http.delete_global_command(self.application_id, raw_response["id"])
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nextcord/http.py", line 331, in request
raise NotFound(response, data)
nextcord.errors.NotFound: 404 Not Found (error code: 10063): Unknown application command
sorry for the late response again I had a lot of stuff to do. seems like an issue in the lib, I'll fix that rq
alright the issue should be fixed can you try to reinstall discord-ui again?
This time, it seems like that the command is not registered. However, all other commands are working fine.
can you try to nuke all commands and then restart the bot
to nuke your commands (delete them all) add this snippet of code
@bot.listen()
async def on_ready():
await bs.commands.nuke()
let the code run for one time and then remove that piece of code again
This time:
Ignoring exception in on_ready
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nextcord/client.py", line 415, in _run_event
await coro(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord_ui/client.py", line 174, in on_ready
await self.commands.sync()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord_ui/slash/types.py", line 1552, in sync
command._id = _command['id']
UnboundLocalError: local variable '_command' referenced before assignment
I tried changing discord_ui/slash/types.py
line 1547~1553 to the following:
for command in commands:
for i, c in enumerate(data):
if c['name'] == command.name and c['type'] == command.command_type.value:
_command = data.pop(i)
command._id = _command['id']
command._state = self._state
self._raw_cache[command._id] = command
It didn't raise any errors. However, global commands are not registered and I am not allowed to use that guild command.
(Please point out any mistakes, if I get too confused.) I created a guild-only slash command, as follows:
I invoked this slash command. Immediately after that, the command gets removed from the list of other commands. All other commands continued to work, so I believe it is not a fatal bug. I tried looking into the module's code but I cannot find anything - I think it might be the bot wrongly deleting the command?