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.
No description
12 Replies
d.js toolkit
d.js toolkit20h 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/luna20h ago
You're not responding to the interaction
d.js docs
d.js docs20h ago
:method: ButtonInteraction#update() @14.16.3 Updates the original message of the component on which the interaction was received on.
// Remove the components from the message
interaction.update({
content: "A component interaction was received",
components: []
})
.then(console.log)
.catch(console.error);
// Remove the components from the message
interaction.update({
content: "A component interaction was received",
components: []
})
.then(console.log)
.catch(console.error);
treble/luna
treble/luna20h ago
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
treble/luna
treble/luna20h ago
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
treble/luna
treble/luna20h ago
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
treble/luna
treble/luna20h ago
you can just use your first collector, omit componentType and then guard
d.js docs
d.js docs20h ago
: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
Want results from more Discord servers?
Add your server