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
Inherited from:InteractionHandler
Kind
ApplicationCommandType.UserApplicationCommandType.User or ApplicationCommandType.MessageApplicationCommandType.Message.
Kind extends ContextMenuKindKind extends ContextMenuKindCache
The interaction cache state, 'cached''cached' by default.
core
Inherited from:BaseHandler
event
protected readonly event: ValidEventprotected readonly event: ValidEventInherited from:BaseHandler
logger
Inherited from:BaseHandler
protected targetMember: TargetMemberFor<Kind, Cache>protected targetMember: TargetMemberFor<Kind, Cache>execute()
Holds the main logic of your handler. The dispatcher calls it after the handler's gates pass, so a gate that refuses stops execute()execute() from running.
Inherited from:BaseHandler