Class ModalComponentBuilder
- Namespace
- Discord
- Assembly
- Discord.Net.Core.dll
Represents a builder for creating a ModalComponent.
public class ModalComponentBuilder
- Inheritance
-
ModalComponentBuilder
- Inherited Members
Fields
MaxActionRowCount
The max amount of rows a ModalComponent can have.
public const int MaxActionRowCount = 5
Field Value
MaxCustomIdLength
The max length of a CustomId.
public const int MaxCustomIdLength = 100
Field Value
Properties
ActionRows
Gets or sets the Action Rows for this Component Builder.
public List<ActionRowBuilder> ActionRows { get; set; }
Property Value
Exceptions
- ArgumentNullException
ActionRows cannot be null.
- ArgumentException
ActionRows count exceeds MaxActionRowCount.
Methods
Build()
Get a ModalComponent representing the builder.
public ModalComponent Build()
Returns
- ModalComponent
A ModalComponent representing the builder.
FromComponents(IReadOnlyCollection<IMessageComponent>)
Creates a new builder from the provided list of components.
public static ComponentBuilder FromComponents(IReadOnlyCollection<IMessageComponent> components)
Parameters
componentsIReadOnlyCollection<IMessageComponent>The components to create the builder from.
Returns
- ComponentBuilder
The newly created builder.
WithTextInput(TextInputBuilder, int)
Adds a TextInputBuilder to the ModalComponentBuilder at the specific row. If the row cannot accept the component then it will add it to a row that can.
public ModalComponentBuilder WithTextInput(TextInputBuilder text, int row = 0)
Parameters
textTextInputBuilderThe TextInputBuilder to add.
rowintThe row to add the text input.
Returns
- ModalComponentBuilder
The current builder.
Exceptions
- InvalidOperationException
There are no more rows to add a text input to.
- ArgumentException
rowmust be less than MaxActionRowCount.
WithTextInput(string, string, TextInputStyle, string, int?, int?, int, bool?, string)
Adds a TextInputBuilder to the ComponentBuilder at the specific row. If the row cannot accept the component then it will add it to a row that can.
public ModalComponentBuilder WithTextInput(string label, string customId, TextInputStyle style = TextInputStyle.Short, string placeholder = null, int? minLength = null, int? maxLength = null, int row = 0, bool? required = null, string value = null)
Parameters
labelstringThe input's label.
customIdstringThe input's custom id.
styleTextInputStyleThe input's style.
placeholderstringThe input's placeholder text.
minLengthint?The input's minimum length.
maxLengthint?The input's maximum length.
rowintrequiredbool?valuestring
Returns
- ModalComponentBuilder
The current builder.