Carbon
Core/Classes

ModalInteraction

This is the base type interaction, all interaction types extend from this

Extends

Constructors

Constructor

new ModalInteraction(client, data, defaults): ModalInteraction

Parameters

ParameterType
clientClient
dataAPIModalSubmitInteraction
defaultsInteractionDefaults

Returns

ModalInteraction

Overrides

BaseInteraction.constructor

Properties

PropertyTypeDefault valueDescriptionInherited from
_deferredbooleanfalseInternal Whether the interaction is deferred alreadyBaseInteraction._deferred
clientClientundefined-BaseInteraction.client
customIdstringundefined--
fieldsFieldsHandlerundefined--
rawDataAPIModalSubmitInteractionundefinedThe raw data of the interactionBaseInteraction.rawData
typeInteractionTypeundefinedThe type of interactionBaseInteraction.type
userIdundefined | stringundefinedThe user who sent the interactionBaseInteraction.userId

Accessors

channel

Get Signature

get channel(): null | DmChannel<false> | GroupDmChannel<false> | GuildTextChannel<false> | GuildVoiceChannel<false> | GuildCategoryChannel<false> | GuildAnnouncementChannel<false> | GuildThreadChannel<ThreadChannelType, false> | GuildStageChannel<false> | GuildForumChannel<false> | GuildMediaChannel

Returns

null | DmChannel<false> | GroupDmChannel<false> | GuildTextChannel<false> | GuildVoiceChannel<false> | GuildCategoryChannel<false> | GuildAnnouncementChannel<false> | GuildThreadChannel<ThreadChannelType, false> | GuildStageChannel<false> | GuildForumChannel<false> | GuildMediaChannel

Inherited from

BaseInteraction.channel


embeds

Get Signature

get embeds(): null | Embed[]

Returns

null | Embed[]

Inherited from

BaseInteraction.embeds


guild

Get Signature

get guild(): null | Guild<true>

Returns

null | Guild<true>

Inherited from

BaseInteraction.guild


member

Get Signature

get member(): null | GuildMember<false, true>

Returns

null | GuildMember<false, true>

Inherited from

BaseInteraction.member


message

Get Signature

get message(): null | Message<false>

Returns

null | Message<false>

Inherited from

BaseInteraction.message


user

Get Signature

get user(): null | User<false>

Returns

null | User<false>

Inherited from

BaseInteraction.user

Methods

acknowledge()

acknowledge(): Promise<void>

Acknowledge the interaction, the user does not see a loading state. This can only be used for modals triggered from components

Returns

Promise<void>


defer()

defer(__namedParameters): Promise<void>

Internal

Defer the interaction response. This is used automatically by commands that are set to defer. If the interaction is already deferred, this will do nothing.

Parameters

ParameterType
__namedParameters{ ephemeral?: boolean; }
__namedParameters.ephemeral?boolean

Returns

Promise<void>

Inherited from

BaseInteraction.defer


followUp()

followUp(reply): Promise<void>

Send a followup message to the interaction

Parameters

ParameterType
replyMessagePayload

Returns

Promise<void>

Inherited from

BaseInteraction.followUp


reply()

reply(data, overrideAutoRegister): Promise<Message<false>>

Reply to an interaction. If the interaction is deferred, this will edit the original response.

Parameters

ParameterTypeDefault valueDescription
dataMessagePayloadundefinedThe message data to send
overrideAutoRegisterbooleanfalse-

Returns

Promise<Message<false>>

Inherited from

BaseInteraction.reply


replyAndWaitForComponent()

replyAndWaitForComponent(data, timeout): Promise<{ customId: string; success: true; values?: string[]; } | { reason: "timed out"; success: false; }>

This function will reply to the interaction and wait for a component to be pressed. Any components passed in the message will not have run() functions called and will only trigger the interaction.acknowledge() function. This function will also return a promise that resolves to the custom ID of the component that was pressed.

Parameters

ParameterTypeDefault valueDescription
dataMessagePayloadundefinedThe message data to send
timeoutnumber300000After this many milliseconds, the promise will resolve to null

Returns

Promise<{ customId: string; success: true; values?: string[]; } | { reason: "timed out"; success: false; }>

Inherited from

BaseInteraction.replyAndWaitForComponent


showModal()

showModal(modal): Promise<void>

Show a modal to the user This can only be used if the interaction is not deferred

Parameters

ParameterType
modalModal

Returns

Promise<void>

Inherited from

BaseInteraction.showModal


update()

update(data): Promise<void>

Update the original message of the component. This can only be used for modals triggered from components

Parameters

ParameterType
dataMessagePayload

Returns

Promise<void>

On this page