class SectionBuilder

external
declare class SectionBuilder extends ComponentBuilder<APISectionComponent>

Constructors

external
constructor()

Creates a new section from API data.

Examples:Creating a section from an API data object:
const section = new SectionBuilder({
	components: [
		{
			content: "Some text here",
			type: ComponentType.TextDisplay,
		},
	],
 accessory: {
     media: {
         url: 'https://cdn.discordapp.com/embed/avatars/3.png',
     },
 }
});
Creating a section using setters and API data:
const section = new SectionBuilder({
	components: [
		{
			content: "# Heading",
			type: ComponentType.TextDisplay,
		},
	],
})
	.setPrimaryButtonAccessory(button);

readonlyexternal
components : readonly TextDisplayBuilder[]

protectedreadonlyexternal
data : SectionBuilderData

external
addTextDisplayComponents() : this

Adds text display components to this section.

external
clearId() : this

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

Inherited from: ComponentBuilder

external
setDangerButtonAccessory() : this

Sets a danger button component to be the accessory of this section.

external
setId(
id: number
) : this

Sets the id of this component.

Inherited from: ComponentBuilder

external
setLinkButtonAccessory() : this

Sets a URL button component to be the accessory of this section.

external
setPremiumButtonAccessory() : this

Sets a SKU id button component to be the accessory of this section.

external
setPrimaryButtonAccessory() : this

Sets a primary button component to be the accessory of this section.

external
setSecondaryButtonAccessory() : this

Sets a secondary button component to be the accessory of this section.

external
setSuccessButtonAccessory() : this

Sets a success button component to be the accessory of this section.

external
setThumbnailAccessory() : this

Sets a thumbnail component to be the accessory of this section.

external
spliceTextDisplayComponents() : this

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

external
toJSON(
validationOverride?: boolean
) : APISectionComponent

Serializes this builder to API-compatible JSON data.Note that by disabling validation, there is no guarantee that the resulting object will be valid.