Button
Implementation of discords Button object as a Luau builder.
https://discord.com/developers/docs/interactions/message-components#buttons
Summary
Properties
Button.style :: apiTypes.ButtonStyleButton.label :: string?Button.emoji :: Builders.Emoji?Button.customId :: string?Button.skuId :: string?Button.url :: string?Button.disabled :: boolean?Methods
Button:setStyle(buttonStyle: apiTypes.ButtonStyle) → ButtonButton:setLabel(label: string) → ButtonButton:setEmoji(emoji: emoji.JSON) → ButtonButton:setCustomId(customId: string) → ButtonButton:setSkuId(skuId: string) → ButtonButton:setUrl(url: string) → ButtonButton:setDisabled(disabled: boolean) → ButtonButton:build() → JSONProperties
Section titled “Properties”The style of the button that determines its appearance and behavior.
The text that appears on the button.
The emoji that appears on the button.
customId
Section titled “customId”A developer-defined identifier for the button.
The SKU ID for purchase buttons.
The URL that the button will navigate to when clicked.
disabled
Section titled “disabled”Whether the button is disabled and cannot be clicked.
Methods
Section titled “Methods”setStyle
Section titled “setStyle”Button : setStyle ( buttonStyle ) -> Button
Sets the style of the button. This determines the button’s appearance and behavior.
Parameters
| buttonStyle: ButtonStyle |
Returns
| Button |
setLabel
Section titled “setLabel”Button : setLabel ( label ) -> Button
Sets the text that appears on the button. Must be between 1-80 characters.
Parameters
| label: string |
Returns
| Button |
setEmoji
Section titled “setEmoji”Button : setEmoji ( emoji ) -> Button
Sets the emoji that appears on the button.
Parameters
| emoji: JSON |
Returns
| Button |
setCustomId
Section titled “setCustomId”Button : setCustomId ( customId ) -> Button
Sets a developer-defined identifier for the button that will be sent when the button is clicked.
Parameters
| customId: string |
Returns
| Button |
setSkuId
Section titled “setSkuId”Button : setSkuId ( skuId ) -> Button
Sets the SKU ID for the button, used for purchase buttons.
Parameters
| skuId: string |
Returns
| Button |
setUrl
Section titled “setUrl”Button : setUrl ( url ) -> Button
Sets the URL that the button will navigate to when clicked.
Parameters
| url: string |
Returns
| Button |
setDisabled
Section titled “setDisabled”Button : setDisabled ( disabled ) -> Button
Sets whether the button is disabled and cannot be clicked.
Parameters
| disabled: boolean |
Returns
| Button |
Button : build ( ) -> JSON
Responsible for building the Button JSON that can be parsed by the Discord API.
Returns
| JSON |
Functions
Section titled “Functions”Button . new ( resource ) -> Button
Responsible for creating a new Button.
local button = Button.new({ style = "Primary", label = "Click me!", customId = "my_button"})Parameters
| resource: { style: apiTypes.ButtonStyle, label: string?, emoji: emoji.JSON?, customId: string?, skuId: string?, url: string?, disabled: boolean?, } |
Returns
| Button |