ContextMenuHandler
Base class for a context-menu command handler (right-click a user or a message).
Pass the kind from discord.jsdiscord.js's ApplicationCommandType as the generic, the same value as @ContextMenuRoute@ContextMenuRoute. Read the right-clicked entity from this.targetthis.target, a UserUser for a user menu and a MessageMessage for a message menu. Context menus carry no options, so a handler registered for several names reads this.targetthis.target uniformly with no per-name branch.
abstract class ContextMenuHandler<
Kind extends ContextMenuKind,
Cache extends CacheType = "cached"
> extends InteractionHandler<InteractionFor<Kind, Cache>>abstract class ContextMenuHandler<
Kind extends ContextMenuKind,
Cache extends CacheType = "cached"
> extends InteractionHandler<InteractionFor<Kind, Cache>>Member visibility
Filter class members by access level.
constructor
Constructs a new instance of the InteractionHandlerInteractionHandler class
InteractionHandler(
event: Repliable,
core: Core,
dispatch?: DispatchContext
)InteractionHandler(
event: Repliable,
core: Core,
dispatch?: DispatchContext
)Inherited from:InteractionHandler
Showing members with Protected visibility and higher.
Properties
Methods
Kind
ApplicationCommandType.UserApplicationCommandType.User or ApplicationCommandType.MessageApplicationCommandType.Message.
Kind extends ContextMenuKindKind extends ContextMenuKindCache
The interaction cache state, 'cached''cached' by default.
protected targetMember: TargetMemberFor<Kind, Cache>protected targetMember: TargetMemberFor<Kind, Cache>buildSender()
protected buildSender(
event: Event,
_core: Core,
routeId: string
): ReplySenderprotected buildSender(
event: Event,
_core: Core,
routeId: string
): ReplySenderInherited from:RepliableHandler
showModal()
Open a modal. Must be the initial response to this interaction. The modal kind rejects this call at compile time (Discord forbids a modal in response to a modal).
protected async showModal(
this: InteractionHandler<NonModalInteraction>,
modal: ModalLike
): Promise<void>protected async showModal(
this: InteractionHandler<NonModalInteraction>,
modal: ModalLike
): Promise<void>Inherited from:InteractionHandler