@discord-types/builders/interaction/option
API reference for @discord-types/builders/interaction/option
@discord-types/builders/interaction/option
Types
Option
Raw Type
type Option = Option.Prototype, & {
type: interactionTypes.ApplicationCommandOptionType?,
name: string?,
nameLocalizations: {
[apiTypes.LanguageLocales]: string
},
description: string?,
descriptionLocalizations: {
[apiTypes.LanguageLocales]: string
},
required: boolean?,
choices: {interactionChoice.JSON},
options: {JSON},
channelTypes: {channelTypes.ChannelType},
minValue: number?,
maxValue: number?,
minLength: number?,
maxLength: number?,
autocomplete: boolean?
}
Intersection with variants:
Variant 2
Prop | Type | Description |
---|---|---|
type? | - | |
name? | - | |
nameLocalizations | - | |
description? | - | |
descriptionLocalizations | - | |
required? | - | |
choices | - | |
options | - | |
channelTypes | - | |
minValue? | - | |
maxValue? | - | |
minLength? | - | |
maxLength? | - | |
autocomplete? | - |
JSON
Raw Type
type JSON = Option.Prototype.build(nil :: any),
Functions
Option.Prototype.setType
[[ Set the Type of option that will be built. ]]
Function Signature
--[[
Set the Type of option that will be built.
]]
function Option.Prototype.setType(self: Option, type: interactionTypes.ApplicationCommandOptionType) -> Option end
Arguments
type
interactionTypes.ApplicationCommandOptionType
Returns
ret1
Option.Prototype.setName
[[ Set the name of this option, option name needs to be kebab case. ]]
Function Signature
--[[
Set the name of this option, option name needs to be kebab case.
]]
function Option.Prototype.setName(self: Option, name: string) -> Option end
Arguments
name
Returns
ret1
Option.Prototype.setNameLocalization
[[ add a name localization for this option. ]]
Function Signature
--[[
add a name localization for this option.
]]
function Option.Prototype.setNameLocalization(self: Option, localization: apiTypes.LanguageLocales, name: string) -> Option end
Arguments
localization
name
Returns
ret1
Option.Prototype.setDescription
[[ set the description of this option. ]]
Function Signature
--[[
set the description of this option.
]]
function Option.Prototype.setDescription(self: Option, description: string) -> Option end
Arguments
description
Returns
ret1
Option.Prototype.setDescriptionLocalization
[[ add a description localization for this option. ]]
Function Signature
--[[
add a description localization for this option.
]]
function Option.Prototype.setDescriptionLocalization(self: Option, localization: apiTypes.LanguageLocales, description: string) -> Option end
Arguments
localization
description
Returns
ret1
Option.Prototype.setRequired
[[ set if the option is required, will not work on SubCommand or SubCommandGroup options. ]]
Function Signature
--[[
set if the option is required, will not work on SubCommand or SubCommandGroup options.
]]
function Option.Prototype.setRequired(self: Option, isRequired: boolean) -> Option end
Arguments
isRequired
Returns
ret1
Option.Prototype.addChoice
[[ add a choice to the option, will only work on String, Integer, or Number options. ]]
Function Signature
--[[
add a choice to the option, will only work on String, Integer, or Number options.
]]
function Option.Prototype.addChoice(self: Option, choice: interactionChoice.JSON) -> Option end
Arguments
choice
Returns
ret1
Option.Prototype.option
Function Signature
function Option.Prototype.option(self: Option, fn: (Option) -> JSON) -> Option end
Arguments
fn
Function Signature
fn: (Option) -> JSON
Arguments
arg1
Returns
ret1
Returns
ret1
Option.Prototype.addOption
[[ add an option to the option, will only work on SubCommand or SubCommandGroup options. ]]
Function Signature
--[[
add an option to the option, will only work on SubCommand or SubCommandGroup options.
]]
function Option.Prototype.addOption(self: Option, option: JSON) -> Option end
Arguments
option
Returns
ret1
Option.Prototype.addChannelType
[[ add supported channel types, will only work on Channel options. ]]
Function Signature
--[[
add supported channel types, will only work on Channel options.
]]
function Option.Prototype.addChannelType(self: Option, channelType: channelTypes.ChannelType) -> Option end
Arguments
channelType
Returns
ret1
Option.Prototype.setMinValue
[[ set the min value of this option, will only work on Integer or Number options. ]]
Function Signature
--[[
set the min value of this option, will only work on Integer or Number options.
]]
function Option.Prototype.setMinValue(self: Option, value: number) -> Option end
Arguments
value
Returns
ret1
Option.Prototype.setMaxValue
[[ set the max value of this option, will only work on Integer or Number options. ]]
Function Signature
--[[
set the max value of this option, will only work on Integer or Number options.
]]
function Option.Prototype.setMaxValue(self: Option, value: number) -> Option end
Arguments
value
Returns
ret1
Option.Prototype.setMinLength
[[ set the min length of this option, will only work on String options. ]]
Function Signature
--[[
set the min length of this option, will only work on String options.
]]
function Option.Prototype.setMinLength(self: Option, value: number) -> Option end
Arguments
value
Returns
ret1
Option.Prototype.setMaxLength
[[ set the max length of this option, will only work on String options. ]]
Function Signature
--[[
set the max length of this option, will only work on String options.
]]
function Option.Prototype.setMaxLength(self: Option, value: number) -> Option end
Arguments
value
Returns
ret1
Option.Prototype.setAutocompleteEnabled
[[ If autocomplete interactions are enabled for this option, will only work on String, Integer, or Number options. ]]
Function Signature
--[[
If autocomplete interactions are enabled for this option, will only work on String, Integer, or Number options.
]]
function Option.Prototype.setAutocompleteEnabled(self: Option, autocompleteEnabled: boolean) -> Option end
Arguments
autocompleteEnabled
Returns
ret1
Option.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 Option.Prototype.build(self: Option) -> JSON end
Returns
ret1
Option.Interface.new
[[ Constructor for the Discord Default Reaction Builder.
```lua local defaultReaction = Option.new("000000000000000000", "secret-emoji"):build() ``` ]]
Function Signature
--[[
Constructor for the Discord Default Reaction Builder.
\`\`\`lua
local defaultReaction = Option.new("000000000000000000", "secret-emoji"):build()
\`\`\`
]]
function Option.Interface.new(resource: {
type: interactionTypes.ApplicationCommandOptionType?,
name: string?,
nameLocalizations: {
[apiTypes.LanguageLocales]: string
}?,
description: string?,
descriptionLocalizations: {
[apiTypes.LanguageLocales]: string
}?,
required: boolean?,
choices: {apiTypes.ApplicationCommandOptionChoiceObject}?,
options: {JSON}?,
channelTypes: {apiTypes.ChannelType}?,
minValue: number?,
maxValue: number?,
minLength: number?,
maxLength: number?,
autocomplete: boolean?
}?) -> Option end
Arguments
resource
This field is optional and may not be specified
{type: interactionTypes.ApplicationCommandOptionType?, name: string?, nameLocalizations: {[apiTypes.LanguageLocales]: string}?, description: string?, descriptionLocalizations: {[apiTypes.LanguageLocales]: string}?, required: boolean?, choices: {apiTypes.ApplicationCommandOptionChoiceObject}?, options: {JSON}?, channelTypes: {apiTypes.ChannelType}?, minValue: number?, maxValue: number?, minLength: number?, maxLength: number?, autocomplete: boolean?}?
Returns
ret1
Last updated on