Show modal and remove previous ephemeral

Hi, I have a flow with my bot where the following steps are taken: 1) A user clicks a button on a bot's message 2) Bot responds with an ephemeral message with additional buttons 3) User clicks a button on ephemeral and modal appears 4) User submits modal, bot responds with a final ephemeral This is working great, however -- I would like for the ephemeral message from step 2 to be removed when the modal is opened. I have tried to call interaction.deleteReply prior to interaction.showModal but this does not work, and I just get "Interaction Failed". And it seems like during the modalSubmit phase in step 4, the context of the original ephemeral from step 2 is lost and I cannot find a way to remove it then either. I have it working without the modal, where I can simply update the ephemeral message from step 2 with the final ephemeral message. But it doesn't seem like there is like an interaction.updateWithModal action that can be taken.
4 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
billytheape
billytheape2y ago
npm list discord.js = discord.js@14.6.0 node -v = v16.13.0
Kilian
Kilian2y ago
You can’t delete ephemeral messages. I would recommend the method of interaction.editReply.
billytheape
billytheape2y ago
Thanks for the info