Skip to content

Option

Implementation of discords Option object as a Luau builder.

https://discord.com/developers/docs/interactions/message-components#Options

Properties

The Option instance has no set properties!

Methods

The Option instance has no set methods!

Functions

setLabel

Option . setLabel (

     self: Option
     label: string
)  -> ()

Sets the user-facing name of the option.

setValue

Option . setValue (

     self: Option
     value: string
)  -> ()

Sets the dev-defined value of the option.

setDescription

Option . setDescription (

     self: Option
     description: string
)  -> ()

Sets an additional description of the option.

setEmoji

Option . setEmoji (

     self: Option
     emoji: emoji.JSON
)  -> ()

Sets an emoji to display alongside the option.

setDefault

Option . setDefault (

     self: Option
     default: boolean
)  -> ()

Sets whether this option is selected by default.

build

Option . build (

     self: Option
)  -> ()

Responsible for building the Option JSON that can be parsed by the Discord API.

new

Option . new (

     resource: {
       label: string?,
       value: string?,
       description: string?,
       emoji: emoji.JSON?,
       default: boolean?,
    }
)  -> ()

Responsible for creating a new Option.

local option = Option.new({
label = "My Option",
value = "option_value",
description = "A description",
default = false
})