Class SelectMenuOptionBuilder
- Namespace
- Discord
- Assembly
- Discord.Net.Core.dll
Represents a class used to build SelectMenuOption's.
public class SelectMenuOptionBuilder
- Inheritance
-
SelectMenuOptionBuilder
- Inherited Members
Constructors
SelectMenuOptionBuilder()
Creates a new instance of a SelectMenuOptionBuilder.
public SelectMenuOptionBuilder()
SelectMenuOptionBuilder(SelectMenuOption)
Creates a new instance of a SelectMenuOptionBuilder from instance of a SelectMenuOption.
public SelectMenuOptionBuilder(SelectMenuOption option)
Parameters
optionSelectMenuOption
SelectMenuOptionBuilder(string, string, string, IEmote, bool?)
Creates a new instance of a SelectMenuOptionBuilder.
public SelectMenuOptionBuilder(string label, string value, string description = null, IEmote emote = null, bool? isDefault = null)
Parameters
labelstringThe label for this option.
valuestringThe value of this option.
descriptionstringThe description of this option.
emoteIEmoteThe emote of this option.
isDefaultbool?Render this option as selected by default or not.
Fields
MaxDescriptionLength
The maximum length of a Description.
public const int MaxDescriptionLength = 100
Field Value
MaxSelectLabelLength
The maximum length of a Label.
public const int MaxSelectLabelLength = 100
Field Value
MaxSelectValueLength
The maximum length of a Value.
public const int MaxSelectValueLength = 100
Field Value
Properties
Description
Gets or sets this menu options description.
public string Description { get; set; }
Property Value
Exceptions
- ArgumentException
Description length exceeds MaxDescriptionLength.
- ArgumentException
Description length subceeds 1.
Emote
Gets or sets the emote of this option.
public IEmote Emote { get; set; }
Property Value
IsDefault
Gets or sets the whether or not this option will render selected by default.
public bool? IsDefault { get; set; }
Property Value
- bool?
Label
Gets or sets the label of the current select menu.
public string Label { get; set; }
Property Value
Exceptions
- ArgumentException
Label length exceeds MaxSelectLabelLength
- ArgumentException
Label length subceeds 1.
Value
Gets or sets the value of the current select menu.
public string Value { get; set; }
Property Value
Exceptions
- ArgumentException
Value length exceeds MaxSelectValueLength.
- ArgumentException
Value length subceeds 1.
Methods
Build()
Builds a SelectMenuOption.
public SelectMenuOption Build()
Returns
- SelectMenuOption
The newly built SelectMenuOption.
WithDefault(bool)
Sets the field default.
public SelectMenuOptionBuilder WithDefault(bool isDefault)
Parameters
isDefaultboolThe value to set the field default to.
Returns
- SelectMenuOptionBuilder
The current builder.
WithDescription(string)
Sets the field description.
public SelectMenuOptionBuilder WithDescription(string description)
Parameters
descriptionstringThe value to set the field description to.
Returns
- SelectMenuOptionBuilder
The current builder.
Exceptions
- ArgumentException
Description length exceeds MaxDescriptionLength.
- ArgumentException
Description length subceeds 1.
WithEmote(IEmote)
Sets the field emote.
public SelectMenuOptionBuilder WithEmote(IEmote emote)
Parameters
emoteIEmoteThe value to set the field emote to.
Returns
- SelectMenuOptionBuilder
The current builder.
WithLabel(string)
Sets the field label.
public SelectMenuOptionBuilder WithLabel(string label)
Parameters
labelstringThe value to set the field label to.
Returns
- SelectMenuOptionBuilder
The current builder.
Exceptions
- ArgumentException
Label length exceeds MaxSelectLabelLength
- ArgumentException
Label length subceeds 1.
WithValue(string)
Sets the field value.
public SelectMenuOptionBuilder WithValue(string value)
Parameters
valuestringThe value to set the field value to.
Returns
- SelectMenuOptionBuilder
The current builder.
Exceptions
- ArgumentException
Value length exceeds MaxSelectValueLength.
- ArgumentException
Value length subceeds 1.