How would you accomplish this?

I've got the following situation. My bot is attempting to collect information from a user. At first, it will ask you, "How did you find us", and provide a bunch of buttons to click. After clicking one of the button, it'll prompt you with a modal asking for the Discord ID of the person who invited you, I was looking for a way to send the person back to phase 1 if they refuse to answer(i.e. click cancel or exit the modal). I've been told that there is no event for exiting/canceling the modal, however how would you execute this?
6 Replies
d.js toolkit
d.js toolkit14mo 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
Diem
DiemOP14mo ago
bun version 1.0.6 & └── [email protected]
Mac
Mac14mo ago
There is no way to know if a user closed a modal and you can only send them a modal if they press a button again. There's no good way to do it unless you're trying to be annoying and then you could put a timer and give the user 60s and if they don't answer in that timeframe, ping them and tell them to hit the button again but I'd advise against it because its sounds annoying and might be annoying depending on who uses ur bot
Diem
DiemOP14mo ago
Is there a best practice for how do an alternative? I'm fairly new to Discord bot programming, so I'm not exactly sure what best practices to follow/haven't seen enough examples of other bots.
Mac
Mac14mo ago
I'm unsure as to what your command is Sounds like a feedback typa thing
Diem
DiemOP14mo ago
I'll try to example exactly what occurs, sorry about that. 1. User types /register command 2. User is prompted with a message embed with 3 buttons, with a title saying "How did you find us" 3. User presses one of the three buttons, "Reddit" button 4. Modal appears infront of user stating, "Please enter your Reddit ID" Here is where I'm hitting a roadblock. If user closes this modal, I want the previous message embed to go back to step 2. Where they're prompted with 3 buttons again. As I was typign this out, I just thought, "why not just not modify the message embed unless user has submitted their Reddit ID" so I think that'll just solve my issue though lol.
Want results from more Discord servers?
Add your server