-
-
Notifications
You must be signed in to change notification settings - Fork 482
Closed
Labels
Description
Summary
#2579 breaks interaction.defer()
Reproduction Steps
Run the code below or any other code that uses interaction.defer()
Minimal Reproducible Code
import discord
bot = discord.Bot()
@bot.slash_command()
async def hey(ctx):
await ctx.defer()
await ctx.respond("Hey!")
bot.run("")
Expected Results
No error
Actual Results
Ignoring exception in command hey:
Traceback (most recent call last):
File "C:\Users\Timo\Desktop\pythonProject\.venv\Lib\site-packages\discord\commands\core.py", line 138, in wrapped
ret = await coro(arg)
^^^^^^^^^^^^^^^
File "C:\Users\Timo\Desktop\pythonProject\.venv\Lib\site-packages\discord\commands\core.py", line 1082, in _invoke
await self.callback(ctx, **kwargs)
File "C:\Users\Timo\Desktop\pythonProject\main.py", line 8, in hey
await ctx.defer()
File "C:\Users\Timo\Desktop\pythonProject\.venv\Lib\site-packages\discord\interactions.py", line 826, in defer
adapter.create_interaction_response(
File "C:\Users\Timo\Desktop\pythonProject\.venv\Lib\site-packages\discord\webhook\async_.py", line 530, in create_interaction_response
payload["data"]["attachments"] = attachments
~~~~~~~^^^^^^^^
KeyError: 'data'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Timo\Desktop\pythonProject\.venv\Lib\site-packages\discord\bot.py", line 1149, in invoke_application_command
await ctx.command.invoke(ctx)
File "C:\Users\Timo\Desktop\pythonProject\.venv\Lib\site-packages\discord\commands\core.py", line 435, in invoke
await injected(ctx)
File "C:\Users\Timo\Desktop\pythonProject\.venv\Lib\site-packages\discord\commands\core.py", line 146, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: KeyError: 'data'
Intents
System Information
- Python v3.12.1-final
- py-cord v2.6.1-final
- aiohttp v3.11.11
- system info: Windows 11 10.0.26100
Checklist
- I have searched the open issues for duplicates.
- I have shown the entire traceback, if possible.
- I have removed my token from display, if visible.
Additional Context
No response