AttributeError: type object 'int' has no attribute 'repsonse'
Question:
Trying slash commands in discord and i got this error
Traceback (most recent call last):
File "C:UsersHPAppDataLocalProgramsPythonPython311Libsite-packagesdiscordapp_commandscommands.py", line 862, in _do_call
return await self._callback(interaction, **params) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "e:botbot.py", line 104, in hello
await int.response.send_message ("Hey {interaction.user.mention} you suck! Cry about it!")
^^^^^^^^^^^^
AttributeError: type object 'int' has no attribute 'repsonse'
This is the code
@client.tree.command(name="testing")
async def hello(interaction: discord.Interaction):
await int.response.send_message ("Hey {interaction.user.mention} you suck! Cry about it!")
tried changing interaction.response with interaction.extras still didnt work
Answers:
There are multiple typos in the code you provided:
- you’re trying to access the
response
object on the int
type and not the interaction
variable
response
is spelt incorrectly
- you’re missing the
f
from the f-string you’re trying to use as the message string
@client.tree.command(name="testing")
async def hello(interaction: discord.Interaction):
await interaction.response.send_message(f"Hey {interaction.user.mention} you suck! Cry about it!")
Pay attention to the error messages that you get when your code runs.
Trying slash commands in discord and i got this error
Traceback (most recent call last):
File "C:UsersHPAppDataLocalProgramsPythonPython311Libsite-packagesdiscordapp_commandscommands.py", line 862, in _do_call
return await self._callback(interaction, **params) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "e:botbot.py", line 104, in hello
await int.response.send_message ("Hey {interaction.user.mention} you suck! Cry about it!")
^^^^^^^^^^^^
AttributeError: type object 'int' has no attribute 'repsonse'
This is the code
@client.tree.command(name="testing")
async def hello(interaction: discord.Interaction):
await int.response.send_message ("Hey {interaction.user.mention} you suck! Cry about it!")
tried changing interaction.response with interaction.extras still didnt work
There are multiple typos in the code you provided:
- you’re trying to access the
response
object on theint
type and not theinteraction
variable response
is spelt incorrectly- you’re missing the
f
from the f-string you’re trying to use as the message string
@client.tree.command(name="testing")
async def hello(interaction: discord.Interaction):
await interaction.response.send_message(f"Hey {interaction.user.mention} you suck! Cry about it!")
Pay attention to the error messages that you get when your code runs.