Class CheckboxBuilder
- Namespace
- Discord
- Assembly
- Discord.Net.Core.dll
Represents a builder used to create a CheckboxComponent.
public class CheckboxBuilder : IInteractableComponentBuilder, IMessageComponentBuilder
- Inheritance
-
CheckboxBuilder
- Implements
- Inherited Members
- Extension Methods
Constructors
CheckboxBuilder()
Initializes a new instance of the CheckboxBuilder.
public CheckboxBuilder()
CheckboxBuilder(CheckboxComponent)
Initializes a new instance of the CheckboxBuilder class from an existing CheckboxComponent.
public CheckboxBuilder(CheckboxComponent checkbox)
Parameters
checkboxCheckboxComponentThe component.
CheckboxBuilder(string, bool?, int?)
Initializes a new instance of the CheckboxBuilder.
public CheckboxBuilder(string customId, bool? defaultState = null, int? id = null)
Parameters
customIdstringThe custom id of the current checkbox.
defaultStatebool?The default state of the checkbox.
idint?The id for the component.
Properties
CustomId
Gets or sets the custom id of the current file upload.
public string CustomId { get; set; }
Property Value
Exceptions
- ArgumentException
CustomId length exceeds MaxCustomIdLength.
- ArgumentException
CustomId length subceeds 1.
DefaultState
Gets or sets the default state of the checkbox.
public bool? DefaultState { get; set; }
Property Value
- bool?
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?
Type
Gets the type of the component.
public ComponentType Type { get; }
Property Value
Methods
Build()
Runs validation checks and builds the component.
public CheckboxComponent Build()
Returns
WithCustomId(string)
Sets the custom id of the current checkbox.
public CheckboxBuilder WithCustomId(string customId)
Parameters
customIdstringThe id to use for the current checkbox.
Returns
- CheckboxBuilder
The current builder.
Exceptions
- ArgumentException
CustomId length exceeds MaxCustomIdLength.
- ArgumentException
CustomId length subceeds 1.
WithDefaultState(bool?)
Sets the default checked state of the checkbox and returns the current builder instance.
public CheckboxBuilder WithDefaultState(bool? defaultState)
Parameters
Returns
- CheckboxBuilder
The current instance of the CheckboxBuilder, enabling method chaining.