Interaction
Defined in: packages/structures/src/interactions.ts:167
Base interaction structure.
Extended by
Section titled âExtended byâType Parameters
Section titled âType ParametersâTData extends InteractionData = InteractionData
Constructors
Section titled âConstructorsâConstructor
Section titled âConstructorânew Interaction<
TData>(client,data):Interaction<TData>
Defined in: packages/structures/src/interactions.ts:192
Creates an interaction from a Gateway payload.
Parameters
Section titled âParametersâInteraction transport.
TData
Gateway interaction payload.
Returns
Section titled âReturnsâInteraction<TData>
If required identifiers are missing.
Properties
Section titled âPropertiesâapplicationId
Section titled âapplicationIdâ
readonlyapplicationId:string
Defined in: packages/structures/src/interactions.ts:171
Application identifier.
channelId?
Section titled âchannelId?â
readonlyoptionalchannelId?:string
Defined in: packages/structures/src/interactions.ts:177
Channel identifier.
readonlydata:TData
Defined in: packages/structures/src/interactions.ts:181
Raw interaction data.
deferred
Section titled âdeferredâdeferred:
boolean=false
Defined in: packages/structures/src/interactions.ts:185
Whether the initial response was deferred.
guildId?
Section titled âguildId?â
readonlyoptionalguildId?:string
Defined in: packages/structures/src/interactions.ts:175
Guild identifier.
readonlyid:string
Defined in: packages/structures/src/interactions.ts:169
Interaction identifier.
replied
Section titled ârepliedâreplied:
boolean=false
Defined in: packages/structures/src/interactions.ts:183
Whether the initial response was sent.
readonlytoken:string
Defined in: packages/structures/src/interactions.ts:173
Interaction token.
readonlytype:number
Defined in: packages/structures/src/interactions.ts:179
Interaction type.
Accessors
Section titled âAccessorsâcreatedTimestamp
Section titled âcreatedTimestampâGet Signature
Section titled âGet Signatureâget createdTimestamp():
number
Defined in: packages/structures/src/interactions.ts:396
Unix timestamp (ms) at which the interaction was created, from its snowflake.
Returns
Section titled âReturnsânumber
entitlements
Section titled âentitlementsâGet Signature
Section titled âGet Signatureâget entitlements(): readonly
APIEntitlement[]
Defined in: packages/structures/src/interactions.ts:205
The entitlements of the person (and guild) that ran this interaction: what they own from your SKUs.
Returns
Section titled âReturnsâreadonly APIEntitlement[]
expiresAt
Section titled âexpiresAtâGet Signature
Section titled âGet Signatureâget expiresAt():
Date
Defined in: packages/structures/src/interactions.ts:400
When the interaction token stops working (15 minutes after creation).
Returns
Section titled âReturnsâDate
isExpired
Section titled âisExpiredâGet Signature
Section titled âGet Signatureâget isExpired():
boolean
Defined in: packages/structures/src/interactions.ts:404
Whether the token has expired; no response, edit or follow-up can succeed after that.
Returns
Section titled âReturnsâboolean
Get Signature
Section titled âGet Signatureâget member():
GuildMember|null
Defined in: packages/structures/src/interactions.ts:381
The invoking guild member, or null outside a guild.
Returns
Section titled âReturnsâGuildMember | null
Get Signature
Section titled âGet Signatureâget user():
User|null
Defined in: packages/structures/src/interactions.ts:372
The invoking user (from member.user in guilds, user in DMs).
Returns
Section titled âReturnsâUser | null
Methods
Section titled âMethodsâawaitModalSubmit()
Section titled âawaitModalSubmit()âawaitModalSubmit(
options):Promise<ModalSubmitInteraction>
Defined in: packages/structures/src/interactions.ts:262
Waits for this user to submit a modal, typically one this interaction just opened with showModal.
Parameters
Section titled âParametersâoptions
Section titled âoptionsâtime (required, ms); optional customId and filter.
customId?
Section titled âcustomId?âstring
filter?
Section titled âfilter?â(interaction) => boolean | Promise<boolean>
number
Returns
Section titled âReturnsâPromise<ModalSubmitInteraction>
The submission.
When time runs out first or no client is attached.
Example
Section titled âExampleâconst submitted = await interaction.awaitModalSubmit({ time: 60_000, customId: "feedback" });deferReply()
Section titled âdeferReply()âCall Signature
Section titled âCall SignatureâdeferReply(
options):Promise<Message|null>
Defined in: packages/structures/src/interactions.ts:513
Defers the initial interaction response. true or { ephemeral: true }
makes the eventual response private; withResponse: true returns the
placeholder message.
Parameters
Section titled âParametersâoptions
Section titled âoptionsâephemeral?
Section titled âephemeral?âboolean
withResponse
Section titled âwithResponseâtrue
Returns
Section titled âReturnsâPromise<Message | null>
When already acknowledged or REST fails.
Call Signature
Section titled âCall SignatureâdeferReply(
options?):Promise<void>
Defined in: packages/structures/src/interactions.ts:517
Defers the initial interaction response. true or { ephemeral: true }
makes the eventual response private; withResponse: true returns the
placeholder message.
Parameters
Section titled âParametersâoptions?
Section titled âoptions?âboolean | { ephemeral?: boolean; withResponse?: boolean; }
Returns
Section titled âReturnsâPromise<void>
When already acknowledged or REST fails.
deleteFollowUp()
Section titled âdeleteFollowUp()âdeleteFollowUp(
messageId):Promise<void>
Defined in: packages/structures/src/interactions.ts:439
Deletes a follow-up message.
Parameters
Section titled âParametersâmessageId
Section titled âmessageIdâstring
Follow-up message ID.
Returns
Section titled âReturnsâPromise<void>
deleteReply()
Section titled âdeleteReply()âdeleteReply():
Promise<void>
Defined in: packages/structures/src/interactions.ts:545
Deletes the original response.
Returns
Section titled âReturnsâPromise<void>
Promise fulfilled after deletion.
When not acknowledged or REST fails.
editFollowUp()
Section titled âeditFollowUp()âeditFollowUp(
messageId,options):Promise<unknown>
Defined in: packages/structures/src/interactions.ts:432
Edits a follow-up message.
Parameters
Section titled âParametersâmessageId
Section titled âmessageIdâstring
Follow-up message ID.
options
Section titled âoptionsâstring | InteractionReplyOptions
Returns
Section titled âReturnsâPromise<unknown>
editReply()
Section titled âeditReply()âeditReply(
options):Promise<unknown>
Defined in: packages/structures/src/interactions.ts:536
Edits the original response.
Parameters
Section titled âParametersâoptions
Section titled âoptionsâReplacement message options.
Returns
Section titled âReturnsâPromise<unknown>
Discord response.
When not acknowledged or REST fails.
fetchReply()
Section titled âfetchReply()âfetchReply():
Promise<unknown>
Defined in: packages/structures/src/interactions.ts:427
Fetches the original response message.
Returns
Section titled âReturnsâPromise<unknown>
followUp()
Section titled âfollowUp()âfollowUp(
options):Promise<unknown>
Defined in: packages/structures/src/interactions.ts:553
Sends a follow-up message using the interaction webhook.
Parameters
Section titled âParametersâoptions
Section titled âoptionsâstring | InteractionReplyOptions
Follow-up message options.
Returns
Section titled âReturnsâPromise<unknown>
Discord response.
When not acknowledged (Discord has no webhook before the initial response) or REST fails.
hasEntitlement()
Section titled âhasEntitlement()âhasEntitlement(
skuId):boolean
Defined in: packages/structures/src/interactions.ts:212
Whether the interaction carries an active entitlement for a SKU.
Parameters
Section titled âParametersâstring
Returns
Section titled âReturnsâboolean
isAnySelectMenu()
Section titled âisAnySelectMenu()âisAnySelectMenu():
this is ComponentInteraction
Defined in: packages/structures/src/interactions.ts:334
Whether this is any select menu interaction.
Returns
Section titled âReturnsâthis is ComponentInteraction
isAutocomplete()
Section titled âisAutocomplete()âisAutocomplete():
this is AutocompleteInteraction
Defined in: packages/structures/src/interactions.ts:300
Whether this interaction is autocomplete.
Returns
Section titled âReturnsâthis is AutocompleteInteraction
True for autocomplete interactions.
isButton()
Section titled âisButton()âisButton():
this is ComponentInteraction
Defined in: packages/structures/src/interactions.ts:310
Whether this is a button interaction.
Returns
Section titled âReturnsâthis is ComponentInteraction
isChannelSelectMenu()
Section titled âisChannelSelectMenu()âisChannelSelectMenu():
this is ComponentInteraction
Defined in: packages/structures/src/interactions.ts:330
Whether this is a channel select menu interaction.
Returns
Section titled âReturnsâthis is ComponentInteraction
isChatInputCommand()
Section titled âisChatInputCommand()âisChatInputCommand():
this is CommandInteraction
Defined in: packages/structures/src/interactions.ts:235
Whether this interaction is a slash (chat input) command. Since 0.2.2 this is false for context-menu commands; use isCommand for both.
Returns
Section titled âReturnsâthis is CommandInteraction
isCommand()
Section titled âisCommand()âisCommand():
this is CommandInteraction
Defined in: packages/structures/src/interactions.ts:228
Whether this interaction is any application command: slash or context menu.
Returns
Section titled âReturnsâthis is CommandInteraction
isContextMenuCommand()
Section titled âisContextMenuCommand()âisContextMenuCommand():
this is ContextMenuCommandInteraction
Defined in: packages/structures/src/interactions.ts:239
Whether this interaction is a user or message context-menu command.
Returns
Section titled âReturnsâthis is ContextMenuCommandInteraction
isMentionableSelectMenu()
Section titled âisMentionableSelectMenu()âisMentionableSelectMenu():
this is ComponentInteraction
Defined in: packages/structures/src/interactions.ts:326
Whether this is a mentionable select menu interaction.
Returns
Section titled âReturnsâthis is ComponentInteraction
isMessageComponent()
Section titled âisMessageComponent()âisMessageComponent():
this is ComponentInteraction
Defined in: packages/structures/src/interactions.ts:292
Whether this interaction is a message component.
Returns
Section titled âReturnsâthis is ComponentInteraction
True for component interactions.
isMessageContextMenuCommand()
Section titled âisMessageContextMenuCommand()âisMessageContextMenuCommand():
this is ContextMenuCommandInteraction
Defined in: packages/structures/src/interactions.ts:248
Whether this interaction is a message context-menu command (right-click a message).
Returns
Section titled âReturnsâthis is ContextMenuCommandInteraction
isModalSubmit()
Section titled âisModalSubmit()âisModalSubmit():
this is ModalSubmitInteraction
Defined in: packages/structures/src/interactions.ts:296
Whether this interaction is a modal submission.
Returns
Section titled âReturnsâthis is ModalSubmitInteraction
True for modal submissions.
isRoleSelectMenu()
Section titled âisRoleSelectMenu()âisRoleSelectMenu():
this is ComponentInteraction
Defined in: packages/structures/src/interactions.ts:322
Whether this is a role select menu interaction.
Returns
Section titled âReturnsâthis is ComponentInteraction
isStringSelectMenu()
Section titled âisStringSelectMenu()âisStringSelectMenu():
this is ComponentInteraction
Defined in: packages/structures/src/interactions.ts:314
Whether this is a string select menu interaction.
Returns
Section titled âReturnsâthis is ComponentInteraction
isUserContextMenuCommand()
Section titled âisUserContextMenuCommand()âisUserContextMenuCommand():
this is ContextMenuCommandInteraction
Defined in: packages/structures/src/interactions.ts:244
Whether this interaction is a user context-menu command (right-click a user).
Returns
Section titled âReturnsâthis is ContextMenuCommandInteraction
isUserSelectMenu()
Section titled âisUserSelectMenu()âisUserSelectMenu():
this is ComponentInteraction
Defined in: packages/structures/src/interactions.ts:318
Whether this is a user select menu interaction.
Returns
Section titled âReturnsâthis is ComponentInteraction
reply()
Section titled âreply()âCall Signature
Section titled âCall Signatureâreply(
options):Promise<Message|null>
Defined in: packages/structures/src/interactions.ts:492
Sends the initial interaction response. With withResponse: true it
returns the created Message in the same request (no fetchReply()).
Parameters
Section titled âParametersâoptions
Section titled âoptionsâInteractionReplyOptions & object
Returns
Section titled âReturnsâPromise<Message | null>
When already acknowledged or REST fails.
Call Signature
Section titled âCall Signatureâreply(
options):Promise<unknown>
Defined in: packages/structures/src/interactions.ts:495
Sends the initial interaction response. With withResponse: true it
returns the created Message in the same request (no fetchReply()).
Parameters
Section titled âParametersâoptions
Section titled âoptionsâstring | InteractionReplyOptions
Returns
Section titled âReturnsâPromise<unknown>
When already acknowledged or REST fails.
showModal()
Section titled âshowModal()âshowModal(
modal):Promise<unknown>
Defined in: packages/structures/src/interactions.ts:599
Opens a modal dialog in the userâs client.
Parameters
Section titled âParametersâ{ toJSON: { components: unknown[]; custom_id: string; title: string; }; } | { components: readonly unknown[]; custom_id: string; title: string; }
Modal builder output or raw modal callback data.
Returns
Section titled âReturnsâPromise<unknown>
Discord response.
When already acknowledged or REST fails.
update()
Section titled âupdate()âCall Signature
Section titled âCall Signatureâupdate(
options):Promise<Message|null>
Defined in: packages/structures/src/interactions.ts:567
Updates the message a component is on. With withResponse: true it
returns the updated Message.
Parameters
Section titled âParametersâoptions
Section titled âoptionsâInteractionReplyOptions & object
Returns
Section titled âReturnsâPromise<Message | null>
Call Signature
Section titled âCall Signatureâupdate(
options):Promise<unknown>
Defined in: packages/structures/src/interactions.ts:570
Updates the message a component is on. With withResponse: true it
returns the updated Message.
Parameters
Section titled âParametersâoptions
Section titled âoptionsâstring | InteractionReplyOptions
Returns
Section titled âReturnsâPromise<unknown>