LogoAntiRaid

@discord-types/builders/interaction/choice

API reference for @discord-types/builders/interaction/choice

@discord-types/builders/interaction/choice

Types

Choice

Raw Type
type Choice = Choice.Prototype, & {
	name: string,

	nameLocalizations: {
		[apiTypes.LanguageLocales]: string
	},

	value: string | number
}

Intersection with variants:

Variant 2
PropTypeDescription
name
-
nameLocalizations
{[apiTypes.LanguageLocales]: string}
-
value
-

JSON

Raw Type
type JSON = Choice.Prototype.build(nil :: any),

Functions

Choice.Prototype.setName

[[ Responsible for setting the name of the choice. Name must be kebab case, with 1-100 characters. ]]

Function Signature
--[[
	Responsible for setting the name of the choice. Name must be kebab case, with 1-100 characters.
]]
function Choice.Prototype.setName(self: Choice, name: string) -> Choice end

Arguments

name

string

Returns

ret1

Choice

Choice.Prototype.setNameLocalization

[[ Adding localization to the Name of the choice, enabling developers to create milti-language support. ]]

Function Signature
--[[
	Adding localization to the Name of the choice, enabling developers to create milti-language support.
]]
function Choice.Prototype.setNameLocalization(self: Choice, localization: apiTypes.LanguageLocales, name: string) -> Choice end

Arguments

localization

apiTypes.LanguageLocales

name

string

Returns

ret1

Choice

Choice.Prototype.setValue

[[ Set the value of the choice, value can only be either a string or number. ]]

Function Signature
--[[
	Set the value of the choice, value can only be either a string or number.
]]
function Choice.Prototype.setValue(self: Choice, value: string | number) -> Choice end

Arguments

value

Union with variants:

Variant 1

string

Variant 2

number

Returns

ret1

Choice

Choice.Prototype.build

[[ Responsible for buillding the default reaction object that the Discord API can understand. ]]

Function Signature
--[[
	Responsible for buillding the default reaction object that the Discord API can understand.
]]
function Choice.Prototype.build(self: Choice) -> JSON end

Returns

ret1

JSON

Choice.Interface.new

[[ Constructor for the Discord Default Reaction Builder.

```lua local defaultReaction = Choice.new({ name = "example-choice", value = "example-value", }):build() ``` ]]

Function Signature
--[[
	Constructor for the Discord Default Reaction Builder.

	\`\`\`lua
	local defaultReaction = Choice.new({
		name = "example-choice",
		value = "example-value",
	}):build()
	\`\`\`
]]
function Choice.Interface.new(resource: {
		name: string?,

		nameLocalizations: {
			[apiTypes.LanguageLocales]: string
		}?,

		value: string | number?
	}?) -> Choice end

Arguments

resource

This field is optional and may not be specified

{name: string?, nameLocalizations: {[apiTypes.LanguageLocales]: string}?, value: (string | number?)}?

Returns

ret1

Choice

Last updated on