Class ActionRowComponentBuilder
A builder class used to build action row components.
Inheritance
Inherited Members
Namespace: Color_Chan.Discord.Commands.MessageBuilders
Assembly: Color-Chan.Discord.Commands.dll
Syntax
public class ActionRowComponentBuilder
Methods
| Improve this Doc View SourceBuild()
Builds the action row IDiscordComponent.
Declaration
public IDiscordComponent Build()
Returns
Type | Description |
---|---|
IDiscordComponent | The build action row IDiscordComponent. |
WithButton(IDiscordEmoji, DiscordButtonStyle, String, String, Boolean)
Adds a button to the action row.
Declaration
public ActionRowComponentBuilder WithButton(IDiscordEmoji emoji, DiscordButtonStyle style, string customId = null, string url = null, bool disabled = false)
Parameters
Type | Name | Description |
---|---|---|
IDiscordEmoji | emoji | The emoji the button will use. |
DiscordButtonStyle | style | The style the button will use. |
System.String | customId | The custom id. Required if |
System.String | url | The URL the button will open. Required if |
System.Boolean | disabled | Whether or not the button is disabled. |
Returns
Type | Description |
---|---|
ActionRowComponentBuilder | The ActionRowComponentBuilder with the added button. |
Remarks
Only one of url
or customId
can be set!
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | When the ActionRow already has 5 buttons. |
MissingButtonPropertiesException | When |
System.ArgumentException | When |
InvalidActionRowException | When the Color_Chan.Discord.Commands.MessageBuilders.ActionRowComponentBuilder._childComponents contains a select menu component. |
WithButton(String, DiscordButtonStyle, String, String, IDiscordEmoji, Boolean)
Adds a button to the action row.
Declaration
public ActionRowComponentBuilder WithButton(string label, DiscordButtonStyle style, string customId = null, string url = null, IDiscordEmoji emoji = null, bool disabled = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | label | The label of the button. |
DiscordButtonStyle | style | The style the button will use. |
System.String | customId | The custom id. Required if |
System.String | url | The URL the button will open. Required if |
IDiscordEmoji | emoji | The emoji the button will use. |
System.Boolean | disabled | Whether or not the button is disabled. |
Returns
Type | Description |
---|---|
ActionRowComponentBuilder | The ActionRowComponentBuilder with the added button. |
Remarks
Only one of url
or customId
can be set!
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | When the ActionRow already has 5 buttons. |
System.ArgumentOutOfRangeException | When |
MissingButtonPropertiesException | When |
System.ArgumentException | When |
System.ArgumentNullException | When |
InvalidActionRowException | When the Color_Chan.Discord.Commands.MessageBuilders.ActionRowComponentBuilder._childComponents contains a select menu component. |
WithSelectMenu(String, String, Nullable<Int32>, Nullable<Int32>, Nullable<Boolean>)
Adds a select menu to the action row.
Declaration
public ActionRowComponentBuilder WithSelectMenu(string customId, string placeholder = null, int? minValues = null, int? maxValues = null, bool? disabled = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | customId | The custom id of the select menu. |
System.String | placeholder | Custom placeholder text if nothing is selected, max 100 characters. |
System.Nullable<System.Int32> | minValues | The minimum number of items that must be chosen; default 1, min 0, max 25. |
System.Nullable<System.Int32> | maxValues | The maximum number of items that can be chosen; default 1, max 25. |
System.Nullable<System.Boolean> | disabled | Disable the select, default false. |
Returns
Type | Description |
---|---|
ActionRowComponentBuilder | The ActionRowComponentBuilder with the added select menu. |
Exceptions
Type | Condition |
---|---|
InvalidActionRowException | Thrown when the action row has button assigned to it. |
InvalidActionRowException | Thrown when the action row already has a select menu. |
WithSelectMenuOption(String, String, String, IDiscordEmoji, Nullable<Boolean>)
Adds a select menu option to the select menu.
Declaration
public ActionRowComponentBuilder WithSelectMenuOption(string label, string value, string description = null, IDiscordEmoji emoji = null, bool? disabled = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | label | The user-facing name of the option, max 100 characters. |
System.String | value | The dev-define value of the option, max 100 characters. |
System.String | description | An additional description of the option, max 100 characters. |
IDiscordEmoji | emoji | The emoji containing the id, name, and animated. |
System.Nullable<System.Boolean> | disabled | Will render this option as selected by default. |
Returns
Type | Description |
---|---|
ActionRowComponentBuilder | The ActionRowComponentBuilder with the added select menu option. |
Exceptions
Type | Condition |
---|---|
InvalidActionRowException | Thrown when the action row has button assigned to it. |
InvalidActionRowException | Thrown when the action row does not contain a select menu. |
System.NullReferenceException | Thrown when the SelectOptions is null. |
System.ArgumentOutOfRangeException | Thrown when the select menu already contains 25 option. |