#How to avoid interaction listener mixing commands

13 messages · Page 1 of 1 (latest)

turbid fulcrum
#

Im coding a command which update a user from a database, it returns an embed message with user's information and it have a row with buttons to select properties to change. The problem is that when i make another instance of the command every embed used previously also change with the new responses.

dense palmBOT
#

• 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.

turbid fulcrum
vapid oracle
#

Don't create listeners in commands. Use collectors.

crimson meteorBOT
#

If you are waiting for button or select menu input from a specific message, don't create the collector on the channel.
• Channel collectors return component interactions for any component within that channel.

- <Channel>.createMessageComponentCollector(…)
+ <Message>.createMessageComponentCollector(…)
turbid fulcrum
vapid oracle
#

Yes

turbid fulcrum
#

Ok i will try it

turbid fulcrum
#

I dont find out how should I make the change to collector, changed the listener for the collector with same code inside but now i receive interaction failed when clicking buttons, any idea ? @vapid oracle

#

i changed to this

#

returned interaction failed when clicked button

vapid oracle
#

I suppose your message is the command message from user that doesn't have the buttons. You need to use mensaje

turbid fulcrum
#

that worked, thanks so much sir