Error with buttons in a slash command
Summary
Using buttons in a slash command produces a couple errors
Reproduction Steps
I created a slash command that contains a view with a couple buttons. I run the command and click on the buttons. The errors appear when the buttons are pressed. The code processes normally though as far as i can tell, but still leaves an error in the console.
Minimal Reproducible Code
bot = discord.Bot()
class TestButt(discord.ui.View):
def __init__(self):
super().__init__()
@discord.ui.button(label = "Yes", style=discord.ButtonStyle.green)
async def yes(self, button: discord.ui.Button, interaction = discord.Interaction):
await interaction.response.send_message(content = "You picked yes", view = self)
@discord.ui.button(label = "No", style=discord.ButtonStyle.red)
async def no(self, button: discord.ui.Button, interaction = discord.Interaction):
await interaction.response.send_message(content = "You picked no", view = self)
@bot.command(description = "Im a good slashy", guild_ids = [250507134876254208])
async def slashy(ctx):
await ctx.reply(f"You like me?", view = TestButt())
Expected Results
Run without any errors
Actual Results
I get this error:
Ignoring exception in on_interaction
Traceback (most recent call last):
File "C:\Users\Jesse\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\bot.py", line 249, in handle_interaction
command = self.app_commands[interaction.data["id"]]
KeyError: 'id'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Jesse\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 351, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Jesse\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\bot.py", line 355, in on_interaction
await self.handle_interaction(interaction)
File "C:\Users\Jesse\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\bot.py", line 252, in handle_interaction
await interaction.response.send_message("I didn't recognize that command")
File "C:\Users\Jesse\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\interactions.py", line 534, in send_message
await adapter.create_interaction_response(
File "C:\Users\Jesse\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\webhook\async_.py", line 189, in request
raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
Intents
I use all intents or Intents.all()
System Information
The command for the version doesnt work either apparently. But its pycord 2.0.0a
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
We're aware of this, it happens because of the testing helpers in the code. Thanks for pointing it out once more
Oh i must have missed that. Oops. Sorry!
Fixed in #56