SelectHandler
Base class for a select menu handler.
Pass the select kind first and the customId definitions second, the same order as @SelectMenuRoute@SelectMenuRoute, so this.eventthis.event and this.event.valuesthis.event.values are narrowed to that kind. Read this.paramsthis.params for a single route or this.matchthis.match for several.
abstract class SelectHandler<
Kind extends SelectMenuKind,
Defs extends readonly AnyCustomId[],
Cache extends CacheType = "cached"
> extends ComponentHandler<SelectMenuInteractionFor<Kind, Cache>, Defs>abstract class SelectHandler<
Kind extends SelectMenuKind,
Defs extends readonly AnyCustomId[],
Cache extends CacheType = "cached"
> extends ComponentHandler<SelectMenuInteractionFor<Kind, Cache>, Defs>Member visibility
Filter class members by access level.
constructor
Constructs a new instance of the InteractionHandlerInteractionHandler class
Inherited from:InteractionHandler
Kind
The select kind from SelectMenuKindSelectMenuKind, e.g. SelectMenuKind.UserSelectMenuKind.User.
Kind extends SelectMenuKindKind extends SelectMenuKindDefs
The customId definitions this handler decodes, e.g. [typeof AssignId][typeof AssignId].
Defs extends readonly AnyCustomId[]Defs extends readonly AnyCustomId[]Cache
The interaction cache state, 'cached''cached' by default.
- optional
__componentDefs
readonly __componentDefs: Defsreadonly __componentDefs: DefsInherited from:ComponentHandler
core
Inherited from:BaseHandler
event
protected readonly event: ValidEventprotected readonly event: ValidEventInherited from:BaseHandler
logger
Inherited from:BaseHandler
params
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>Inherited from:ComponentHandler
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
match()
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.
armsOne handler per registered route, keyed by prefix.
Inherited from:ComponentHandler