#how to change one option type after a specific word is chosen in command

16 messages · Page 1 of 1 (latest)

bright marsh
#

Imagine I do a command that goes like this:

-edit string InsertStringHere
-edit integer InsertIntegerHere

how would I do when based of first option it changes the following arg type?

barren bluffBOT
#

• 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.

bright marsh
#

umm its just a question

#

13.5.1 discord.js

 commands?.create({
        name: "edit",
        description: "Edit a listing",
        options: [
            {
                name: "id",
                description: "shops ID",
                required: true,
                type: Discord.Constants.ApplicationCommandOptionTypes.NUMBER
            },
            {
                name: "scope",
                description: "shops ID",
                required: true,
                type: Discord.Constants.ApplicationCommandOptionTypes.STRING
                

            },
            {
                name: "data",
                description: "Value",
                required: true,
                type: Discord.Constants.ApplicationCommandOptionTypes.STRING
            },
        ]
    })```
#

and i'd like to change the "data" option type based on what's provided in the "scope" option

pale monolith
#

the best you can do is make subcommands with different options

bright marsh
#

subcommands ? what are they?

#

isnt it what i'm already doing

pale monolith
#

no, you are using number and string options, the guide should have a section on command structuring

bright marsh
#

which guide?

#

so my way of creating commands is bad?

pale monolith
#

the discord.js guide djsguide

#

it's not bad, but slash commands do provide more options which you can use here

bright marsh
#

i tried the SlashCommandBuilder() function that was provided there but it isnt recognized

#

so i switched to this

pale monolith
#

the guide uses builders which you have to manually install in v13, they are included in v14. there is a v13 version of the guide under http://v13.discordjs.guide