export abstract class CommandInteraction<Cached extends CacheType = CacheType> extends BaseInteraction<Cached>
Represents a command interaction.
Readonly<PermissionsBitField> appPermissions :
Set of permissions the application or bot has within the channel the interaction was sent from
Inherited from: BaseInteraction
APIAuthorizingIntegrationOwnersMap authorizingIntegrationOwners :
Mapping of installation contexts that the interaction was authorized for the related user or guild ids
Inherited from: BaseInteraction
readonlyCacheTypeReducer<Cached, GuildTextBasedChannel | null, GuildTextBasedChannel | null, GuildTextBasedChannel | null, TextBasedChannel | null> channel :
The channel this interaction was sent in
Inherited from: BaseInteraction
Snowflake channelId :
The id of the channel this interaction was sent in
readonlyApplicationCommand | ApplicationCommand<{ guild: GuildResolvable }> | null command :
The invoked application command, if it was fetched before
The id of the guild the invoked application command is registered to
Snowflake commandId :
The invoked application command's id
string commandName :
The invoked application command's name
ApplicationCommandType commandType :
The invoked application command's type
InteractionContextType | null context :
Context where the interaction was triggered from
Inherited from: BaseInteraction
readonlynumber createdTimestamp :
The timestamp the interaction was created at
Inherited from: BaseInteraction
boolean deferred :
Whether the reply to this interaction has been deferred
Collection<Snowflake, Entitlement> entitlements :
The entitlements for the invoking user, representing access to premium SKUs
Inherited from: BaseInteraction
readonlyCacheTypeReducer<Cached, Guild, null> guild :
The guild this interaction was sent in
Inherited from: BaseInteraction
CacheTypeReducer<Cached, Snowflake> guildId :
The id of the guild this interaction was sent in
Inherited from: BaseInteraction
CacheTypeReducer<Cached, Locale> guildLocale :
The preferred locale from the guild this interaction was sent in
Inherited from: BaseInteraction
CacheTypeReducer<Cached, GuildMember, APIInteractionGuildMember> member :
If this interaction was sent in a guild, the member which sent it
Inherited from: BaseInteraction
CacheTypeReducer<Cached, Readonly<PermissionsBitField>> memberPermissions :
The permissions of the member, if one exists, in the channel this interaction was executed in
Inherited from: BaseInteraction
Omit<CommandInteractionOptionResolver<Cached>, | 'getMessage' | 'getFocused' | 'getMentionable' | 'getRole' | 'getUser' | 'getMember' | 'getAttachment' | 'getNumber' | 'getInteger' | 'getString' | 'getChannel' | 'getBoolean' | 'getSubcommandGroup' | 'getSubcommand'> options :
boolean replied :
Whether this interaction has already been replied to
The interaction's type
InteractionWebhook webhook :
An associated interaction webhook, can be used to further interact with this interaction
awaitModalSubmit) : Promise<ModalSubmitInteraction<Cached>> (
Collects a single modal submit interaction that passes the filter. The Promise will reject if the time expires.
// Collect a modal submit interaction
const filter = (interaction) => interaction.customId === 'modal';
interaction.awaitModalSubmit({ filter, time: 15_000 })
.then(interaction => console.log(`${interaction.customId} was submitted!`))
.catch(console.error);
deferReplyoptions: InteractionDeferReplyOptions & { withResponse: true }) : Promise<InteractionCallbackResponse> (
Defers the reply to this interaction.
// Defer the reply to this interaction
interaction.deferReply()
.then(console.log)
.catch(console.error)
// Defer to send an ephemeral reply later
interaction.deferReply({ flags: MessageFlags.Ephemeral })
.then(console.log)
.catch(console.error);
deleteReplymessage?: MessageResolvable | '@original' = '@original') : Promise<void> (
Deletes a reply to this interaction.
// Delete the initial reply to this interaction
interaction.deleteReply()
.then(console.log)
.catch(console.error);
editReplyoptions: string | MessagePayload | InteractionEditReplyOptions) : Promise<Message<BooleanCache<Cached>>> (
Edits a reply to this interaction.
// Edit the initial reply to this interaction
interaction.editReply('New content')
.then(console.log)
.catch(console.error);
fetchReplymessage?: Snowflake | '@original' = '@original') : Promise<Message<BooleanCache<Cached>>> (
Fetches a reply to this interaction.
// Fetch the initial reply to this interaction
interaction.fetchReply()
.then(reply => console.log(`Replied with ${reply.content}`))
.catch(console.error);
followUpoptions: string | MessagePayload | InteractionReplyOptions) : Promise<Message<BooleanCache<Cached>>> (
Send a follow-up message to this interaction.
inCachedGuildthis is CommandInteraction<'cached'> () :
Indicates whether this interaction is received from a cached guild.
inGuildthis is CommandInteraction<'raw' | 'cached'> () :
Indicates whether this interaction is received from a guild.
inRawGuildthis is CommandInteraction<'raw'> () :
Indicates whether or not this interaction is received from an uncached guild.
isAnySelectMenuthis is SelectMenuInteraction<Cached> () :
Indicates whether this interaction is a select menu of any known type.
Inherited from: BaseInteraction
isAutocompletethis is AutocompleteInteraction<Cached> () :
Indicates whether this interaction is an AutocompleteInteraction
Inherited from: BaseInteraction
isButtonthis is ButtonInteraction<Cached> () :
Indicates whether this interaction is a ButtonInteraction.
Inherited from: BaseInteraction
isChannelSelectMenuthis is ChannelSelectMenuInteraction<Cached> () :
Indicates whether this interaction is a ChannelSelectMenuInteraction
Inherited from: BaseInteraction
isChatInputCommandthis is ChatInputCommandInteraction<Cached> () :
Indicates whether this interaction is a ChatInputCommandInteraction.
Inherited from: BaseInteraction
isCommandthis is CommandInteraction<Cached> () :
Indicates whether this interaction is a CommandInteraction
Inherited from: BaseInteraction
isContextMenuCommandthis is ContextMenuCommandInteraction<Cached> () :
Indicates whether this interaction is a ContextMenuCommandInteraction
Inherited from: BaseInteraction
isMentionableSelectMenuthis is MentionableSelectMenuInteraction<Cached> () :
Indicates whether this interaction is a MentionableSelectMenuInteraction
Inherited from: BaseInteraction
isMessageComponentthis is MessageComponentInteraction<Cached> () :
Indicates whether this interaction is a MessageComponentInteraction
Inherited from: BaseInteraction
isMessageContextMenuCommandthis is MessageContextMenuCommandInteraction<Cached> () :
Indicates whether this interaction is a MessageContextMenuCommandInteraction
Inherited from: BaseInteraction
isModalSubmitthis is ModalSubmitInteraction<Cached> () :
Indicates whether this interaction is a ModalSubmitInteraction
Inherited from: BaseInteraction
isRepliablethis is RepliableInteraction<Cached> () :
Indicates whether this interaction can be replied to.
Inherited from: BaseInteraction
isRoleSelectMenuthis is RoleSelectMenuInteraction<Cached> () :
Indicates whether this interaction is a RoleSelectMenuInteraction
Inherited from: BaseInteraction
isStringSelectMenuthis is StringSelectMenuInteraction<Cached> () :
Indicates whether this interaction is a StringSelectMenuInteraction.
Inherited from: BaseInteraction
isUserContextMenuCommandthis is UserContextMenuCommandInteraction<Cached> () :
Indicates whether this interaction is a UserContextMenuCommandInteraction
Inherited from: BaseInteraction
isUserSelectMenuthis is UserSelectMenuInteraction<Cached> () :
Indicates whether this interaction is a UserSelectMenuInteraction
Inherited from: BaseInteraction
replyoptions: InteractionReplyOptions & { withResponse: true }) : Promise<InteractionCallbackResponse> (
Creates a reply to this interaction. Use the withResponse
option to get the interaction callback response.
// Reply to the interaction and fetch the response
interaction.reply({ content: 'Pong!', withResponse: true })
.then((response) => console.log(`Reply sent with content ${response.resource.message.content}`))
.catch(console.error);
// Create an ephemeral reply with an embed
const embed = new EmbedBuilder().setDescription('Pong!');
interaction.reply({ embeds: [embed], flags: MessageFlags.Ephemeral })
.then(() => console.log('Reply sent.'))
.catch(console.error);
showModalmodal: JSONEncodable<APIModalInteractionResponseCallbackData> | ModalComponentData | APIModalInteractionResponseCallbackDataoptions: ShowModalOptions & { withResponse: true } = {}) : Promise<InteractionCallbackResponse> (
Shows a modal component