ModalBuilder

export class ModalBuilder extends BuildersModal
export class ModalBuilder extends BuildersModal
Represents a modal builder.
constructor(data?)
Constructs a new instance of the ModalBuilder class
NameTypeOptionalDescription
dataPartial<ModalComponentData> | Partial<APIModalInteractionResponseCallbackData>YesNone
The components within this modal.
The API data associated with this modal.
addComponents(...components):this
Adds components to this modal.
NameTypeOptionalDescription
...componentsRestOrArray<ActionRowBuilder<ModalActionRowComponentBuilder> | APIActionRowComponent<APIModalActionRowComponent>>NoThe components to add
Static
from(other):ModalBuilder
Creates a new modal builder from JSON data
NameTypeOptionalDescription
otherJSONEncodable<APIModalComponent> | APIModalComponentNoThe other data
setComponents(...components):this
Sets components for this modal.
NameTypeOptionalDescription
...componentsRestOrArray<ActionRowBuilder<ModalActionRowComponentBuilder>>NoThe components to set
setCustomId(customId):this
Sets the custom id of this modal.
NameTypeOptionalDescription
customIdstringNoThe custom id to use
setTitle(title):this
Sets the title of this modal.
NameTypeOptionalDescription
titlestringNoThe title to use
Serializes this builder to API-compatible JSON data.
Remarks
This method runs validations on the data before serializing it. As such, it may throw an error if the data is invalid.