pycord icon indicating copy to clipboard operation
pycord copied to clipboard

Slash command respond error

Open timka-123 opened this issue 1 year ago • 4 comments

Summary

If I want to defer or respond to interaction - library gives me an error

Reproduction Steps

  1. Create a slash or bridge command
  2. 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

timka-123 avatar Aug 04 '22 19:08 timka-123

Cannot reproduce with this code. Are you sure this is the code you used and that this happens consistently?

Middledot avatar Aug 05 '22 16:08 Middledot

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

timka-123 avatar Aug 06 '22 11:08 timka-123

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)

Middledot avatar Aug 07 '22 15:08 Middledot

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)

  1. I reinstalled pycord.
  2. I created global command

timka-123 avatar Aug 07 '22 16:08 timka-123