Class LabelBuilder
- Namespace
- Discord
- Assembly
- Discord.Net.Core.dll
Represents a class used to build LabelComponent's.
public class LabelBuilder : IMessageComponentBuilder
- Inheritance
-
LabelBuilder
- Implements
- Inherited Members
- Extension Methods
Constructors
LabelBuilder()
Initializes a new LabelBuilder.
public LabelBuilder()
LabelBuilder(LabelComponent)
Initializes a new LabelBuilder from existing component.
public LabelBuilder(LabelComponent label)
Parameters
labelLabelComponent
LabelBuilder(string, IMessageComponentBuilder, string, int?)
Initializes a new LabelBuilder with the specified content.
public LabelBuilder(string label, IMessageComponentBuilder component, string description = null, int? id = null)
Parameters
labelstringThe label text.
componentIMessageComponentBuilderThe component within the label.
descriptionstringThe description text for the label.
idint?The id for the component.
Fields
MaxDescriptionLength
The maximum length of the description.
public const int MaxDescriptionLength = 100
Field Value
MaxLabelLength
The maximum length of the label.
public const int MaxLabelLength = 45
Field Value
Properties
Component
Gets or sets the component within the label.
public IMessageComponentBuilder Component { get; set; }
Property Value
Description
Gets or sets the description text for the label.
public string Description { get; set; }
Property Value
Id
Gets or sets the id for the component. An autoincremented id will be assigned if not set.
public int? Id { get; set; }
Property Value
- int?
Label
Gets or sets the label text.
public string Label { get; set; }
Property Value
SupportedComponentTypes
Gets the types of child components supported by this container.
public ImmutableArray<ComponentType> SupportedComponentTypes { get; }
Property Value
Type
Gets the type of the component.
public ComponentType Type { get; }
Property Value
Methods
Build()
Runs validation checks and builds the component.
public LabelComponent Build()
Returns
WithComponent(IMessageComponentBuilder)
Sets the component within the label.
public LabelBuilder WithComponent(IMessageComponentBuilder component)
Parameters
componentIMessageComponentBuilderThe component within the label.
Returns
- LabelBuilder
The current builder.
WithDescription(string)
Sets the description text for the label.
public LabelBuilder WithDescription(string description)
Parameters
descriptionstringThe description text for the label.
Returns
- LabelBuilder
The current builder.
WithLabel(string)
Sets the label text.
public LabelBuilder WithLabel(string label)
Parameters
labelstringThe label text.
Returns
- LabelBuilder
The current builder.