I make my discord bot, and make the report command on modal.
class ReportModal(discord.ui.Modal, title="Репорт юзер"): user_name = discord.ui.TextInput(label="Юзер дискорд наме", placeholder="eg. Jgfhfhjfkfk#0000", required=True, max_length=10000, style=discord.TextStyle.short) user_id = discord.ui.TextInput(label="Юзер дискорд наме2", placeholder="eg. Jgfhfhjfkfk#0000", required=True, max_length=10000, style=discord.TextStyle.long) @bot.command(name="report", description="Репорт юзер")#name="report", description="Репорт юзер" async def report(interaction: discord.Interaction): modal = ReportModal() await interaction.response.send_modal(modal)
Error
` File “/home/container/.local/lib/python3.11/site-packages/discord/ext/commands/core.py”, line 235, in wrapped
ret = await coro(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/container/main.py”, line 26, in report
await interaction.response.send_modal(modal)
^^^^^^^^^^^^^^^^^^^^
AttributeError: ‘Context’ object has no attribute ‘response’
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “/home/container/.local/lib/python3.11/site-packages/discord/ext/commands/bot.py”, line 1350, in invoke
await ctx.command.invoke(ctx)
File “/home/container/.local/lib/python3.11/site-packages/discord/ext/commands/core.py”, line 1029, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/container/.local/lib/python3.11/site-packages/discord/ext/commands/core.py”, line 244, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: ‘Context’ object has no attribute ‘response’
`
Артемий Осипов is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.