Best way to chain select menus

DiscordJS version : 14.15.3 NodeJS version : 20.15.1 Hello guys ! Context : I need to create a command that will ask the user a few questions via the stringSelectMenu component (like a form). Each menus options depend of previous menu answer and some database requests. After the last question, i'll save answers into the database. I tried several approach : * Dedicated menu and customId handler, with external data to save each answer. * Messages component collector to handle all menus but face off some interactions issues * Update reply at each step or create new message to display each component Question : Before taking more time to solve the problem and get it up and running. I would like to know what is the best approach or practice to meet this need ?
2 Replies
d.js toolkit
d.js toolkit14h 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!
Syjalo
Syjalo13h ago
I'd make a single interactionCreate listener. It would parse the custom id for the form id and the current question. Let's say the user answers the first question with the second option for the my-form select menu. The bot updates the message with the my-form:2 custom id of select menu. For the next question the user selects first option, the bot update the message with my-form:2:1, and so on until the last question. On the last question answer you have a custom id with all the answers for the form.
Want results from more Discord servers?
Add your server