Skip to content

Button

Implementation of discords Button object as a Luau builder.

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

Properties

The Button instance has no set properties!

Methods

The Button instance has no set methods!

Functions

setStyle

Button . setStyle (

     self: Button
     buttonStyle: apiTypes.ButtonStyle
)  -> ()

Sets the style of the button. This determines the button’s appearance and behavior.

setLabel

Button . setLabel (

     self: Button
     label: string
)  -> ()

Sets the text that appears on the button. Must be between 1-80 characters.

setEmoji

Button . setEmoji (

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

Sets the emoji that appears on the button.

setCustomId

Button . setCustomId (

     self: Button
     customId: string
)  -> ()

Sets a developer-defined identifier for the button that will be sent when the button is clicked.

setSkuId

Button . setSkuId (

     self: Button
     skuId: string
)  -> ()

Sets the SKU ID for the button, used for purchase buttons.

setUrl

Button . setUrl (

     self: Button
     url: string
)  -> ()

Sets the URL that the button will navigate to when clicked.

setDisabled

Button . setDisabled (

     self: Button
     disabled: boolean
)  -> ()

Sets whether the button is disabled and cannot be clicked.

build

Button . build (

     self: Button
)  -> ()

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

new

Button . new (

     resource: {
       style: apiTypes.ButtonStyle,
       label: string?,
       emoji: emoji.JSON?,
       customId: string?,
       skuId: string?,
       url: string?,
       disabled: boolean?,
    }
)  -> ()

Responsible for creating a new Button.

local button = Button.new({
style = "Primary",
label = "Click me!",
customId = "my_button"
})