CommandInteraction
Defined in: packages/structures/src/interactions.ts:633
Application command interaction with fully typed option resolver.
Extends
Section titled âExtendsâExtended by
Section titled âExtended byâConstructors
Section titled âConstructorsâConstructor
Section titled âConstructorânew CommandInteraction(
client,data):CommandInteraction
Defined in: packages/structures/src/interactions.ts:644
Parameters
Section titled âParametersâReturns
Section titled âReturnsâCommandInteraction
Overrides
Section titled âOverridesâProperties
Section titled âPropertiesâapplicationId
Section titled âapplicationIdâ
readonlyapplicationId:string
Defined in: packages/structures/src/interactions.ts:171
Application identifier.
Inherited from
Section titled âInherited fromâchannelId?
Section titled âchannelId?â
readonlyoptionalchannelId?:string
Defined in: packages/structures/src/interactions.ts:177
Channel identifier.
Inherited from
Section titled âInherited fromâ
readonlydata:InteractionData
Defined in: packages/structures/src/interactions.ts:181
Raw interaction data.
Inherited from
Section titled âInherited fromâdeferred
Section titled âdeferredâdeferred:
boolean=false
Defined in: packages/structures/src/interactions.ts:185
Whether the initial response was deferred.
Inherited from
Section titled âInherited fromâguildId?
Section titled âguildId?â
readonlyoptionalguildId?:string
Defined in: packages/structures/src/interactions.ts:175
Guild identifier.
Inherited from
Section titled âInherited fromâ
readonlyid:string
Defined in: packages/structures/src/interactions.ts:169
Interaction identifier.
Inherited from
Section titled âInherited fromâoptions
Section titled âoptionsâ
readonlyoptions:CommandOptions
Defined in: packages/structures/src/interactions.ts:635
Typed option resolver. Access slash command options with full type safety.
replied
Section titled ârepliedâreplied:
boolean=false
Defined in: packages/structures/src/interactions.ts:183
Whether the initial response was sent.
Inherited from
Section titled âInherited fromâ
readonlytoken:string
Defined in: packages/structures/src/interactions.ts:173
Interaction token.
Inherited from
Section titled âInherited fromâ
readonlytype:number
Defined in: packages/structures/src/interactions.ts:179
Interaction type.
Inherited from
Section titled âInherited fromâAccessors
Section titled âAccessorsâcommandName
Section titled âcommandNameâGet Signature
Section titled âGet Signatureâget commandName():
string
Defined in: packages/structures/src/interactions.ts:638
Invoked command name.
Returns
Section titled âReturnsâstring
Command name or an empty string.
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
Inherited from
Section titled âInherited fromâ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[]
Inherited from
Section titled âInherited fromâ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
Inherited from
Section titled âInherited fromâ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
Inherited from
Section titled âInherited fromâ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
Inherited from
Section titled âInherited fromâ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
Inherited from
Section titled âInherited fromâ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" });Inherited from
Section titled âInherited fromâ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.
Inherited from
Section titled âInherited fromâ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.
Inherited from
Section titled âInherited fromâ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>
Inherited from
Section titled âInherited fromâ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.
Inherited from
Section titled âInherited fromâ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>
Inherited from
Section titled âInherited fromâ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.
Inherited from
Section titled âInherited fromâ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>
Inherited from
Section titled âInherited fromâ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.
Inherited from
Section titled âInherited fromâ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
Inherited from
Section titled âInherited fromâ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
Inherited from
Section titled âInherited fromâ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.
Inherited from
Section titled âInherited fromâ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
Inherited from
Section titled âInherited fromâ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
Inherited from
Section titled âInherited fromâInteraction.isChannelSelectMenu
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
Inherited from
Section titled âInherited fromâInteraction.isChatInputCommand
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
Inherited from
Section titled âInherited fromâ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
Inherited from
Section titled âInherited fromâInteraction.isContextMenuCommand
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
Inherited from
Section titled âInherited fromâInteraction.isMentionableSelectMenu
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.
Inherited from
Section titled âInherited fromâInteraction.isMessageComponent
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
Inherited from
Section titled âInherited fromâInteraction.isMessageContextMenuCommand
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.
Inherited from
Section titled âInherited fromâ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
Inherited from
Section titled âInherited fromâ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
Inherited from
Section titled âInherited fromâInteraction.isStringSelectMenu
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
Inherited from
Section titled âInherited fromâInteraction.isUserContextMenuCommand
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
Inherited from
Section titled âInherited fromâ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.
Inherited from
Section titled âInherited fromâ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.
Inherited from
Section titled âInherited fromâ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.
Inherited from
Section titled âInherited fromâ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>
Inherited from
Section titled âInherited fromâ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>