Skip to main content

Class SelectMenuBuilder

Represents a class used to build Discord.SelectMenuComponent's.

Assembly: Discord.Net.Core.dll​
View Source​
Declaration
public class SelectMenuBuilder

Properties​

CustomId​

Gets or sets the custom id of the current select menu.

View Source​
Declaration
public string CustomId { get; set; }

Placeholder​

Gets or sets the placeholder text of the current select menu.

View Source​
Declaration
public string Placeholder { get; set; }

MinValues​

Gets or sets the minimum values of the current select menu.

View Source​
Declaration
public int MinValues { get; set; }

MaxValues​

Gets or sets the maximum values of the current select menu.

View Source​
Declaration
public int MaxValues { get; set; }

Options​

Gets or sets a collection of Discord.SelectMenuOptionBuilder for this current select menu.

View Source​
Declaration
public List<SelectMenuOptionBuilder> Options { get; set; }

IsDisabled​

Gets or sets whether the current menu is disabled.

View Source​
Declaration
public bool IsDisabled { get; set; }

Fields​

MaxPlaceholderLength​

The max length of a Discord.SelectMenuComponent.Placeholder.

View Source​
Declaration
public const int MaxPlaceholderLength = 100

MaxValuesCount​

The maximum number of values for the Discord.SelectMenuComponent.MinValues and Discord.SelectMenuComponent.MaxValues properties.

View Source​
Declaration
public const int MaxValuesCount = 25

MaxOptionCount​

The maximum number of options a Discord.SelectMenuComponent can have.

View Source​
Declaration
public const int MaxOptionCount = 25

Methods​

WithCustomId(String)​

Sets the field CustomId.

View Source​
Declaration
public SelectMenuBuilder WithCustomId(string customId)
Returns​

Discord.SelectMenuBuilder: The current builder.

Parameters​
TypeNameDescription
System.StringcustomIdThe value to set the field CustomId to.

WithPlaceholder(String)​

Sets the field placeholder.

View Source​
Declaration
public SelectMenuBuilder WithPlaceholder(string placeholder)
Returns​

Discord.SelectMenuBuilder: The current builder.

Parameters​
TypeNameDescription
System.StringplaceholderThe value to set the field placeholder to.

WithMinValues(Int32)​

Sets the field minValues.

View Source​
Declaration
public SelectMenuBuilder WithMinValues(int minValues)
Returns​

Discord.SelectMenuBuilder: The current builder.

Parameters​
TypeNameDescription
System.Int32minValuesThe value to set the field minValues to.

WithMaxValues(Int32)​

Sets the field maxValues.

View Source​
Declaration
public SelectMenuBuilder WithMaxValues(int maxValues)
Returns​

Discord.SelectMenuBuilder: The current builder.

Parameters​
TypeNameDescription
System.Int32maxValuesThe value to set the field maxValues to.

WithOptions(List<SelectMenuOptionBuilder>)​

Sets the field options.

View Source​
Declaration
public SelectMenuBuilder WithOptions(List<SelectMenuOptionBuilder> options)
Returns​

Discord.SelectMenuBuilder: The current builder.

Parameters​
TypeNameDescription
System.Collections.Generic.List<Discord.SelectMenuOptionBuilder>optionsThe value to set the field options to.

AddOption(SelectMenuOptionBuilder)​

Add one option to menu options.

View Source​
Declaration
public SelectMenuBuilder AddOption(SelectMenuOptionBuilder option)
Returns​

Discord.SelectMenuBuilder: The current builder.

Parameters​
TypeNameDescription
Discord.SelectMenuOptionBuilderoptionThe option builder class containing the option properties.

AddOption(String, String, String, IEmote, Nullable<Boolean>)​

Add one option to menu options.

View Source​
Declaration
public SelectMenuBuilder AddOption(string label, string value, string description = null, IEmote emote = null, bool? isDefault = null)
Returns​

Discord.SelectMenuBuilder: The current builder.

Parameters​
TypeNameDescription
System.StringlabelThe label for this option.
System.StringvalueThe value of this option.
System.StringdescriptionThe description of this option.
Discord.IEmoteemoteThe emote of this option.
System.Nullable<System.Boolean>isDefaultRender this option as selected by default or not.

WithDisabled(Boolean)​

Sets whether the current menu is disabled.

View Source​
Declaration
public SelectMenuBuilder WithDisabled(bool isDisabled)
Returns​

Discord.SelectMenuBuilder: The current builder.

Parameters​
TypeNameDescription
System.BooleanisDisabledWhether the current menu is disabled or not.

Build()​

Builds a Discord.SelectMenuComponent

View Source​
Declaration
public SelectMenuComponent Build()
Returns​

Discord.SelectMenuComponent: The newly built Discord.SelectMenuComponent