Section
Implementation of Discord’s Section component as a Luau builder. Sections lay out 1-3 text/button components with an optional right-side accessory.
https://discord.com/developers/docs/components/reference#section
Summary
Properties
Section.components :: { TextDisplay.JSON | Button.JSON }Section.accessory :: ComponentThumbnail.JSON | Button.JSON | nilMethods
Section:addComponent(component: apiTypes.TextDisplayComponentObject | apiTypes.ButtonComponentObject) → SectionSection:setAccessory(accessory: apiTypes.ThumbnailComponentObject | apiTypes.ButtonComponentObject) → SectionSection:build() → JSONFunctions
Section.new() → SectionProperties
Section titled “Properties”components
Section titled “components” Section.components :: JSON }
The child components. Maximum 3.
accessory
Section titled “accessory” Section.accessory :: JSON | nil
The right-side accessory component.
Methods
Section titled “Methods”addComponent
Section titled “addComponent”Section : addComponent ( component ) -> Section
Adds a text display or button component. Maximum 3 components.
Parameters
| component: ButtonComponentObject |
Returns
| Section |
setAccessory
Section titled “setAccessory”Section : setAccessory ( accessory ) -> Section
Sets the right-side accessory. Can be a thumbnail or button.
Parameters
| accessory: ButtonComponentObject |
Returns
| Section |
Section : build ( ) -> JSON
Responsible for building the Section JSON that can be parsed by the Discord API.
Returns
| JSON |
Functions
Section titled “Functions”Section . new ( ) -> Section
Responsible for creating a new Section.
Returns
| Section |