CommandOptionBuilder
CommandOptionBuilder is used to construct options for a Discord application command, including type, name, description, and choices.
Usage:
Properties
Type
An enumeration of option types.
- SubCommand: 1
- SubCommandGroup: 2
- String: 3
- Integer: 4
- Boolean: 5
- User: 6
- Channel: 7
- Role: 8
- Mentionable: 9
- Number: 10
- Attachment: 11
ChannelType
An enumeration of channel types.
- GuildText: 0
- DirectMessage: 1
- GuildVoice: 2
- GroupDirectMessage: 3
- GuildCategory: 4
- GuildAnnouncement: 5
- AnnouncementThread: 10
- PublicThread: 11
- PrivateThread: 12
- GuildStageVoice: 13
- GuildDirectory: 14
- GuildForum: 15
Methods
setType
CommandOptionBuilder : setType () -> Builders.CommandOptionBuilder
optionType: number
Sets the type of the option.
setName
CommandOptionBuilder : setName () -> Builders.CommandOptionBuilder
optionName: string
Sets the name of the option.
setLocalization
CommandOptionBuilder : setLocalization () -> Builders.CommandOptionBuilder
localizationCode: string
Sets the localization code for the option.
setDescription
CommandOptionBuilder : setDescription () -> Builders.CommandOptionBuilder
optionDescription: string
Sets the description of the option.
setRequired
CommandOptionBuilder : setRequired () -> Builders.CommandOptionBuilder
isRequired: boolean
Sets whether the option is required.
setChannelTypes
CommandOptionBuilder : setChannelTypes () -> Builders.CommandOptionBuilder
channelTypes: ...
Sets the channel types for the option.
setMinValue
CommandOptionBuilder : setMinValue () -> Builders.CommandOptionBuilder
minValue: number
Sets the minimum value for the option.
setMaxValue
CommandOptionBuilder : setMaxValue () -> Builders.CommandOptionBuilder
maxValue: number
Sets the maximum value for the option.
setMinLength
CommandOptionBuilder : setMinLength () -> Builders.CommandOptionBuilder
minLength: number
Sets the minimum length for the option.
setMaxLength
CommandOptionBuilder : setMaxLength () -> Builders.CommandOptionBuilder
maxLength: number
Sets the maximum length for the option.
setAutocompleteEnabled
CommandOptionBuilder : setAutocompleteEnabled () -> Builders.CommandOptionBuilder
autocomplete: boolean
Sets whether autocomplete is enabled for the option.
addOption
CommandOptionBuilder : addOption () -> Builders.CommandOptionBuilder
commandOption: CommandOptionBuilder
Adds a sub-option to the option.
addChoice
CommandOptionBuilder : addChoice () -> Builders.CommandOptionBuilder
choiceName: string
choiceValue: any
Adds a choice to the option.
toPayloadObject
CommandOptionBuilder : toPayloadObject () -> Network.Resolvable
Converts the option to a JSON object that can be sent to the Discord API.
Functions
new
CommandOptionBuilder . new () -> ()
Creates a new instance of CommandOptionBuilder.