Table of Contents

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

checkbox CheckboxComponent

The component.

CheckboxBuilder(string, bool?, int?)

Initializes a new instance of the CheckboxBuilder.

public CheckboxBuilder(string customId, bool? defaultState = null, int? id = null)

Parameters

customId string

The custom id of the current checkbox.

defaultState bool?

The default state of the checkbox.

id int?

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

string

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

ComponentType

Methods

Build()

Runs validation checks and builds the component.

public CheckboxComponent Build()

Returns

CheckboxComponent

WithCustomId(string)

Sets the custom id of the current checkbox.

public CheckboxBuilder WithCustomId(string customId)

Parameters

customId string

The 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

defaultState bool?

true> to set the checkbox as checked by default; otherwise, false.

Returns

CheckboxBuilder

The current instance of the CheckboxBuilder, enabling method chaining.