Skip to content

Modal ​

classe · Source

Represents a modal (form) to be shown in response to an interaction

Constructor ​

new Modal(data: Object, client: Client)

Parameters

NameTypeDescription
dataObjectModal to clone or raw data
clientClientThe client constructing this Modal, if provided Default: null.

Properties ​

components ​

components: Array<MessageActionRow>

A list of MessageActionRows in the modal Source

customId ​

nullable

customId: string

A unique string to be sent in the interaction when submitted Source

title ​

nullable

title: string

The title to be displayed on this modal Source

nonce ​

nonce: Snowflake

Timestamp (Discord epoch) of when this modal was created Source

id ​

id: Snowflake

ID slash / button / menu when modal is displayed Source

applicationId ​

applicationId: Snowflake

Application sending the modal Source

channelId ​

channelId: Snowflake

The id of the channel the message was sent in Source

replied ​

replied: boolean

Whether this interaction has already been replied to Source

guildId ​

readonly · nullable

guildId: Snowflake

The id of the guild the message was sent in, if any Source

channel ​

readonly

channel: TextBasedChannels

The channel that the message was sent in Source

guild ​

readonly · nullable

guild: Guild

The guild the message was sent in (if in a guild channel) Source

isMessage ​

readonly

isMessage: boolean

Check data Source

Methods ​

reply ​

reply(): Promise<(Message|Modal)>

Reply to this modal with data. (Event only) Returns: Promise<(Message\|Modal)>

js
client.on('interactionModalCreate', modal => {
   // Modal > ActionRow > TextInput
   modal.components[0].components[0].setValue('1+1');
   modal.components[1].components[0].setValue('hello');
   modal.reply();
})

Source

Unofficial software. Not affiliated with or supported by Discord.