CommandOptionChoiceBuilder class
constructor
The constructor provides one optional argument, which is an object which provides the data for the Command Option Choice Builder.
The object may contain the following information:
name
: The name of the option you'd like to set. The name must be a string with at least 1 character and max 100 characters.value
: The value which the bot should receive when this option is being used by a member. The value must be a string, integer or a double. When the value is a string, the value must be between 1 and 100 characters.
Properties
name
The name for the choice which was set with the setName function.
value
The value for the choice which the bot receives when this option was used by the member who executed the command and was set with the setValue function.
Functions
setName
Sets the name for the command option choice, which the member who executes the command can see. The function returns the same CommandOptionChoiceBuilder class so you don't have to declare it everytime again.
Argument | Description |
---|---|
name | The name you want to give the command option choice and is visible for the members who execute the command. |
setValue
Sets the value for the command option choice. The bot will receive this value when this option was used by the member. The function returns the same CommandOptionChoiceBuilder class so you don't have to declare it everytime again.
Argument | Description |
---|---|
value | The value you want to receive when the member uses this choice in the option field of the command. This can be a integer, double or a string. When this is a string, the string may not be longer than 100 characters. |
toJSON
Converts the CommandOptionChoiceBuilder to an object to make it a valid object for the Discord API.
Last updated