How can I make the following thing happen
I want to update an already existing message first and then show a modal. But the error occurs replying the interaction has already been replied. How do I make them both work.
Update:
Show modal:
7 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPYou have to show the modal first, there is no way around that.
Also you could try using interaction.message.edit()
Wait, lemme explain a bit.
I have a message (message is ephemeral) which has button.
I was listening to this button by the InteractionCreate event.
- So what I want is that, when I click this button, the message which had this button, to be updated and get changed to "Creating modal" and then the modals shows up.
- When the modal is submitted, the same message which was "Creating modal" gets changed to "Modal submitted".
How can I achieve this ?
So, the problem arises that either am able to interaction.showModal or do interaction.update.
@chewie 🌈 is there any way ?
by literally doing what he said
edit the message before responding to the interaction
ephemeral message can only be edited via interaction webhooks endpoint
which is to say, you'd use
<ButtonInteraction>.editReply()
you can specify <ButtonInteraction.message
as the message
when using this method
(this can only be done after showing the modal)