MessageContextInteraction
Interface: MessageContextInteraction<Context>
Section titled “Interface: MessageContextInteraction<Context>”Defined in: interactions/MessageContextCommandInteraction.ts:7
A message context menu command interaction. Passed to a ContextCommandHandler registered for ContextCommandType.Message.
Extends
Section titled “Extends”CommandInteraction<ApplicationCommandType.Message,Context>
Type Parameters
Section titled “Type Parameters”Context
Section titled “Context”Context extends BaseInteractionContext = BaseInteractionContext
Properties
Section titled “Properties”_ephemeral
Section titled “_ephemeral”
protected_ephemeral:boolean|null=null
Defined in: interactions/BaseInteraction.ts:93
Inherited from
Section titled “Inherited from”
protectedapi:API
Defined in: interactions/BaseInteraction.ts:102
Inherited from
Section titled “Inherited from”commandType
Section titled “commandType”
readonlycommandType:Message
Defined in: interactions/CommandInteraction.ts:15
The application command type (chat input, user, or message).
Inherited from
Section titled “Inherited from”CommandInteraction.commandType
context
Section titled “context”
readonlycontext:Context
Defined in: interactions/BaseInteraction.ts:97
The Hono interaction context this interaction was created from.
Inherited from
Section titled “Inherited from”deferred
Section titled “deferred”
protecteddeferred:boolean=false
Defined in: interactions/BaseInteraction.ts:95
Inherited from
Section titled “Inherited from”fetcher
Section titled “fetcher”
readonlyfetcher:Fetcher
Defined in: interactions/BaseInteraction.ts:99
Cache-aware fetcher for resolving Discord entities referenced by this interaction.
Inherited from
Section titled “Inherited from”
protectedreadonlyraw:APIChatInputApplicationCommandInteraction|APIMessageApplicationCommandInteraction|APIUserApplicationCommandInteraction|APIPrimaryEntryPointCommandInteraction
Defined in: interactions/BaseInteraction.ts:90
The raw interaction data
Inherited from
Section titled “Inherited from”replied
Section titled “replied”
protectedreplied:boolean=false
Defined in: interactions/BaseInteraction.ts:94
Inherited from
Section titled “Inherited from”
readonlyrest:REST
Defined in: interactions/BaseInteraction.ts:92
REST client used to make requests to the Discord API.
Inherited from
Section titled “Inherited from”targetMessage
Section titled “targetMessage”
readonlytargetMessage:APIMessage
Defined in: interactions/MessageContextCommandInteraction.ts:12
The message the command was invoked on.
readonlytype:ApplicationCommand
Defined in: interactions/BaseInteraction.ts:88
The interaction’s Discord interaction type.
Inherited from
Section titled “Inherited from”Accessors
Section titled “Accessors”applicationId
Section titled “applicationId”Get Signature
Section titled “Get Signature”get applicationId():
string
Defined in: interactions/BaseInteraction.ts:114
The ID of the application this interaction was sent to.
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”appPermissions
Section titled “appPermissions”Get Signature
Section titled “Get Signature”get appPermissions():
string
Defined in: interactions/BaseInteraction.ts:179
Bitwise set of permissions the app has in the source location of the interaction.
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”BaseInteraction.appPermissions
channel
Section titled “channel”Get Signature
Section titled “Get Signature”get channel():
Partial<APIAnnouncementThreadChannel> &Pick<APIChannel,"id"|"type"> |Partial<APIDMChannel> &Pick<APIChannel,"id"|"type"> |Partial<APIGroupDMChannel> &Pick<APIChannel,"id"|"type"> |Partial<APIGuildCategoryChannel> &Pick<APIChannel,"id"|"type"> |Partial<APIGuildForumChannel> &Pick<APIChannel,"id"|"type"> |Partial<APIGuildMediaChannel> &Pick<APIChannel,"id"|"type"> |Partial<APIGuildStageVoiceChannel> &Pick<APIChannel,"id"|"type"> |Partial<APIGuildVoiceChannel> &Pick<APIChannel,"id"|"type"> |Partial<APINewsChannel> &Pick<APIChannel,"id"|"type"> |Partial<APIPrivateThreadChannel> &Pick<APIChannel,"id"|"type"> |Partial<APIPublicThreadChannel> &Pick<APIChannel,"id"|"type"> |Partial<APITextChannel> &Pick<APIChannel,"id"|"type"> |never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|never|undefined
Defined in: interactions/BaseInteraction.ts:129
The partial channel object the interaction was sent from, if any. Not cached — see Honocord’s runtime notes.
Returns
Section titled “Returns”Partial<APIAnnouncementThreadChannel> & Pick<APIChannel, "id" | "type"> | Partial<APIDMChannel> & Pick<APIChannel, "id" | "type"> | Partial<APIGroupDMChannel> & Pick<APIChannel, "id" | "type"> | Partial<APIGuildCategoryChannel> & Pick<APIChannel, "id" | "type"> | Partial<APIGuildForumChannel> & Pick<APIChannel, "id" | "type"> | Partial<APIGuildMediaChannel> & Pick<APIChannel, "id" | "type"> | Partial<APIGuildStageVoiceChannel> & Pick<APIChannel, "id" | "type"> | Partial<APIGuildVoiceChannel> & Pick<APIChannel, "id" | "type"> | Partial<APINewsChannel> & Pick<APIChannel, "id" | "type"> | Partial<APIPrivateThreadChannel> & Pick<APIChannel, "id" | "type"> | Partial<APIPublicThreadChannel> & Pick<APIChannel, "id" | "type"> | Partial<APITextChannel> & Pick<APIChannel, "id" | "type"> | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | never | undefined
Inherited from
Section titled “Inherited from”channelId
Section titled “channelId”Get Signature
Section titled “Get Signature”get channelId():
string|undefined
Defined in: interactions/BaseInteraction.ts:124
The ID of the channel the interaction was sent from, if any.
Returns
Section titled “Returns”string | undefined
Inherited from
Section titled “Inherited from”commandId
Section titled “commandId”Get Signature
Section titled “Get Signature”get commandId():
string
Defined in: interactions/CommandInteraction.ts:28
The invoked command’s ID.
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”commandName
Section titled “commandName”Get Signature
Section titled “Get Signature”get commandName():
string
Defined in: interactions/CommandInteraction.ts:23
The invoked command’s name.
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”CommandInteraction.commandName
entitlements
Section titled “entitlements”Get Signature
Section titled “Get Signature”get entitlements():
APIEntitlement[]
Defined in: interactions/BaseInteraction.ts:119
Entitlements for the invoking user, for monetized apps.
Returns
Section titled “Returns”APIEntitlement[]
Inherited from
Section titled “Inherited from”Get Signature
Section titled “Get Signature”get guild():
APIPartialInteractionGuild|undefined
Defined in: interactions/BaseInteraction.ts:139
The partial guild object the interaction was sent from, if any. Not cached.
Returns
Section titled “Returns”APIPartialInteractionGuild | undefined
Inherited from
Section titled “Inherited from”guildId
Section titled “guildId”Get Signature
Section titled “Get Signature”get guildId():
string|undefined
Defined in: interactions/BaseInteraction.ts:134
The ID of the guild the interaction was sent from, if any.
Returns
Section titled “Returns”string | undefined
Inherited from
Section titled “Inherited from”guildLocale
Section titled “guildLocale”Get Signature
Section titled “Get Signature”get guildLocale():
Locale|undefined
Defined in: interactions/BaseInteraction.ts:164
The guild’s locale, if sent from a guild.
Returns
Section titled “Returns”Locale | undefined
Inherited from
Section titled “Inherited from”Get Signature
Section titled “Get Signature”get id():
string
Defined in: interactions/BaseInteraction.ts:174
The interaction’s ID.
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”locale
Section titled “locale”Get Signature
Section titled “Get Signature”get locale():
Locale|undefined
Defined in: interactions/BaseInteraction.ts:159
The invoking user’s locale.
Returns
Section titled “Returns”Locale | undefined
Inherited from
Section titled “Inherited from”member
Section titled “member”Get Signature
Section titled “Get Signature”get member():
APIInteractionGuildMember|undefined
Defined in: interactions/BaseInteraction.ts:154
The guild member who triggered the interaction, if sent from a guild.
Returns
Section titled “Returns”APIInteractionGuildMember | undefined
Inherited from
Section titled “Inherited from”Get Signature
Section titled “Get Signature”get token():
string
Defined in: interactions/BaseInteraction.ts:169
The interaction token, used to send/edit/delete responses.
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”Get Signature
Section titled “Get Signature”get user():
APIUser
Defined in: interactions/BaseInteraction.ts:149
The user who triggered the interaction (resolved from member.user in guilds, user in DMs).
Returns
Section titled “Returns”APIUser
Inherited from
Section titled “Inherited from”userId
Section titled “userId”Get Signature
Section titled “Get Signature”get userId():
string|undefined
Defined in: interactions/BaseInteraction.ts:144
The ID of the user who triggered the interaction.
Returns
Section titled “Returns”string | undefined
Inherited from
Section titled “Inherited from”version
Section titled “version”Get Signature
Section titled “Get Signature”get version():
1
Defined in: interactions/BaseInteraction.ts:184
Discord’s interaction payload version (always 1).
Returns
Section titled “Returns”1
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”deferReply()
Section titled “deferReply()”deferReply(
forceEphemeral?):Promise<RESTPostAPIInteractionCallbackWithResponseResult>
Defined in: interactions/BaseInteraction.ts:296
Acknowledges the interaction without sending an initial response, showing a “thinking” state.
Use editReply afterwards to send the actual response, within the 15-minute interaction token lifetime.
Parameters
Section titled “Parameters”forceEphemeral?
Section titled “forceEphemeral?”boolean = true
Whether the eventual response should be ephemeral. Defaults to true.
Returns
Section titled “Returns”Promise<RESTPostAPIInteractionCallbackWithResponseResult>
Inherited from
Section titled “Inherited from”deferUpdate()
Section titled “deferUpdate()”deferUpdate():
Promise<RESTPostAPIInteractionCallbackWithResponseResult>
Defined in: interactions/BaseInteraction.ts:321
Defers the update of a component interaction.
Returns
Section titled “Returns”Promise<RESTPostAPIInteractionCallbackWithResponseResult>
A promise that resolves when the update is deferred
Responding to a component interaction via the deferUpdate() method acknowledges the interaction and resets the message state.
This method can be used to suppress the need for further responses, however it’s encouraged to provide meaningful feedback to users via an update() or ephemeral reply() at least.
Once deferUpdate() has been called, future messages can be sent by calling followUp() or edits can be made by calling editReply() on the component interaction.
Example flow:
- User clicks a button.
- Bot calls
deferUpdate()to acknowledge the interaction. - Bot performs some processing.
- Bot calls
editReply()to update the original message.
Inherited from
Section titled “Inherited from”CommandInteraction.deferUpdate
deleteReply()
Section titled “deleteReply()”deleteReply(
messageId?):Promise<void>
Defined in: interactions/BaseInteraction.ts:359
Deletes the original interaction response (or a follow-up message).
Parameters
Section titled “Parameters”messageId?
Section titled “messageId?”string
The message id to delete, defaults to @original
Returns
Section titled “Returns”Promise<void>
A promise that resolves when the message is deleted
This is used to delete the original interaction response message or a follow-up message.
Inherited from
Section titled “Inherited from”CommandInteraction.deleteReply
editReply()
Section titled “editReply()”editReply(
options,messageId?):Promise<APIMessage>
Defined in: interactions/BaseInteraction.ts:336
Edits the original interaction response.
Parameters
Section titled “Parameters”options
Section titled “options”string | InteractionResponseCallbackData
The options to edit the message with
messageId?
Section titled “messageId?”string = "@original"
The message id to edit, defaults to @original
Returns
Section titled “Returns”Promise<APIMessage>
The edited message
This is used to edit the original interaction response message.
Before using this method, the interaction needs to be replied to first before using this method - with reply, deferReply or update.
Inherited from
Section titled “Inherited from”followUp()
Section titled “followUp()”followUp(
options,forceEphemeral?):Promise<APIMessage>
Defined in: interactions/BaseInteraction.ts:397
Sends a follow-up message to the interaction.
Parameters
Section titled “Parameters”options
Section titled “options”string | InteractionResponseCallbackData
The options to send the follow-up message with
forceEphemeral?
Section titled “forceEphemeral?”boolean = false
Whether to force the message to be ephemeral
Returns
Section titled “Returns”Promise<APIMessage>
The sent follow-up message
This is used to send additional messages after the initial interaction response.
Inherited from
Section titled “Inherited from”getAppEntitlements()
Section titled “getAppEntitlements()”getAppEntitlements():
APIEntitlement[]
Defined in: interactions/BaseInteraction.ts:207
Returns entitlements belonging to this interaction’s application.
Returns
Section titled “Returns”APIEntitlement[]
Inherited from
Section titled “Inherited from”CommandInteraction.getAppEntitlements
guildHavePremium()
Section titled “guildHavePremium()”guildHavePremium():
boolean
Defined in: interactions/BaseInteraction.ts:212
Whether the guild this interaction was sent from currently has an active, non-expired entitlement.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”CommandInteraction.guildHavePremium
inDM()
Section titled “inDM()”inDM():
this is BaseInteraction<ApplicationCommand, BaseInteractionContext> & { guild: undefined; guild_id: undefined; guild_locale: undefined }
Defined in: interactions/BaseInteraction.ts:202
Type guard narrowing guild_id/guild/guild_locale to undefined when the interaction was sent from a DM.
Returns
Section titled “Returns”this is BaseInteraction<ApplicationCommand, BaseInteractionContext> & { guild: undefined; guild_id: undefined; guild_locale: undefined }
Inherited from
Section titled “Inherited from”inGuild()
Section titled “inGuild()”inGuild():
this is BaseInteraction<ApplicationCommand, BaseInteractionContext> & { guild: APIPartialInteractionGuild; guild_id: string; guild_locale: Locale }
Defined in: interactions/BaseInteraction.ts:197
Type guard narrowing guild_id/guild/guild_locale to defined when the interaction was sent from a guild.
Returns
Section titled “Returns”this is BaseInteraction<ApplicationCommand, BaseInteractionContext> & { guild: APIPartialInteractionGuild; guild_id: string; guild_locale: Locale }
Inherited from
Section titled “Inherited from”isAutocomplete()
Section titled “isAutocomplete()”isAutocomplete():
this is AutocompleteInteraction<Context> & { type: ApplicationCommandAutocomplete }
Defined in: interactions/BaseInteraction.ts:490
Type guard: whether this is an autocomplete request for a slash command option.
Returns
Section titled “Returns”this is AutocompleteInteraction<Context> & { type: ApplicationCommandAutocomplete }
Inherited from
Section titled “Inherited from”CommandInteraction.isAutocomplete
isButton()
Section titled “isButton()”isButton():
this is ButtonInteraction<Context>
Defined in: interactions/BaseInteraction.ts:460
Type guard: whether this is a button click interaction.
Returns
Section titled “Returns”this is ButtonInteraction<Context>
Inherited from
Section titled “Inherited from”isChannelSelect()
Section titled “isChannelSelect()”isChannelSelect():
this is ChannelSelectInteraction<Context>
Defined in: interactions/BaseInteraction.ts:485
Type guard: whether this is a channel select menu interaction.
Returns
Section titled “Returns”this is ChannelSelectInteraction<Context>
Inherited from
Section titled “Inherited from”CommandInteraction.isChannelSelect
isChatInputCommand()
Section titled “isChatInputCommand()”isChatInputCommand():
this is ChatInputCommandInteraction<Context>
Defined in: interactions/BaseInteraction.ts:421
Type guard: whether this is a chat input (slash) command interaction.
Returns
Section titled “Returns”this is ChatInputCommandInteraction<Context>
Inherited from
Section titled “Inherited from”CommandInteraction.isChatInputCommand
isCommand()
Section titled “isCommand()”isCommand():
this is CommandInteraction<ApplicationCommandType, Context>
Defined in: interactions/BaseInteraction.ts:416
Type guard: whether this is an application command interaction (slash command or context menu command).
Returns
Section titled “Returns”this is CommandInteraction<ApplicationCommandType, Context>
Inherited from
Section titled “Inherited from”isJSONEncodable()
Section titled “isJSONEncodable()”
protectedisJSONEncodable(obj):obj is JSONEncodable<unknown>
Defined in: interactions/BaseInteraction.ts:188
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”obj is JSONEncodable<unknown>
Inherited from
Section titled “Inherited from”CommandInteraction.isJSONEncodable
isMentionableSelect()
Section titled “isMentionableSelect()”isMentionableSelect():
this is MentionableSelectInteraction<Context>
Defined in: interactions/BaseInteraction.ts:480
Type guard: whether this is a mentionable (user + role) select menu interaction.
Returns
Section titled “Returns”this is MentionableSelectInteraction<Context>
Inherited from
Section titled “Inherited from”CommandInteraction.isMentionableSelect
isMessageComponent()
Section titled “isMessageComponent()”isMessageComponent():
this is MessageComponentInteraction<Context, MessageComponentType>
Defined in: interactions/BaseInteraction.ts:455
Type guard: whether this is a message component interaction (button or select menu).
Returns
Section titled “Returns”this is MessageComponentInteraction<Context, MessageComponentType>
Inherited from
Section titled “Inherited from”CommandInteraction.isMessageComponent
isMessageContextCommand()
Section titled “isMessageContextCommand()”isMessageContextCommand():
this is MessageContextInteraction<Context>
Defined in: interactions/BaseInteraction.ts:437
Type guard: whether this is a message context menu command interaction.
Returns
Section titled “Returns”this is MessageContextInteraction<Context>
Inherited from
Section titled “Inherited from”CommandInteraction.isMessageContextCommand
isMessageModal()
Section titled “isMessageModal()”isMessageModal():
this is ModalInteraction<Context & { message: APIMessage }>
Defined in: interactions/BaseInteraction.ts:450
Type guard: whether this is a modal submit interaction that opened from a message (not a slash command).
Returns
Section titled “Returns”this is ModalInteraction<Context & { message: APIMessage }>
Inherited from
Section titled “Inherited from”CommandInteraction.isMessageModal
isModal()
Section titled “isModal()”isModal():
this is ModalInteraction<BaseInteractionContext>
Defined in: interactions/BaseInteraction.ts:445
Type guard: whether this is a modal submit interaction.
Returns
Section titled “Returns”this is ModalInteraction<BaseInteractionContext>
Inherited from
Section titled “Inherited from”isOfType()
Section titled “isOfType()”isOfType<
T>(type):this is CommandInteraction<T, Context>
Defined in: interactions/CommandInteraction.ts:33
Type guard narrowing commandType to the given application command type.
Type Parameters
Section titled “Type Parameters”T extends ApplicationCommandType
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”this is CommandInteraction<T, Context>
Inherited from
Section titled “Inherited from”isRoleSelect()
Section titled “isRoleSelect()”isRoleSelect():
this is RoleSelectInteraction<Context>
Defined in: interactions/BaseInteraction.ts:475
Type guard: whether this is a role select menu interaction.
Returns
Section titled “Returns”this is RoleSelectInteraction<Context>
Inherited from
Section titled “Inherited from”CommandInteraction.isRoleSelect
isStringSelect()
Section titled “isStringSelect()”isStringSelect():
this is StringSelectInteraction<Context>
Defined in: interactions/BaseInteraction.ts:465
Type guard: whether this is a string select menu interaction.
Returns
Section titled “Returns”this is StringSelectInteraction<Context>
Inherited from
Section titled “Inherited from”CommandInteraction.isStringSelect
isUserContextCommand()
Section titled “isUserContextCommand()”isUserContextCommand():
this is UserContextInteraction<Context>
Defined in: interactions/BaseInteraction.ts:429
Type guard: whether this is a user context menu command interaction.
Returns
Section titled “Returns”this is UserContextInteraction<Context>
Inherited from
Section titled “Inherited from”CommandInteraction.isUserContextCommand
isUserSelect()
Section titled “isUserSelect()”isUserSelect():
this is UserSelectInteraction<Context>
Defined in: interactions/BaseInteraction.ts:470
Type guard: whether this is a user select menu interaction.
Returns
Section titled “Returns”this is UserSelectInteraction<Context>
Inherited from
Section titled “Inherited from”CommandInteraction.isUserSelect
reply()
Section titled “reply()”reply(
options,forceEphemeral?):Promise<RESTPostAPIInteractionCallbackWithResponseResult>
Defined in: interactions/BaseInteraction.ts:273
Sends the initial response to the interaction.
Parameters
Section titled “Parameters”options
Section titled “options”string | InteractionResponseCallbackData
The message content, or a string shorthand for { content: options }
forceEphemeral?
Section titled “forceEphemeral?”boolean = true
Whether to force the response to be ephemeral (visible only to the invoking user). Defaults to true.
Returns
Section titled “Returns”Promise<RESTPostAPIInteractionCallbackWithResponseResult>
The created interaction response, including the created message.
Inherited from
Section titled “Inherited from”showModal()
Section titled “showModal()”showModal(
data):Promise<undefined>
Defined in: interactions/ModalCapableInteraction.ts:16
Responds to the interaction with a modal.
Parameters
Section titled “Parameters”ModalInteractionResponseCallbackData | ModalBuilder
The modal data to send
Returns
Section titled “Returns”Promise<undefined>
Inherited from
Section titled “Inherited from”toSnakeCase()
Section titled “toSnakeCase()”
protectedtoSnakeCase<T>(obj):T
Defined in: interactions/BaseInteraction.ts:192
Type Parameters
Section titled “Type Parameters”T = unknown
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”T
Inherited from
Section titled “Inherited from”CommandInteraction.toSnakeCase
update()
Section titled “update()”update(
options):Promise<RESTPostAPIInteractionCallbackWithResponseResult>
Defined in: interactions/BaseInteraction.ts:374
Updates the original interaction response.
Parameters
Section titled “Parameters”options
Section titled “options”string | InteractionResponseCallbackData
The options to update the message with
Returns
Section titled “Returns”Promise<RESTPostAPIInteractionCallbackWithResponseResult>
The updated message
This is mainly used for component interactions where you want to update the message the component is attached to OR for moodal submit interactions to update the message that opened the modal.
After calling this method, the interaction is considered replied and you need to use editReply to edit the original response.
Inherited from
Section titled “Inherited from”userHavePremium()
Section titled “userHavePremium()”userHavePremium():
boolean
Defined in: interactions/BaseInteraction.ts:222
Whether the user who triggered this interaction currently has an active, non-expired entitlement.
Returns
Section titled “Returns”boolean
