class ModalSubmitInteraction

extends

BaseInteraction<Cached>
export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extends BaseInteraction<Cached>

Represents a modal interaction

Type Parameters

optional
Cached? extends CacheType = CacheType

applicationId : Snowflake

The application's id

optional
appPermissions? : Readonly<PermissionsBitField>

Set of permissions the application or bot has within the channel the interaction was sent from

readonlyoptional
channel? : TextBasedChannels

The channel this interaction was sent in

optional
channelId? : Snowflake

The id of the channel this interaction was sent in

readonly
client : Client

The client that instantiated this

readonly
components : ActionRowModalData[]

The components within the modal

readonly
createdAt : Date

The time the interaction was created at

readonly
createdTimestamp : number

The timestamp the interaction was created at

readonly
customId : string

The custom id of the modal.

deferred : boolean

Whether the reply to this interaction has been deferred

ephemeral : boolean | null

Whether the reply to this interaction is ephemeral

readonly
fields : ModalSubmitFields

The fields within the modal

readonlyoptional
guild? : Guild

The guild this interaction was sent in

optional
guildId? : Snowflake

The id of the guild this interaction was sent in

optional
guildLocale? : Locale

The preferred locale from the guild this interaction was sent in

The interaction's id

locale : Locale

The locale of the user who invoked this interaction

optional
member? : GuildMember | APIGuildMember

If this interaction was sent in a guild, the member which sent it

optional
memberPermissions? : Readonly<PermissionsBitField>

The permissions of the member, if one exists, in the channel this interaction was executed in

message : Message<BooleanCache<Cached>> | null

The message associated with this interaction

replied : boolean

Whether this interaction has already been replied to

readonly
token : string

The interaction's token

The interaction's type

user : User

The user who created this interaction

version : number

The version

readonly
webhook : InteractionWebhook

An associated interaction webhook, can be used to further interact with this interaction

deferReply(
options: InteractionDeferReplyOptions & { fetchReply: true }
) : Promise<Message<BooleanCache<Cached>>>

Defers the reply to this interaction.

Examples:
// Defer the reply to this interaction
interaction.deferReply()
  .then(console.log)
  .catch(console.error)
// Defer to send an ephemeral reply later
interaction.deferReply({ ephemeral: true })
  .then(console.log)
  .catch(console.error);

deferUpdate(
options: InteractionDeferUpdateOptions & { fetchReply: true }
) : Promise<Message<BooleanCache<Cached>>>

Defers an update to the message to which the component was attached.

Examples:
// Defer updating and reset the component's loading state
interaction.deferUpdate()
  .then(console.log)
  .catch(console.error);

deleteReply(
message?: MessageResolvable | '@original'
) : Promise<void>

Deletes a reply to this interaction.

Examples:
// Delete the initial reply to this interaction
interaction.deleteReply()
  .then(console.log)
  .catch(console.error);

Edits a reply to this interaction.

Examples:
// Edit the initial reply to this interaction
interaction.editReply('New content')
  .then(console.log)
  .catch(console.error);

fetchReply(
message?: Snowflake | '@original'
) : Promise<Message<BooleanCache<Cached>>>

Fetches a reply to this interaction.

Examples:
// Fetch the initial reply to this interaction
interaction.fetchReply()
  .then(reply => console.log(`Replied with ${reply.content}`))
  .catch(console.error);

Send a follow-up message to this interaction.

inCachedGuild() : this is ModalSubmitInteraction<'cached'>

Indicates whether or not this interaction is both cached and received from a guild.

inGuild() : this is ModalSubmitInteraction<'raw' | 'cached'>

Indicates whether this interaction is received from a guild.

inRawGuild() : this is ModalSubmitInteraction<'raw'>

Indicates whether or not this interaction is received from an uncached guild.

isAnySelectMenu() : this is AnySelectMenuInteraction<Cached>

Indicates whether this interaction is a select menu of any known type.

Inherited from: BaseInteraction

isAutocomplete() : this is AutocompleteInteraction<Cached>

