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

Interaction.defer is broken after #2579 #2682

Closed
3 tasks done
tibue99 opened this issue Dec 28, 2024 · 7 comments
Closed
3 tasks done

Interaction.defer is broken after #2579 #2682

tibue99 opened this issue Dec 28, 2024 · 7 comments
Labels
bug Something isn't working priority: high High Priority

Comments

@tibue99
Copy link
Contributor

tibue99 commented Dec 28, 2024

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

@tibue99 tibue99 added the unconfirmed bug A bug report that needs triaging label Dec 28, 2024
@Paillat-dev
Copy link
Contributor

I wonder why using pydantic would be a good idea... Anyhow. I'll see if I can pr a fix unless @Icebluewolf wants to do it since its his pr

@Icebluewolf
Copy link
Contributor

It's actually #2679 that breaks it. Will fix soon.

@Lulalaby
Copy link
Member

should i revert for now?

@Paillat-dev
Copy link
Contributor

#2679 is not merged, how would it cause an issue on master ?

@Icebluewolf
Copy link
Contributor

I "fixed" #2679's issue while writing #2579 and the "fix" never got removed from #2579 when I split it into 2 PRs.

@Dorukyum
Copy link
Member

Can reproduce.

@Dorukyum Dorukyum added bug Something isn't working priority: high High Priority and removed unconfirmed bug A bug report that needs triaging labels Dec 28, 2024
@Dorukyum
Copy link
Member

Fixed in 1ca07cb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: high High Priority
Projects
None yet
Development

No branches or pull requests

5 participants