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 docs2y 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
Pooyan2y ago
discord.js v13.8.0 node.jsV16
Stealth
Stealth2y ago
yes add multiple options right after another?
Pooyan
Pooyan2y ago
for example we have command named soundboard
Stealth
Stealth2y ago
yes
Pooyan
Pooyan2y ago
/soundboard language sounds
Stealth
Stealth2y ago
yes
Pooyan
Pooyan2y ago
/soundboard english hello/bye /soundboard french yo/siu
Stealth
Stealth2y ago
You can do autocomplete I think?
Pooyan
Pooyan2y ago
How what is that?
d.js docs
d.js docs2y ago
guide Interactions: Autocomplete read more
Pooyan
Pooyan2y 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
Stealth2y ago
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
Pooyan2y ago
thanks
Stealth
Stealth2y ago
np
monbrey
monbrey2y ago
No need to save, you can just get previously filled options in an autocomplete