unknown interaction when trying to defer interaction
if deferring an interaction has a chance to fail how do i ensure that interactions are ALWAYS responded too?
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!If the deferReply() throws Unknown Interaction, that means Discord received the request 3 or more seconds since the interaction was created, so the interaction has now expired and cannot be acknowledged by any means now
The closest you could do as a failsafe is to catch the error, and if it's an unknown interaction error, just do
interaction.channel.send(...)
with somethingbut it definitely doesn't take 3 seconds
Are you trying to edit an empheral reply? iirc you can only update
yes i do #editReply later
instanceof
can be a relatively intensive check, so you should probably replace that whole if
statement with if (!interaction.inCachedGuild()) return;
That should save you at least a few milliseconds, and with situations like this, every optimization counts
Otherwise, it's probably a network issue/hardware shortcoming instead of any problem with your codeokay thank you