Discord.js v13 Slash command's option depends on the option

Is this possible? Example: /command choice1 choice2 If I select "A" in choice1 I get "One" and "Two" as choices in choice. But when I select "B" in choice1, I will get "Three" and "Four" as choice2 options.
16 Replies
d.js docs
d.js docs3y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Pooyan
PooyanOP3y ago
discord.js v13.8.0 node.jsV16
⸸⛧Stealth⛧⸸
yes add multiple options right after another?
Pooyan
PooyanOP3y ago
for example we have command named soundboard
Pooyan
PooyanOP3y ago
/soundboard language sounds
Pooyan
PooyanOP3y ago
/soundboard english hello/bye /soundboard french yo/siu
⸸⛧Stealth⛧⸸
You can do autocomplete I think?
Pooyan
PooyanOP3y ago
How what is that?
d.js docs
d.js docs3y ago
guide Interactions: Autocomplete read more
Pooyan
PooyanOP3y ago
I want to change the second choice when language is selected English:
.addStringOption(option =>
option.setName('type')
.setDescription('The gif type')
.setRequired(true)
.addChoices(
{ name: 'Hello', value: 'sound_augh' },
{ name: 'Bye', value: 'sound_borogomshobaba' },
.addStringOption(option =>
option.setName('type')
.setDescription('The gif type')
.setRequired(true)
.addChoices(
{ name: 'Hello', value: 'sound_augh' },
{ name: 'Bye', value: 'sound_borogomshobaba' },
French:
.addStringOption(option =>
option.setName('type')
.setDescription('The gif type')
.setRequired(true)
.addChoices(
{ name: 'Siu', value: 'sound_augh' },
{ name: 'wassup', value: 'sound_borogomshobaba' },
.addStringOption(option =>
option.setName('type')
.setDescription('The gif type')
.setRequired(true)
.addChoices(
{ name: 'Siu', value: 'sound_augh' },
{ name: 'wassup', value: 'sound_borogomshobaba' },
⸸⛧Stealth⛧⸸
One way you can do it is to manage both of those choices with an autocomplete and upon choosing the languages on the first choice, you save that chosen language in a cache Via .getFocused
Pooyan
PooyanOP3y ago
thanks
monbrey
monbrey3y ago
No need to save, you can just get previously filled options in an autocomplete
Want results from more Discord servers?
Add your server