I have a select menu with a submit button. When submit is clicked I want to close the current message, submit the data and then open a new select menu but I am having trouble figuring out how to have the message close.
How can I have the current menu and button close when the submit button is clicked?
Thanks in advance for your help.
To turn my comment into an answer; you can just delete the message on button press. For example, my Cancel
buttons look a little like this:
@discord.ui.button(label="Cancel", style=discord.ButtonStyle.red, row=3, disabled=False, emoji="✖️")
async def cancel_callback(self, button: discord.ui.Button, interaction: discord.Interaction):
await interaction.message.delete()
This is within a custom View
class so might have to be adapted for your needs - but using the interaction.message
attribute to delete the message is the way to go.