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
d.js toolkit
d.js toolkit17mo 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!
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
wert
wertOP17mo ago
do you have an example on hand?
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs17mo ago
guide Slash Commands: Adding options read more
wert
wertOP17mo ago
thanks.
wert
wertOP17mo ago
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.
treble/luna
treble/luna17mo ago
no, they're optional
wert
wertOP17mo ago
@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>"
treble/luna
treble/luna17mo ago
then...use addStringOption? literally follow the screenshot you sent
wert
wertOP17mo ago
wert
wertOP17mo ago
there's no getString() available to me am i missing something?
treble/luna
treble/luna17mo ago
there is
wert
wertOP17mo ago
okay so am i trying to reference it wrong? or am i missing a library?
treble/luna
treble/luna17mo ago
you have an error in the line below and for autocomplete, i never had those things autocomplete (in js)
duck
duck17mo ago
if you're just referring to intellisense, the parameter interaction lacks a type you'd want to use jsdocs
wert
wertOP17mo ago
gotchya. Thanks.
Want results from more Discord servers?
Add your server