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