Table of Contents

Class ModalComponentBuilder

Namespace
Discord
Assembly
Discord.Net.Core.dll

Represents a builder for creating a ModalComponent.

public class ModalComponentBuilder
Inheritance
ModalComponentBuilder
Inherited Members

Fields

MaxActionRowCount

The max amount of rows a ModalComponent can have.

public const int MaxActionRowCount = 5

Field Value

int

MaxCustomIdLength

The max length of a CustomId.

public const int MaxCustomIdLength = 100

Field Value

int

Properties

ActionRows

Gets or sets the Action Rows for this Component Builder.

public List<ActionRowBuilder> ActionRows { get; set; }

Property Value

List<ActionRowBuilder>

Exceptions

ArgumentNullException

ActionRows cannot be null.

ArgumentException

ActionRows count exceeds MaxActionRowCount.

Methods

Build()

Get a ModalComponent representing the builder.

public ModalComponent Build()

Returns

ModalComponent

A ModalComponent representing the builder.

FromComponents(IReadOnlyCollection<IMessageComponent>)

Creates a new builder from the provided list of components.

public static ComponentBuilder FromComponents(IReadOnlyCollection<IMessageComponent> components)

Parameters

components IReadOnlyCollection<IMessageComponent>

The components to create the builder from.

Returns

ComponentBuilder

The newly created builder.

WithTextInput(TextInputBuilder, int)

Adds a TextInputBuilder to the ModalComponentBuilder at the specific row. If the row cannot accept the component then it will add it to a row that can.

public ModalComponentBuilder WithTextInput(TextInputBuilder text, int row = 0)

Parameters

text TextInputBuilder

The TextInputBuilder to add.

row int

The row to add the text input.

Returns

ModalComponentBuilder

The current builder.

Exceptions

InvalidOperationException

There are no more rows to add a text input to.

ArgumentException

row must be less than MaxActionRowCount.

WithTextInput(string, string, TextInputStyle, string, int?, int?, int, bool?, string)

Adds a TextInputBuilder to the ComponentBuilder at the specific row. If the row cannot accept the component then it will add it to a row that can.

public ModalComponentBuilder WithTextInput(string label, string customId, TextInputStyle style = TextInputStyle.Short, string placeholder = null, int? minLength = null, int? maxLength = null, int row = 0, bool? required = null, string value = null)

Parameters

label string

The input's label.

customId string

The input's custom id.

style TextInputStyle

The input's style.

placeholder string

The input's placeholder text.

minLength int?

The input's minimum length.

maxLength int?

The input's maximum length.

row int
required bool?
value string

Returns

ModalComponentBuilder

The current builder.