A builder that creates API-compatible JSON data for modals.
Creates a new modal from API data.
Name | Type | Optional | Description |
---|---|---|---|
data | Partial<APIModalInteractionResponseCallbackData> | Yes | The API data to create this modal with |
Use addLabelComponents instead
Deprecated
Name | Type | Optional | Description |
---|---|---|---|
...components | RestOrArray<ActionRowBuilder<ModalActionRowComponentBuilder> | APIActionRowComponent<APIComponentInModalActionRow> | ((builder: ActionRowBuilder<ModalActionRowComponentBuilder>) => ActionRowBuilder<ModalActionRowComponentBuilder>)> | No | The components to add |
Use addLabelComponents or addTextDisplayComponents instead
Deprecated
Name | Type | Optional | Description |
---|---|---|---|
...components | RestOrArray<ActionRowBuilder<ModalActionRowComponentBuilder> | APIActionRowComponent<APIComponentInModalActionRow> | APILabelComponent | APITextDisplayComponent | APITextInputComponent | LabelBuilder | TextDisplayBuilder | TextInputBuilder> | No | The components to add |
Adds label components to this modal.
Name | Type | Optional | Description |
---|---|---|---|
...components | RestOrArray<APILabelComponent | LabelBuilder | ((builder: LabelBuilder) => LabelBuilder)> | No | The components to add |
Adds text display components to this modal.
Name | Type | Optional | Description |
---|---|---|---|
...components | RestOrArray<APITextDisplayComponent | TextDisplayBuilder | ((builder: TextDisplayBuilder) => TextDisplayBuilder)> | No | The components to add |
Use setLabelComponents instead
Deprecated
Name | Type | Optional | Description |
---|---|---|---|
...components | RestOrArray<ActionRowBuilder<ModalActionRowComponentBuilder> | LabelBuilder | TextDisplayBuilder> | No | The components to set |
Sets the custom id of this modal.
Name | Type | Optional | Description |
---|---|---|---|
customId | string | No | The custom id to use |
Sets the labels for this modal.
Name | Type | Optional | Description |
---|---|---|---|
...components | RestOrArray<APILabelComponent | LabelBuilder | ((builder: LabelBuilder) => LabelBuilder)> | No | The components to set |
Sets the title of this modal.
Name | Type | Optional | Description |
---|---|---|---|
title | string | No | The title to use |
Removes, replaces, or inserts labels for this modal.
Remarks
This method behaves similarly to Array.prototype.splice(). The maximum amount of labels that can be added is 5.It's useful for modifying and adjusting order of the already-existing labels of a modal.Example
Remove the first label:Example
Remove the first n labels:Example
Remove the last label:Name | Type | Optional | Description |
---|---|---|---|
index | number | No | The index to start at |
deleteCount | number | No | The number of labels to remove |
...labels | (APILabelComponent | LabelBuilder | ((builder: LabelBuilder) => LabelBuilder))[] | No | The replacing label objects |
Serializes this builder to API-compatible JSON data.