Best way to take a second argument for slash commands?
It pretty much is all explained in the title. I have working slash commands, but I would like to take a second argument with the slash command.
17 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!Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
do you have an example on hand?
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
thanks.
is line 17's 'interaction.options.getString()' locked to choices? I'm trying to use .addStringOption() to require a second argument to my slash command which takes user input.
no, they're optional
@Jô 🌈 🦄 I think my title was misleading. I want to add an argument like .addStringOption(), but i'm unsure on how to do it. I only need one argument. For example "/bot <string>"
then...use addStringOption?
literally follow the screenshot you sent
there's no getString() available to me am i missing something?
there is
okay so am i trying to reference it wrong?
or am i missing a library?
you have an error in the line below
and for autocomplete, i never had those things autocomplete
(in js)
if you're just referring to intellisense, the parameter
interaction
lacks a type
you'd want to use jsdocsgotchya. Thanks.