SelectMenuHandler
Base class for a select menu handler on the HTTP transport.
Pass the select kind first and the customId definitions second, the same order as @SelectMenuRoute@SelectMenuRoute, so this.event.datathis.event.data and its valuesvalues/resolvedresolved are narrowed to that kind. Read this.paramsthis.params for a single route or this.matchthis.match for several, and reply through the handler members or rewrite the source message with this.updatethis.update.
abstract class SelectMenuHandler<
Kind extends SelectMenuKind,
Defs extends readonly AnyCustomId[]
> extends ComponentHandler<SelectMenuInteractionFor<Kind>, Defs>abstract class SelectMenuHandler<
Kind extends SelectMenuKind,
Defs extends readonly AnyCustomId[]
> extends ComponentHandler<SelectMenuInteractionFor<Kind>, Defs>Member visibility
Filter class members by access level.
constructor
Constructs a new instance of the InteractionHandlerInteractionHandler class
InteractionHandler(
event: Event,
core: Core,
dispatch?: DispatchContext
)InteractionHandler(
event: Event,
core: Core,
dispatch?: DispatchContext
)Inherited from:InteractionHandler
Showing members with Protected visibility and higher.
Properties
Methods
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[]params
The decoded params of the single route this handler is registered for.
Reading this decodes this.event.data.custom_idthis.event.data.custom_id once (cached after the first read) and throws StaleCustomIdStaleCustomId or InvalidCustomIdInvalidCustomId when the wire no longer matches the current shape, which the dispatcher 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
buildSender()
protected buildSender(
event: Event,
core: Core,
routeId: string
): ReplySenderprotected buildSender(
event: Event,
core: Core,
routeId: string
): ReplySenderInherited from:RepliableHandler
deferUpdate()
Acknowledge the component without changing the source message.
Inherited from:ComponentHandler
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 cover every registered route prefix, checked at compile time, and a prefix unmatched at runtime throws CustomIdMatchArmMissingCustomIdMatchArmMissing. Decoding runs before any arm, so a stale or corrupt wire throws before an arm body executes.
armsOne callback per registered route, keyed by prefix.
Inherited from:ComponentHandler
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<
Exclude<Repliables, APIModalSubmitInteraction>
>,
modal: ModalLike
): Promise<void>protected async showModal(
this: InteractionHandler<
Exclude<Repliables, APIModalSubmitInteraction>
>,
modal: ModalLike
): Promise<void>Inherited from:InteractionHandler
update()
Rewrite the source message this component interaction came from.
protected async update(
response: ReplyResponse | string
): Promise<SentMessage>protected async update(
response: ReplyResponse | string
): Promise<SentMessage>Inherited from:ComponentHandler