CommandOptionsBuilder class
Last updated
Last updated
The constructor provides one optional argument, which is an object which provides the data for the Command Options Builder.
The object may contain the following information:
name
: The name of the command option you want to create.
description
: A description of what the command option does.
required
: A boolean which defines whether the option is required to fill in or not.
choices
: An array with raw data of the command option choices which users can choose between in the slash command.
channelTypes
: An array with the channel types as a number a user will get when the user has to fill in a channel option.
type
: The option type a user has as a number.
minValue
: A number for when the option type is a number with the minimum number a user should provide.
maxValue
: A number for when the option type is a number with the maximum number a user may provide.
minLength
: The minimum length of a string when the option type is a string.
maxLength
: The maximum length of a string when the option type is a string.
Argument | Description |
---|---|
The name of the command option which was set with the setName function.
The description of the command option which was set with the setDescription function.
A boolean which defines whether it is required or not to fill the command option in and was set with the setRequired function.
An array with the command option choices converted to an object to make it a valid Discord API object, that have been set with the addChoices function.
An array with the allowed channel types for when the command option type is a channel, that have been set with the addChannelTypes function.
A number which defines what the command option type is and has been set with the setOptionType function.
The minimum number or integer that should be given when the command option type is a number or integer and has been set with the setMinValue function.
The maximum number or integer that should be given when the command option type is a number or integer and has been set with the setMaxValue function.
The minimum length of the string that should be given when the command option type is a string and has been set with the setMinLength function.
The maxmimum length of the string that should be given when the command option type is a string and has been set with the setMaxLength function.
Sets the type for the command and returns the same CommandOptionsBuilder class so you don't have to declare it everytime again. This is required to create a command option. The available types can be found on the CommandOptionTypes page.
Sets the name for the command and returns the same CommandOptionsBuilder class so you don't have to declare it everytime again. This is required to create a command option.
Sets the description for the command and returns the same CommandOptionsBuilder class so you don't have to declare it everytime again. This is required to create a command option.
Defines whether the command option is required for users using the command to fill in or not and returns the same CommandOptionsBuilder class so you don't have to declare it everytime again.
Adds pre-made choices a user can choose between when using the command option and returns the same CommandOptionsBuilder class so you don't have to declare it everytime again.
Adds options to the command which users can fill in in case the parent CommandOptionsBuilder is a sub command. The function returns the same CommandOptionsBuilder class so you don't have to declare it everytime again. The options will be returned to the addon once the user executes the command.
Makes sure when the command option is a channel option type that only the channel types which are given in the addChannelTypes
will be shown and not any other channel types. The function returns the CommandOptionsBuilder class so you don't have to declare it everytime again. The available types can be found on the ChannelTypes page.
Sets the minimum number or integer which a user should give when the command option type is a number or integer and returns the CommandOptionsBuilder class so you don't have to declare it everytime again.
Sets the maximum number or integer which a user may give when the command option type is a number or integer and returns the CommandOptionsBuilder class so you don't have to declare it everytime again.
Sets the minimum length of the string which a user should give when the command option type is a string and returns the CommandOptionsBuilder class so you don't have to declare it everytime again.
Sets the maximum length of the string which a user should give when the command option type is a string and returns the CommandOptionsBuilder class so you don't have to declare it everytime again.
Converts the CommandBuilder to an object to make it a valid object for the Discord API.
Argument | Description |
---|---|
Argument | Description |
---|---|
Argument | Description |
---|---|
Argument | Description |
---|---|
Argument | Description |
---|---|
Argument | Description |
---|---|
Argument | Description |
---|---|
Argument | Description |
---|---|
Argument | Description |
---|---|
Argument | Description |
---|---|
data
An object with the data to create the Command Options Builder from. The data which can be added is mentioned above.
type
A number which represents the type the option should have. The available types can be found on the CommandOptionTypes page.
name
The name of the command option which is visible to the users using the command.
description
The description of the command option which tells what the command option does and is visible to the users using the command.
required
A boolean which defines whether the command option should be required to fill in or not.
choices
An array of CommandOptionChoiceBuilder classes or a CommandOptionChoiceBuilder class which defines the choice(s) a user can choose between when using the command.
channelTypes
An array of channelTypes or a channelType as a number which defines which channel types can be chosen from when using the command option if the command option is a channel command option. The available types can be found on the ChannelTypes page.
min
The minimum value the user should give when the command option type is a number or integer.
max
The maximum value the user may give when the command option type is a number or integer.
min
The minimum length of a string which a user should give when the command option type is a string.
max
The maximum length of a string which a user should give when the command option type is a string.