Get input from the user

Hey! I want to create a slash command which when you execute it, you will get options to choose from. After you choose an option, I want the user to be able to enter an input - like string or integer. How can I achieve that?
8 Replies
d.js toolkit
d.js toolkitβ€’3w 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
Amgelo
Amgeloβ€’3w ago
you want the options to vary depending on what the first option is?
𝓣π“ͺ𝓼𝓴
yes I want the input type to be different
Amgelo
Amgeloβ€’3w ago
that's not really possible, options are static once deployed what you can make is a subcommand instead and each subcommand can have different options
d.js docs
d.js docsβ€’3w ago
:guide: Slash Commands: Advanced command creation - Subcommands read more
𝓣π“ͺ𝓼𝓴
yeah ik, it's just looking terrible, wanted to see if there is any other option
Amgelo
Amgeloβ€’3w ago
subcommands don't look that bad and I think it's basically what you want do you have an example of what you're trying to achieve?
𝓣π“ͺ𝓼𝓴
I say they look terrible not in general but specifically for my use case which is for updating specific properties on a doc of a mongodb db - for each property I need to make a subcommand Update: I solved that problem that way: I set a flag for identifying when I want to listen for a input of the user. Then using messageCreate event, I checked if any message is starting with ? and the flag is PromptingUser for example, set the flag to Idle and emit an event with the prompt of the user. On another place I created an once listener for handling it, and in it I set it to off when done.