Table of Contents

Class SectionBuilder

Namespace
Discord
Assembly
Discord.Net.Core.dll
public class SectionBuilder : IMessageComponentBuilder, IStaticComponentContainer, IComponentContainer
Inheritance
SectionBuilder
Implements
Inherited Members
Extension Methods

Constructors

SectionBuilder(IMessageComponentBuilder, params IEnumerable<IMessageComponentBuilder>)

Initializes a new SectionBuilder.

public SectionBuilder(IMessageComponentBuilder accessory = null, params IEnumerable<IMessageComponentBuilder> components)

Parameters

accessory IMessageComponentBuilder
components IEnumerable<IMessageComponentBuilder>

SectionBuilder(SectionComponent)

Initializes a new SectionBuilder from existing component.

public SectionBuilder(SectionComponent section)

Parameters

section SectionComponent

Fields

MaxComponents

Gets the maximum number of components allowed in this container.

public const int MaxComponents = 3

Field Value

int

Properties

Accessory

Gets or sets the accessory component.

public IMessageComponentBuilder Accessory { get; set; }

Property Value

IMessageComponentBuilder

Remarks

Only supports ButtonBuilder and ThumbnailBuilder currently.

Components

Gets the components in the container.

public List<IMessageComponentBuilder> Components { get; set; }

Property Value

List<IMessageComponentBuilder>

Remarks

Only TextDisplayBuilder is supported.

Id

Gets or sets the id for the component. An autoincremented id will be assigned if not set.

public int? Id { get; set; }

Property Value

int?

Type

Gets the type of the component.

public ComponentType Type { get; }

Property Value

ComponentType

Methods

AddComponent(IMessageComponentBuilder)

Adds a component to the container.

public SectionBuilder AddComponent(IMessageComponentBuilder component)

Parameters

component IMessageComponentBuilder

Returns

SectionBuilder

The current container.

Remarks

Only TextDisplayBuilder is supported.

AddComponents(params IMessageComponentBuilder[])

Adds components to the container.

public SectionBuilder AddComponents(params IMessageComponentBuilder[] components)

Parameters

components IMessageComponentBuilder[]

Returns

SectionBuilder

The current container.

Remarks

Only TextDisplayBuilder is supported.

Build()

Runs validation checks and builds the component.

public SectionComponent Build()

Returns

SectionComponent

WithAccessory(IMessageComponentBuilder)

Sets the accessory component.

public SectionBuilder WithAccessory(IMessageComponentBuilder accessory)

Parameters

accessory IMessageComponentBuilder

Returns

SectionBuilder

WithComponents(IEnumerable<IMessageComponentBuilder>)

Sets the components in the container.

public SectionBuilder WithComponents(IEnumerable<IMessageComponentBuilder> components)

Parameters

components IEnumerable<IMessageComponentBuilder>

Returns

SectionBuilder

The current container.

Remarks

Only TextDisplayBuilder is supported.