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
- 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 OPyou want the options to vary depending on what the first option is?
yes
I want the input type to be different
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
yeah ik, it's just looking terrible, wanted to see if there is any other option
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.