class SectionBuilder
extends
ComponentBuilder<APISectionComponent>export declare class SectionBuilder extends ComponentBuilder<APISectionComponent>A builder that creates API-compatible JSON data for sections.
Constructors
constructor(data?: Partial<APISectionComponent>)
Creates a new section.
const section = new SectionBuilder({
components: [
{
content: "Some text here",
type: ComponentType.TextDisplay,
},
],
accessory: {
media: {
url: 'https://cdn.discordapp.com/embed/avatars/3.png',
},
}
});const section = new SectionBuilder({
components: [
{
content: "# Heading",
type: ComponentType.TextDisplay,
},
],
})
.setPrimaryButtonAccessory(button);readonlycomponents : readonly TextDisplayBuilder[]
The components within this section.
addTextDisplayComponents(...input: RestOrArray<APITextDisplayComponent | TextDisplayBuilder | ((builder: TextDisplayBuilder) => TextDisplayBuilder)>) : this
Adds text display components to this section.
Clears the id of this component, defaulting to a default incremented id.
Inherited from: ComponentBuilder
setDangerButtonAccessory(input: DangerButtonBuilder | ((builder: DangerButtonBuilder) => DangerButtonBuilder) | (APIButtonComponentWithCustomId & { style: ButtonStyle.Danger; })) : this
Sets a danger button component to be the accessory of this section.
setLinkButtonAccessory(input: APIButtonComponentWithURL | LinkButtonBuilder | ((builder: LinkButtonBuilder) => LinkButtonBuilder)) : this
Sets a URL button component to be the accessory of this section.
setPremiumButtonAccessory(input: APIButtonComponentWithSKUId | PremiumButtonBuilder | ((builder: PremiumButtonBuilder) => PremiumButtonBuilder)) : this
Sets a SKU id button component to be the accessory of this section.
setPrimaryButtonAccessory(input: PrimaryButtonBuilder | ((builder: PrimaryButtonBuilder) => PrimaryButtonBuilder) | (APIButtonComponentWithCustomId & { style: ButtonStyle.Primary; })) : this
Sets a primary button component to be the accessory of this section.
setSecondaryButtonAccessory(input: SecondaryButtonBuilder | ((builder: SecondaryButtonBuilder) => SecondaryButtonBuilder) | (APIButtonComponentWithCustomId & { style: ButtonStyle.Secondary; })) : this
Sets a secondary button component to be the accessory of this section.
setSuccessButtonAccessory(input: SuccessButtonBuilder | ((builder: SuccessButtonBuilder) => SuccessButtonBuilder) | (APIButtonComponentWithCustomId & { style: ButtonStyle.Success; })) : this
Sets a success button component to be the accessory of this section.
setThumbnailAccessory(input: APIThumbnailComponent | ThumbnailBuilder | ((builder: ThumbnailBuilder) => ThumbnailBuilder)) : this
Sets a thumbnail component to be the accessory of this section.
spliceTextDisplayComponents(index: numberdeleteCount: number...components: RestOrArray<APITextDisplayComponent | TextDisplayBuilder | ((builder: TextDisplayBuilder) => TextDisplayBuilder)>) : this
Removes, replaces, or inserts text display components for this section.
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.