Skip to content

Choice

Implementation of the Application Command Option Choice Structure in Luau.

https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure

Choice.name  :: string

The name of the choice that is displayed to users.

Choice.nameLocalizations  :: {
{ [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.

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
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
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
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