#Two responses to the button interaction

1 messages · Page 1 of 1 (latest)

sudden zenith
#

Can I make 2 responses to 1 interaction?
Code:

@button(label="Отклонить", emoji="🛃", style=discord.ButtonStyle.red, custom_id="tudabat")
    async def callback(self, button: discord.ui.Button, interaction: discord.Interaction):
        self.disable_all_items()
        await interaction.response.edit_message(view=self)
        await interaction.response.send_modal(PrichModal(user_id=self.user_id))```

Error:
```py
Ignoring exception in view <ButtonReaction timeout=None children=2> for item <Button style=<ButtonStyle.danger: 4> url=None disabled=True label='Отклонить' emoji=<PartialEmoji animated=False name='🛃' id=None> row=None>:
Traceback (most recent call last):
  File "C:\Users\Tarasov\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ui\view.py", line 426, in _scheduled_task
    await item.callback(interaction)
  File "C:\Users\Tarasov\Desktop\Боты\Bot DS\Прочее\Helper.py", line 72, in callback
    await interaction.response.send_modal(PrichModal(user_id=self.user_id))
  File "C:\Users\Tarasov\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\interactions.py", line 1171, in send_modal
    raise InteractionResponded(self._parent)
discord.errors.InteractionResponded: This interaction has already been responded to before
raven trench
#

Modals have to be the only response

#

I don't think you can respond twice the way you want

sudden zenith
raven trench
#

send the modal first

#

should work

sudden zenith
# raven trench should work

If you meant just swapping them, then it didn't help?

Ignoring exception in view <ButtonReaction timeout=None children=2> for item <Button style=<ButtonStyle.danger: 4> url=None disabled=True label='Отклонить' emoji=<PartialEmoji animated=False name='🛃' id=None> row=None>:
Traceback (most recent call last):
  File "C:\Users\Tarasov\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ui\view.py", line 426, in _scheduled_task
    await item.callback(interaction)
  File "C:\Users\Tarasov\Desktop\Боты\Bot DS\Прочее\Helper.py", line 72, in callback
    await interaction.response.edit_message(view=self)
  File "C:\Users\Tarasov\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\interactions.py", line 1010, in edit_message
    raise InteractionResponded(self._parent)
discord.errors.InteractionResponded: This interaction has already been responded to before```
plucky sierra
#

You need to use followup

#

.rtfm followup

sudden zenith
plucky sierra
#

And if u want to send another message you do
interaction.followup.send

sudden zenith
plucky sierra
#

With pleasure

magic dew
#

Modals are special ✨