Remove String Option

I want to remove UserOption When StringOption's choice is all I don't know how to remove below part
.addUserOption((option) =>
option
.setName('user')
.setDescription('select user')
.setRequired(true))
.addUserOption((option) =>
option
.setName('user')
.setDescription('select user')
.setRequired(true))
This is the whole code of command
data: new SlashCommandBuilder()
.setName("point")
.setDescription("point description")
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)

.addStringOption((option) =>
option
.setName('option')
.setDescription('select option')
.setRequired(true)
.addChoices({name: "add", value: "add"},
{name: "sub", value: "sub"}, {name: "all", value: "all"}))

.addUserOption((option) =>
option
.setName('user')
.setDescription('select user')
.setRequired(true))

.addStringOption((option) =>
option.setName("point")
.setDescription("input point")
.setRequired(true)),

execute(interaction, client){

if(option == "all"){
//????
}
}

data: new SlashCommandBuilder()
.setName("point")
.setDescription("point description")
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)

.addStringOption((option) =>
option
.setName('option')
.setDescription('select option')
.setRequired(true)
.addChoices({name: "add", value: "add"},
{name: "sub", value: "sub"}, {name: "all", value: "all"}))

.addUserOption((option) =>
option
.setName('user')
.setDescription('select user')
.setRequired(true))

.addStringOption((option) =>
option.setName("point")
.setDescription("input point")
.setRequired(true)),

execute(interaction, client){

if(option == "all"){
//????
}
}

8 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
edocsil
edocsil2y ago
This is a perfect example of when to use subcommands "add", "sub", and "all" should each be subcommands with the options they need. It is not possible to remove an option as a command is being used (though it could just be ignored)
계정 버림
계정 버림OP2y ago
Ah I never used the subCommands
계정 버림
계정 버림OP2y ago
계정 버림
계정 버림OP2y ago
sub Commands same return like this?( Sorry for Korean)
edocsil
edocsil2y ago
The command name and subcommand name are separated by spaces, so it would look like /point add <user> <point>
d.js docs
d.js docs2y ago
guide Slash Commands: Subcommands read more
계정 버림
계정 버림OP2y ago
Oh Okkkay I'll change it to subCommand Thank uu
Want results from more Discord servers?
Add your server