Indicates whether this interaction is an AutocompleteInteraction

Inherited from: BaseInteraction

isButton() : this is ButtonInteraction<Cached>

Indicates whether this interaction is a ButtonInteraction.

Inherited from: BaseInteraction

isChannelSelectMenu() : this is ChannelSelectMenuInteraction<Cached>

Indicates whether this interaction is a ChannelSelectMenuInteraction

Inherited from: BaseInteraction

isChatInputCommand() : this is ChatInputCommandInteraction<Cached>

Indicates whether this interaction is a ChatInputCommandInteraction.

Inherited from: BaseInteraction

isCommand() : this is CommandInteraction<Cached>

Indicates whether this interaction is a CommandInteraction

Inherited from: BaseInteraction

isContextMenuCommand() : this is ContextMenuCommandInteraction<Cached>

Indicates whether this interaction is a ContextMenuCommandInteraction

Inherited from: BaseInteraction

isFromMessage() : this is ModalMessageModalSubmitInteraction<Cached>

Whether this is from a MessageComponentInteraction.

isMentionableSelectMenu() : this is MentionableSelectMenuInteraction<Cached>

Indicates whether this interaction is a MentionableSelectMenuInteraction

Inherited from: BaseInteraction

isMessageComponent() : this is MessageComponentInteraction<Cached>

Indicates whether this interaction is a MessageComponentInteraction

Inherited from: BaseInteraction

isMessageContextMenuCommand() : this is MessageContextMenuCommandInteraction<Cached>

Indicates whether this interaction is a MessageContextMenuCommandInteraction

Inherited from: BaseInteraction

isModalSubmit() : this is ModalSubmitInteraction<Cached>

Indicates whether this interaction is a ModalSubmitInteraction

Inherited from: BaseInteraction

isRepliable() : this is RepliableInteraction<Cached>

Indicates whether this interaction can be replied to.

Inherited from: BaseInteraction

isRoleSelectMenu() : this is RoleSelectMenuInteraction<Cached>

Indicates whether this interaction is a RoleSelectMenuInteraction

Inherited from: BaseInteraction

deprecated
isSelectMenu() : this is StringSelectMenuInteraction<Cached>

Indicates whether this interaction is a StringSelectMenuInteraction.

Inherited from: BaseInteraction

isStringSelectMenu() : this is StringSelectMenuInteraction<Cached>

Indicates whether this interaction is a StringSelectMenuInteraction.

Inherited from: BaseInteraction

isUserContextMenuCommand() : this is UserContextMenuCommandInteraction<Cached>

Indicates whether this interaction is a UserContextMenuCommandInteraction

Inherited from: BaseInteraction

isUserSelectMenu() : this is UserSelectMenuInteraction<Cached>

Indicates whether this interaction is a UserSelectMenuInteraction

Inherited from: BaseInteraction

reply(
options: InteractionReplyOptions & { fetchReply: true }
) : Promise<Message<BooleanCache<Cached>>>

Creates a reply to this interaction. Use the fetchReply option to get the bot's reply message.

Examples:
// Reply to the interaction and fetch the response
interaction.reply({ content: 'Pong!', fetchReply: true })
  .then((message) => console.log(`Reply sent with content ${message.content}`))
  .catch(console.error);
// Create an ephemeral reply with an embed
const embed = new EmbedBuilder().setDescription('Pong!');

interaction.reply({ embeds: [embed], ephemeral: true })
  .then(() => console.log('Reply sent.'))
  .catch(console.error);

toJSON(
...props: Record<string, boolean | string>[]
) : unknown

Inherited from: Base

static
transformComponent(
rawComponent: any
) : Array<ModalData>

Transforms component data to discord.js-compatible data

Updates the original message of the component on which the interaction was received on.

Examples:
// Remove the components from the message
interaction.update({
  content: "A component interaction was received",
  components: []
})
  .then(console.log)
  .catch(console.error);

valueOf() : string

Inherited from: Base