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