Question on message component collector
Code: https://pastebin.com/BNTzU7AQ
I have a message with register, home and remove buttons, when clicking on register button, the embed changes and it shows a string select menu, upon selecting items, the embed content changes accordingly and it shows home button to go back to main menu, everything works, but the issue is that after selecting items from the menu, the home button is taking some time to load and it shows 'This interaction failed' although nothing is breaking and the button works.
What am I doing wrong here? Please help.
12 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 staffYou're not responding to the interaction
:method: ButtonInteraction#update()
@14.16.3
Updates the original message of the component on which the interaction was received on.
Use that instead of .edit
have i set up my collectors correctly? the string select collector is nested inside the button collector
if i'm using selectInteraction.deferUpdate() and then selectInteraction.update({ i'm getting interaction already replied error
Use editReply then
also you can use a single collector
just omit the componentType and it will collect both interactions
weird stuff happens when i use editReply, it works the first time, the 2nd time i get unknown interaction
yeah because your collectors are nested
sorry
i think you're correct because i logged the interaction and 2nd time it was sending 2 interactions
you can just use your first collector, omit componentType and then guard
:method: BaseInteraction#isButton()
@14.16.3
Indicates whether this interaction is a ButtonInteraction.alrighty, thank you so much for your help, i'll try this out and see how it goes
changed to single collector and it's working like a charm, thank you so much