Class TextInputBuilder
- Namespace
- Discord
- Assembly
- Discord.Net.Core.dll
Represents a builder for creating a TextInputComponent.
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
stringThe text input's label.
customId
stringThe text input's custom id.
style
TextInputStyleThe text input's style.
placeholder
stringThe 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
MaxPlaceholderLength
The max length of a Placeholder.
public const int MaxPlaceholderLength = 100
Field Value
Properties
CustomId
Gets or sets the custom id of the current text input.
public string CustomId { get; set; }
Property Value
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
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
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
Placeholder
Gets or sets the placeholder of the current text input.
public string Placeholder { get; set; }
Property Value
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
Value
Gets or sets the default value of the text input.
public string Value { get; set; }
Property Value
Exceptions
- ArgumentOutOfRangeException
Value.Length is less than 0.
- ArgumentOutOfRangeException
Value.Length is greater than LargestMaxLength or MaxLength.
- ArgumentException
Methods
Build()
public TextInputComponent Build()
Returns
WithCustomId(string)
Sets the custom id of the current builder.
public TextInputBuilder WithCustomId(string customId)
Parameters
customId
stringThe value to set.
Returns
- TextInputBuilder
The current builder.
WithLabel(string)
Sets the label of the current builder.
public TextInputBuilder WithLabel(string label)
Parameters
label
stringThe 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
intThe 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
intThe value to set.
Returns
- TextInputBuilder
The current builder.
WithPlaceholder(string)
Sets the placeholder of the current builder.
public TextInputBuilder WithPlaceholder(string placeholder)
Parameters
placeholder
stringThe 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
boolThe value to set.
Returns
- TextInputBuilder
The current builder.
WithStyle(TextInputStyle)
Sets the style of the current builder.
public TextInputBuilder WithStyle(TextInputStyle style)
Parameters
style
TextInputStyleThe value to set.
Returns
- TextInputBuilder
The current builder.
WithValue(string)
Sets the value of the current builder.
public TextInputBuilder WithValue(string value)
Parameters
value
stringThe value to set
Returns
- TextInputBuilder
The current builder.