`interaction.response.edit_message` Does Not Work in the `discord.ui.Modal` Class
See original GitHub issueSummary
interaction.response.edit_message
does not work in the callback function for the discord.ui.Modal
class.
Reproduction Steps
- Clone the latest version of
discord.py
from GitHub. - Use the code below.
Minimal Reproducible Code
class MyModal(Modal, title='Modal'):
input_1 = TextInput(label="Short Input", placeholder="Placeholder Test")
input_2 = TextInput(label="Longer Input", style=discord.TextStyle.long)
async def on_submit(self, interaction: discord.Interaction):
embed = discord.Embed(title="Your Modal Results", color=discord.Color.random())
embed.add_field(name="First Input", value=self.input_1, inline=False)
embed.add_field(name="Second Input", value=self.input_2, inline=False)
await interaction.response.edit_message(embeds=[embed])
button = Button(label="Open Modal")
async def callback(interaction):
modal = MyModal()
await interaction.response.send_modal(modal)
button.callback = callback
view = View()
view.add_item(button)
await ctx.send("Hello", view=view)
Expected Results
The original message should be edited with an embed.
Actual Results
This is the error that comes in the modal window and the message is not edited. There is no error.
Intents
None
System Information
Python 3.10
discord.py
master
Branch (on GitHub)
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
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Interactions API Reference - discord.py - Read the Docs
Edits the original interaction response message. This is a lower level interface to InteractionMessage.edit() in case you do not want to fetch the...
Read more >discord.py - modal not working i got an error but it doesn't ...
A Modal is a class that you send in your interaction response, not a command. ... Modal, title='Questionnaire Response'): name = ui.
Read more >All you need to know about Buttons in Discord.py & Pycord
This is the Ultimate Python Guide on Buttons with Discord.py or Pycord. In this video, I talk about how to create buttons in...
Read more >Discord MODALS in Discord.py are Here! - YouTube
In this video, we make/code a modal with Discord.py in Python. To make modals, you need to have Discord.py 2.0 (installation instructions ...
Read more >Bot UI Kit - Pycord v2.3 Documentation
A decorator that attaches a button to a component. The function being decorated should have three parameters, self representing the discord.ui.View , the ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks! This worked.
ping me on dpy server helish_88😈#7777