ComponentHandler
Shared base the customId-routed component handlers extend.
Not a public entry point. You should be using ButtonHandlerButtonHandler, SelectMenuHandlerSelectMenuHandler, or ModalHandlerModalHandler instead. This class only carries the customId decode and route-matching plumbing those bases share, so DO NOT use it directly.
abstract class ComponentHandler<
Event extends ComponentInteraction,
Defs extends readonly AnyCustomId[]
>
extends InteractionHandler<Event>
implements HasComponentDefs<Defs>abstract class ComponentHandler<
Event extends ComponentInteraction,
Defs extends readonly AnyCustomId[]
>
extends InteractionHandler<Event>
implements HasComponentDefs<Defs>Member visibility
Filter class members by access level.
constructor
Constructs a new instance of the InteractionHandlerInteractionHandler class
Inherited from:InteractionHandler
Event
The component interaction type this handler processes
Event extends ComponentInteractionEvent extends ComponentInteractionDefs
The customId route definitions registered on the concrete handler
Defs extends readonly AnyCustomId[]Defs extends readonly AnyCustomId[]core
Inherited from:BaseHandler
event
protected readonly event: ValidEventprotected readonly event: ValidEventInherited from:BaseHandler
logger
Inherited from:BaseHandler
The decoded params of the single route this handler is registered for.
Reading this decodes this.event.customIdthis.event.customId once (cached after the first read) and throws StaleCustomIdStaleCustomId or InvalidCustomIdInvalidCustomId when the wire no longer matches the current shape, which the controller boundary turns into a reply. On a handler registered for several routes this is nevernever, so use matchmatch instead.
protected params: SingleParams<Defs>protected params: SingleParams<Defs>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
Run the arm for whichever route the component was minted from. Use this only when the handler is registered for several routes. A single-route handler reads this.paramsthis.params directly. On a multi-route handler this.paramsthis.params is nevernever, so match is the only way to read the decoded params.
Provide one arm per registered route, keyed by its prefix, and each arm receives that route's own decoded params. The arms must cover every registered def, a missing prefix or an unknown key is a compile error. Decoding runs before any arm, so a stale or corrupt wire throws before an arm body executes.