ModalBuilder

export declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseCallbackData>
export declare class ModalBuilder implements JSONEncodable<APIModalInteractionResponseCallbackData>
A builder that creates API-compatible JSON data for modals.
constructor(data?)
Creates a new modal from API data.
NameTypeOptionalDescription
dataPartial<APIModalInteractionResponseCallbackData>YesThe API data to create this modal with
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
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.