Preview environment

class SectionBuilder

declare class SectionBuilder extends ComponentBuilder<APISectionComponent>

A builder that creates API-compatible JSON data for a section.

Constructors

constructor()

Creates a new section from API data.

readonlyoptional
accessory? : ButtonBuilder | ThumbnailBuilder

The accessory of this section.

readonly
components : ComponentBuilder[]

The components within this section.

readonly
data : Partial<APISectionComponent>

The API data associated with this component.

Inherited from: ComponentBuilder

addTextDisplayComponents() : this

Adds text display components to this section.

clearId() : this

Clears the id of this component, defaulting to a default incremented id.

Inherited from: ComponentBuilder

setButtonAccessory() : this

Sets the accessory of this section to a button.

setId(
id: number
) : this

Sets the id (not the custom id) for this component.

Inherited from: ComponentBuilder

setThumbnailAccessory() : this

Sets the accessory of this section to a thumbnail.

spliceTextDisplayComponents() : this

Removes, replaces, or inserts text display components for this section.

Serializes this builder to API-compatible JSON data.