Choice
Implementation of the Application Command Option Choice Structure in Luau.
Summary
Properties
Choice.name :: stringChoice.nameLocalizations :: { [apiTypes.LanguageLocales]: string }Choice.value :: string | numberProperties
Section titled “Properties”The name of the choice that is displayed to users.
nameLocalizations
Section titled “nameLocalizations” Choice.nameLocalizations :: {
{ [apiTypes.LanguageLocales]: string } }
{ [apiTypes.LanguageLocales]: string } }
Dictionary of localization entries for the choice name.
Choice.value :: string | number
The value that is sent to your application when this choice is selected.
Methods
Section titled “Methods”setName
Section titled “setName”Choice : setName ( name ) -> Choice
Responsible for setting the name of the choice. Name must be kebab case, with 1-100 characters.
Parameters
| name: string |
Returns
| Choice |
setNameLocalization
Section titled “setNameLocalization”Choice : setNameLocalization ( localization , name ) -> Choice
Adding localization to the Name of the choice, enabling developers to create milti-language support.
Parameters
| localization: LanguageLocales | |
| name: string |
Returns
| Choice |
setValue
Section titled “setValue”Choice : setValue ( value ) -> Choice
Set the value of the choice, value can only be either a string or number.
Parameters
| value: string | number |
Returns
| Choice |
Choice : build ( ) -> JSON
Responsible for buillding the default reaction object that the Discord API can understand.
Returns
| JSON |
Functions
Section titled “Functions”Choice . new ( resource ) -> Choice
Constructor for the Discord Default Reaction Builder.
local defaultReaction = Choice.new({ name = "example-choice", value = "example-value",}):build()Parameters
| resource: { name: string?, nameLocalizations: { [apiTypes.LanguageLocales], } |
Returns
| Choice |