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
option
SelectMenuOption
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
label
stringThe label for this option.
value
stringThe value of this option.
description
stringThe description of this option.
emote
IEmoteThe emote of this option.
isDefault
bool?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
isDefault
boolThe value to set the field default to.
Returns
- SelectMenuOptionBuilder
The current builder.
WithDescription(string)
Sets the field description.
public SelectMenuOptionBuilder WithDescription(string description)
Parameters
description
stringThe 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
emote
IEmoteThe value to set the field emote to.
Returns
- SelectMenuOptionBuilder
The current builder.
WithLabel(string)
Sets the field label.
public SelectMenuOptionBuilder WithLabel(string label)
Parameters
label
stringThe 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
value
stringThe value to set the field value to.
Returns
- SelectMenuOptionBuilder
The current builder.
Exceptions
- ArgumentException
Value length exceeds MaxSelectValueLength.
- ArgumentException
Value length subceeds 1.