awaitMessageComponent breaks if separate message is deleted
I have the following code that awaits either a message, a string select menu or a button:
I also have the following
while
loop that determines what was chosen:
The response should either be parsed as String Select Menu, Button, or a Message that was sent in the same channel.
If it's a message, it should be deleted and the content
stored.
When first starting it up, it works fine. I can change the button / select menu as often as I want.
When sending a message, it gets properly parsed the first time. However, anything after that returns the following error:
Does channel.awaitMessages()
conflict with message.awaitMessageComponent()
?4 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.discordjs@14.11.0
node v18.16.0
Common causes of
DiscordAPIError[10062]: Unknown interaction
:
- Initial response took more than 3 seconds ➞ defer the response *.
- Wrong interaction object inside a collector.
* Note: you cannot defer modal or autocomplete value responseswell,
* I deferUpdate it if it's a component,
* this is the only place where I call
awaitResponse()
, so there's no conflicting files/commands
* it only happens after a message is collected
that's the part that confuses me
I tried the same without deleting the collected message, and the error still happens
I see. So I'll have to rewrite the awaitResponse function to not use the promisified versions of the collectors
That makes sense now. Thanks a lot!