Table of Contents

Class ActionRowBuilder

Namespace
Discord
Assembly
Discord.Net.Core.dll

Represents a class used to build Action rows.

public class ActionRowBuilder
Inheritance
ActionRowBuilder
Inherited Members

Fields

MaxChildCount

The max amount of child components this row can hold.

public const int MaxChildCount = 5

Field Value

int

Properties

Components

Gets or sets the components inside this row.

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

Property Value

List<IMessageComponent>

Exceptions

ArgumentNullException

Components cannot be null.

ArgumentException

Components count exceeds MaxChildCount.

Methods

AddComponent(IMessageComponent)

Adds a component at the end of the current row.

public ActionRowBuilder AddComponent(IMessageComponent component)

Parameters

component IMessageComponent

The component to add.

Returns

ActionRowBuilder

The current builder.

Exceptions

InvalidOperationException

Components count reached MaxChildCount

Build()

Builds the current builder to a ActionRowComponent that can be used within a ComponentBuilder

public ActionRowComponent Build()

Returns

ActionRowComponent

A ActionRowComponent that can be used within a ComponentBuilder

WithButton(ButtonBuilder)

public ActionRowBuilder WithButton(ButtonBuilder button)

Parameters

button ButtonBuilder

The button to add.

Returns

ActionRowBuilder

The current builder.

Exceptions

InvalidOperationException

Components count reached MaxChildCount.

InvalidOperationException

A button cannot be added to a row with a SelectMenu.

WithButton(string, string, ButtonStyle, IEmote, string, bool)

Adds a ButtonBuilder with specified parameters to the ActionRowBuilder.

public ActionRowBuilder WithButton(string label = null, string customId = null, ButtonStyle style = ButtonStyle.Primary, IEmote emote = null, string url = null, bool disabled = false)

Parameters

label string

The label text for the newly added button.

customId string

The custom id of the newly added button.

style ButtonStyle

The style of this newly added button.

emote IEmote

A IEmote to be used with this button.

url string

A URL to be used only if the ButtonStyle is a Link.

disabled bool

Whether or not the newly created button is disabled.

Returns

ActionRowBuilder

The current builder.

WithComponents(List<IMessageComponent>)

Adds a list of components to the current row.

public ActionRowBuilder WithComponents(List<IMessageComponent> components)

Parameters

components List<IMessageComponent>

The list of components to add.

Returns

ActionRowBuilder

The current builder.

Exceptions

ArgumentNullException

Components cannot be null.

ArgumentException

Components count exceeds MaxChildCount.

WithSelectMenu(SelectMenuBuilder)

public ActionRowBuilder WithSelectMenu(SelectMenuBuilder menu)

Parameters

menu SelectMenuBuilder

The menu to add.

Returns

ActionRowBuilder

The current builder.

Exceptions

InvalidOperationException

A Select Menu cannot exist in a pre-occupied ActionRow.

WithSelectMenu(string, List<SelectMenuOptionBuilder>, string, int, int, bool, ComponentType, ChannelType[])

public ActionRowBuilder WithSelectMenu(string customId, List<SelectMenuOptionBuilder> options = null, string placeholder = null, int minValues = 1, int maxValues = 1, bool disabled = false, ComponentType type = ComponentType.SelectMenu, ChannelType[] channelTypes = null)

Parameters

customId string

The custom id of the menu.

options List<SelectMenuOptionBuilder>

The options of the menu.

placeholder string

The placeholder of the menu.

minValues int

The min values of the placeholder.

maxValues int

The max values of the placeholder.

disabled bool

Whether or not the menu is disabled.

type ComponentType

The type of the select menu.

channelTypes ChannelType[]

Menus valid channel types (only for ChannelSelect)

Returns

ActionRowBuilder

The current builder.