pycord
pycord copied to clipboard
Slash command respond error
Summary
If I want to defer or respond to interaction - library gives me an error
Reproduction Steps
- Create a slash or bridge command
- run it!
Minimal Reproducible Code
import discord
bot = discord.Bot(debug_guilds=[926047973169840168], command_prefix='!')
connections = {}
@bot.slash_command()
async def test(ctx):
"""
testing slash commands in pycord library
"""
await ctx.respond('ok and')
bot.run('token')
Expected Results
I want to see a respond of my command
Actual Results
Ignoring exception in on_interaction
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/discord/client.py", line 382, in _run_event
await coro(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/discord/bot.py", line 1043, in on_interaction
await self.process_application_commands(interaction)
File "/usr/local/lib/python3.10/dist-packages/discord/bot.py", line 712, in process_application_commands
command = self._application_commands[interaction.data["id"]]
AttributeError: 'Interaction' object has no attribute 'data'
Intents
discord.Intents.all()
System Information
- Python v3.10.4-final
- py-cord v2.0.0-final
- aiohttp v3.8.1
- system info: Linux 5.15.0-43-generic #46-Ubuntu SMP Tue Jul 12 10:30:17 UTC 2022
Checklist
- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.
Additional Context
No response
Cannot reproduce with this code. Are you sure this is the code you used and that this happens consistently?
Cannot reproduce with this code. Are you sure this is the code you used and that this happens consistently?
I am sure. Any respond to slash command call this error
Try reinstalling pycord but other than that it seems that the data attribute should always be there. Does it still make an error as a global command? (i.e. remove the debug_guilds parameter)
Try reinstalling pycord but other than that it seems that the data attribute should always be there. Does it still make an error as a global command? (i.e. remove the debug_guilds parameter)
- I reinstalled pycord.
- I created global command