Table of Contents

Class TextInputBuilder

Namespace
Discord
Assembly
Discord.Net.Core.dll
public class TextInputBuilder
Inheritance
TextInputBuilder
Inherited Members

Constructors

TextInputBuilder()

Creates a new instance of a TextInputBuilder.

public TextInputBuilder()

TextInputBuilder(string, string, TextInputStyle, string, int?, int?, bool?, string)

Creates a new instance of a TextInputBuilder.

public TextInputBuilder(string label, string customId, TextInputStyle style = TextInputStyle.Short, string placeholder = null, int? minLength = null, int? maxLength = null, bool? required = null, string value = null)

Parameters

label string

The text input's label.

customId string

The text input's custom id.

style TextInputStyle

The text input's style.

placeholder string

The text input's placeholder.

minLength int?

The text input's minimum length.

maxLength int?

The text input's maximum length.

required bool?

The text input's required value.

value string

Fields

LargestMaxLength

public const int LargestMaxLength = 4000

Field Value

int

MaxPlaceholderLength

The max length of a Placeholder.

public const int MaxPlaceholderLength = 100

Field Value

int

Properties

CustomId

Gets or sets the custom id of the current text input.

public string CustomId { get; set; }

Property Value

string

Exceptions

ArgumentException

CustomId length exceeds MaxCustomIdLength

ArgumentException

CustomId length subceeds 1.

Label

Gets or sets the label of the current text input.

public string Label { get; set; }

Property Value

string

MaxLength

Gets or sets the maximum length of the current text input.

public int? MaxLength { get; set; }

Property Value

int?

Exceptions

ArgumentOutOfRangeException

MaxLength is less than 0.

ArgumentOutOfRangeException

MaxLength is greater than LargestMaxLength.

ArgumentOutOfRangeException

MaxLength is less than MinLength.

MinLength

Gets or sets the minimum length of the current text input.

public int? MinLength { get; set; }

Property Value

int?

Exceptions

ArgumentOutOfRangeException

MinLength is less than 0.

ArgumentOutOfRangeException

MinLength is greater than LargestMaxLength.

ArgumentOutOfRangeException

MinLength is greater than MaxLength.

Placeholder

Gets or sets the placeholder of the current text input.

public string Placeholder { get; set; }

Property Value

string

Exceptions

ArgumentException

Placeholder is longer than MaxPlaceholderLength characters

Required

Gets or sets whether the user is required to input text.

public bool? Required { get; set; }

Property Value

bool?

Style

Gets or sets the style of the current text input.

public TextInputStyle Style { get; set; }

Property Value

TextInputStyle

Value

Gets or sets the default value of the text input.

public string Value { get; set; }

Property Value

string

Exceptions

ArgumentOutOfRangeException

Value.Length is less than 0.

ArgumentOutOfRangeException

Value.Length is greater than LargestMaxLength or MaxLength.

ArgumentException

Style is Short and Value contains a new line character.

Methods

Build()

public TextInputComponent Build()

Returns

TextInputComponent

WithCustomId(string)

Sets the custom id of the current builder.

public TextInputBuilder WithCustomId(string customId)

Parameters

customId string

The value to set.

Returns

TextInputBuilder

The current builder.

WithLabel(string)

Sets the label of the current builder.

public TextInputBuilder WithLabel(string label)

Parameters

label string

The value to set.

Returns

TextInputBuilder

The current builder.

WithMaxLength(int)

Sets the maximum length of the current builder.

public TextInputBuilder WithMaxLength(int maxLength)

Parameters

maxLength int

The value to set.

Returns

TextInputBuilder

The current builder.

WithMinLength(int)

Sets the minimum length of the current builder.

public TextInputBuilder WithMinLength(int minLength)

Parameters

minLength int

The value to set.

Returns

TextInputBuilder

The current builder.

WithPlaceholder(string)

Sets the placeholder of the current builder.

public TextInputBuilder WithPlaceholder(string placeholder)

Parameters

placeholder string

The value to set.

Returns

TextInputBuilder

The current builder.

WithRequired(bool)

Sets the required value of the current builder.

public TextInputBuilder WithRequired(bool required)

Parameters

required bool

The value to set.

Returns

TextInputBuilder

The current builder.

WithStyle(TextInputStyle)

Sets the style of the current builder.

public TextInputBuilder WithStyle(TextInputStyle style)

Parameters

style TextInputStyle

The value to set.

Returns

TextInputBuilder

The current builder.

WithValue(string)

Sets the value of the current builder.

public TextInputBuilder WithValue(string value)

Parameters

value string

The value to set

Returns

TextInputBuilder

The current builder.