Option
Implementation of the Application Command Option Structure in Luau.
Summary
Properties
Option.type :: apiTypes.ApplicationCommandOptionType?Option.name :: string?Option.nameLocalizations :: { [apiTypes.LanguageLocales]: string }Option.description :: string?Option.descriptionLocalizations :: { [apiTypes.LanguageLocales]: string }Option.required :: boolean?Option.choices :: { Builders.Interaction.Choice.JSON }Option.options :: { Builders.Interaction.Option.JSON }Option.channelTypes :: { apiTypes.ChannelType }Option.minValue :: number?Option.maxValue :: number?Option.minLength :: number?Option.maxLength :: number?Option.autocomplete :: boolean?Methods
Option:setType(type: apiTypes.ApplicationCommandOptionType) → OptionOption:setName(name: string) → OptionOption:setNameLocalization(localization: apiTypes.LanguageLocales, name: string) → OptionOption:setDescription(description: string) → OptionOption:setDescriptionLocalization(localization: apiTypes.LanguageLocales, description: string) → OptionOption:setRequired(isRequired: boolean) → OptionOption:addChoice(choice: interactionChoice.JSON) → OptionOption:addOption(option: JSON) → OptionOption:addChannelType(channelType: apiTypes.ChannelType) → OptionOption:setMinValue(value: number) → OptionOption:setMaxValue(value: number) → OptionOption:setMinLength(value: number) → OptionOption:setMaxLength(value: number) → OptionOption:setAutocompleteEnabled(autocompleteEnabled: boolean) → OptionOption:build() → JSONProperties
Section titled “Properties”The type of option (e.g., String, Integer, SubCommand).
The name of the option.
nameLocalizations
Section titled “nameLocalizations”{ [apiTypes.LanguageLocales]: string } }
Name localizations for different language locales.
description
Section titled “description”The description of the option.
descriptionLocalizations
Section titled “descriptionLocalizations”{ [apiTypes.LanguageLocales]: string } }
Description localizations for different language locales.
required
Section titled “required”Whether this option is required to be set by the user.
choices
Section titled “choices”Possible choices for this option (String, Integer, or Number types only).
options
Section titled “options”Sub-options for this option (SubCommand or SubCommandGroup only).
channelTypes
Section titled “channelTypes”Supported channel types for Channel option type.
minValue
Section titled “minValue”Minimum value allowed for the option (Integer/Number only).
maxValue
Section titled “maxValue”Maximum value allowed for the option (Integer/Number only).
minLength
Section titled “minLength”Minimum string length for the option (String only).
maxLength
Section titled “maxLength”Maximum string length for the option (String only).
autocomplete
Section titled “autocomplete”Whether autocomplete is enabled (String, Integer, or Number types only).
Methods
Section titled “Methods”setType
Section titled “setType”Option : setType ( type ) -> Option
Set the Type of option that will be built.
Parameters
| type: ApplicationCommandOptionType |
Returns
| Option |
setName
Section titled “setName”Option : setName ( name ) -> Option
Set the name of this option, option name needs to be kebab case.
Parameters
| name: string |
Returns
| Option |
setNameLocalization
Section titled “setNameLocalization”Option : setNameLocalization ( localization , name ) -> Option
Add a name localization for this option.
Parameters
| localization: LanguageLocales | |
| name: string |
Returns
| Option |
setDescription
Section titled “setDescription”Option : setDescription ( description ) -> Option
Set the description of this option.
Parameters
| description: string |
Returns
| Option |
setDescriptionLocalization
Section titled “setDescriptionLocalization”Option : setDescriptionLocalization ( localization , description ) -> Option
Add a description localization for this option.
Parameters
| localization: LanguageLocales | |
| description: string |
Returns
| Option |
setRequired
Section titled “setRequired”Option : setRequired ( isRequired ) -> Option
Set if the option is required, will not work on SubCommand or SubCommandGroup options.
Parameters
| isRequired: boolean |
Returns
| Option |
addChoice
Section titled “addChoice”Option : addChoice ( choice ) -> Option
Add a choice to the option, will only work on String, Integer, or Number options.
Parameters
| choice: JSON |
Returns
| Option |
addOption
Section titled “addOption”Option : addOption ( option ) -> Option
Add an option to the option, will only work on SubCommand or SubCommandGroup options.
Parameters
| option: JSON |
Returns
| Option |
addChannelType
Section titled “addChannelType”Option : addChannelType ( channelType ) -> Option
Add supported channel types, will only work on Channel options.
Parameters
| channelType: ChannelType |
Returns
| Option |
setMinValue
Section titled “setMinValue”Option : setMinValue ( value ) -> Option
Set the min value of this option, will only work on Integer or Number options.
Parameters
| value: number |
Returns
| Option |
setMaxValue
Section titled “setMaxValue”Option : setMaxValue ( value ) -> Option
Set the max value of this option, will only work on Integer or Number options.
Parameters
| value: number |
Returns
| Option |
setMinLength
Section titled “setMinLength”Option : setMinLength ( value ) -> Option
Set the min length of this option, will only work on String options.
Parameters
| value: number |
Returns
| Option |
setMaxLength
Section titled “setMaxLength”Option : setMaxLength ( value ) -> Option
Set the max length of this option, will only work on String options.
Parameters
| value: number |
Returns
| Option |
setAutocompleteEnabled
Section titled “setAutocompleteEnabled”Option : setAutocompleteEnabled ( autocompleteEnabled ) -> Option
If autocomplete interactions are enabled for this option, will only work on String, Integer, or Number options.
Parameters
| autocompleteEnabled: boolean |
Returns
| Option |
Option : build ( ) -> JSON
Responsible for building the option object that the Discord API can understand.
Returns
| JSON |
Functions
Section titled “Functions”Option . new ( resource ) -> Option
Constructor for the Discord Default Reaction Builder.
Parameters
| resource: { type: apiTypes.ApplicationCommandOptionType?, name: string?, nameLocalizations: { [apiTypes.LanguageLocales], } |
Returns
| Option |