Slash command and Unknown interaction

Hi team 🙂 I have a slash command with an action row of buttons, the command is like a personality test, it sends an embed message with a question and each time you click a button to choose an answer (A, B or C) I update the embed with the next question (up to 6 questions). It works all fine itself, but if the User uses the slash command again without finishing the current test, the bot crashes with the following error rawError: { message: 'Unknown interaction', code: 10062 } whenever the user tries to click on a button of any of both messages. For me looks like somehow the ActionRow is not correctly attached to the Embed (doesn't make much sense since I create the actionRow inside chatInputRun method every time, so it should be correctly scoped). I can provide more information if needed, can someone help me? 🙂 ❤️
Solution:
Solved, just in case someone faces a similar problem in the future, I was attaching the component collector to the channel instead of the message from the interaction.
- <Channel>.createMessageComponentCollector(…)
+ <Message>.createMessageComponentCollector(…)
- <Channel>.createMessageComponentCollector(…)
+ <Message>.createMessageComponentCollector(…)
...
Jump to solution
2 Replies
Favna
Favna2y ago
Best you ask in the DiscordJS server as this is not a Sapphire problem
Solution
inc0gnit
inc0gnit2y ago
Solved, just in case someone faces a similar problem in the future, I was attaching the component collector to the channel instead of the message from the interaction.
- <Channel>.createMessageComponentCollector(…)
+ <Message>.createMessageComponentCollector(…)
- <Channel>.createMessageComponentCollector(…)
+ <Message>.createMessageComponentCollector(…)
Want results from more Discord servers?
Add your server