简体   繁体   中英

DiscordJS v14 Slash commands option depends on option

I want to make a Discord slash command where you need to select one choice and then another choice.

But depending of what choice is made in the first place (in choice 1) the options/values in the choice 2 are changing.

Is that 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.

Best Regards,

Paul

.setName("test")
.setDescription("test description")
.addStringOption(option => option
    .setName("choice1")
    .setDescription("choice1 description")
    .addChoices(
        {
            name: "A",
            value: "one"
        },
        {
            name: "B", 
            value: "two"
        }
    )
)
.addStringOption(option => option
    .setName("choice2")
    .setDescription("choice2 description")
    .addChoices(
        {
            name: "C",
            value: "three"
        },
        {
            name: "D", 
            value: "four"
        }
    )
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM