edit ephemeral embeds
I have an ephemeral embed which has one ActionRow with 3 Buttons (Which you can find in the attachment ). The left button triggers some dm messages to the interaction user. After answering the message it should update the ephemeral embed.
I read the forum post i found about that topic but didnt quite understand how he could call
at all. Cause im not able to do so.
PS: Im not calling any deferUpdate or deferReply beforehand.
Let me explain my setup a bit more detailed:
I read the interaction.message to get the embed and build a new embed on top of that
i tried to update the embed with the ButtonInteraction#update function which looks like that:
But i receive following error:
18 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 OPNode: v20.6.1
your error just means that your bot didn't respond to the interaction in time (within 3 seconds)
since you're taking some actions that could potentially take time, you'll want to use
<ButtonInteraction>.deferUpdate()
as soon as possible beforehand
then you can use <ButtonInteraction>.editReply()
afterwards when you're ready to actually update the messageSo the creation of the embed is a different one than the one that tries to update the embed is that a problem?
if i try to deferUpdate the answer it says:
the issue on its own is simply that it took too long
it's likely unrelated to the embed you're creating, but more so the dms you're sending
then you can use <ButtonInteraction>.editReply()
afterwards when you're ready to actually update the message
Okay, i dont really understand why but i works now. I first tried to fetch the ephemeral message and try to edit it that way by calling
which has been the first error i did i think
Thanks that solves it
Absolutly my bad you have like a list with all the meanings for the discordApi error messages?
Sry for disturbing
just to clarify, the issue with this approach is that ephemeral messages can only be fetched/edited/deleted through the interaction webhook
That was the missing piece. Thank you very
I mean in many cases there isn't one specific meaning for each error message
- "Unknown interaction" only has the one cause of "it took too long", but as you can imagine, there can be many reasons for your bot to take too long to do just about anything
- I'd hope that "The reply to this interaction has already been sent or deferred." is pretty self explanatory
- "Unknown message", the error you would receive from fetching an ephemeral message, is also basically exactly what it says: discord doesn't know of the message you're trying to fetch
it'd be because ephemeral messages aren't exactly in the channel the same as normal messages
Can you only edit an ephemeral message if the message itself triggers an interaction or with any interaction as long as you have the messageId?
you're able to use
editReply
as many times as you like (within reason for rate limits) within the 15 minute lifespan of the interaction's token
it can be used to edit ephemeral messages including ephemeral follow upsSo i can only edit those embeds with an interaction triggered by exact that message that i want to update/edit? (If you have like buttons in that message or other messageComponents)
no, again you can use
editReply
to edit an ephemeral follow up
but if you're asking whether you can just edit an ephemeral message at any point in time all the time, the answer is nosry im still not catching up...
I used a command to get messages sent to my dms. The result creates the first instance of the ephemeral embed.
Next step would be clicking on the button "Einstellungen ändern" which again triggers the same messages as before to update the embed.
Do you call this type of scenario a follow up? Im kinda confused
As of my understanding its a different interaction
no, "followup messages" can be sent after the initial response to the interaction (
reply
, update
, etc)
you would use <Interaction>.followUp()
to send a followup messageOh didnt know that. So if you create something from an initial response its still the same interaction? Interesting
That helps a lot!
👍
Thank you so much!
Saved me so much can see the light at the end of the dark tunnel now