Edit two messages within the same button handler

Hello, I have a button handler that will call an external API, send an embed, and edit another message embed too, depending on the first sent embed. What is the correct way to make "sleep" for like 2 seconds my bot before editing the second embed ? I want to avoid any risk of editing with wrong data if the API call is too long
3 Replies
d.js toolkit
d.js toolkit8mo ago
- 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 staff
treble/luna
treble/luna8mo ago
just await your promises?
Sourceae
Sourceae8mo ago
I was missing an await in the API call that's why sometimes it was editing the message before receiving the data. Thanks 😄