A builder that creates API-compatible JSON data for a section.
Extends
ComponentBuilder<APISectionComponent>Creates a new section from API data.
Example
Creating a section from an API data object:Example
Creating a section using setters and API data:Name | Type | Optional | Description |
---|---|---|---|
data | Partial<APISectionComponent> | Yes | The API data to create this section with |
The API data associated with this component.
Inherited from ComponentBuilderAdds text display components to this section.
Name | Type | Optional | Description |
---|---|---|---|
...components | RestOrArray<TextDisplayBuilder | ((builder: TextDisplayBuilder) => TextDisplayBuilder)> | No | The text display components to add |
Clears the id of this component, defaulting to a default incremented id.
Inherited from ComponentBuilderSets the accessory of this section to a button.
Name | Type | Optional | Description |
---|---|---|---|
accessory | APIButtonComponent | ButtonBuilder | ((builder: ButtonBuilder) => ButtonBuilder) | No | The accessory to use |
Sets the id (not the custom id) for this component.
Name | Type | Optional | Description |
---|---|---|---|
id | number | No | The id for this component |
Sets the accessory of this section to a thumbnail.
Name | Type | Optional | Description |
---|---|---|---|
accessory | APIThumbnailComponent | ThumbnailBuilder | ((builder: ThumbnailBuilder) => ThumbnailBuilder) | No | The accessory to use |
Removes, replaces, or inserts text display components for this section.
Name | Type | Optional | Description |
---|---|---|---|
index | number | No | The index to start removing, replacing or inserting text display components |
deleteCount | number | No | The amount of text display components to remove |
...components | RestOrArray<APITextDisplayComponent | TextDisplayBuilder | ((builder: TextDisplayBuilder) => TextDisplayBuilder)> | No | The text display components to insert |
Serializes this builder to API-compatible JSON data.