help with a verify function

hi guys, I would need help because I have problems finishing a part of the code of my verification function, I would like that through a button that goes to create a menu with modals (which I have already done) depending on if the answer that the user gives me is the right one for example 2+2=4 add a role otherwise nothing would you be able to illustrate me how I can do in this last phase?
2 Replies
d.js toolkit
d.js toolkit11mo 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 OP
ShompiFlen
ShompiFlen11mo ago
Use async / await with https://discord.js.org/docs/packages/discord.js/main/ButtonInteraction:Class#awaitModalSubmit to wait for the modal submition Get the answer the user inputed from the modal fields with <modalsubmit>.fields.getTextInputValue(customId) https://discord.js.org/docs/packages/discord.js/main/ModalSubmitFields:Class#getTextInputValue This value is always a string so parse it accordingly to a number using either parseInt() or some number conversion method Compare both values (the one the bot has to the one the user inputed) and proceed accordingly
Want results from more Discord servers?
Add your server