abstract class UserMenuHandler<
Defs extends readonly AnyCustomId[],
Cache extends CacheType = "cached"
> extends SelectMenuHandler<UserSelectMenuInteraction<Cache>, Defs>Member visibility
Filter class members by access level.
constructor
Constructs a new instance of the InteractionHandler class
InteractionHandler(
event: Repliable,
core: Core,
dispatch?: DispatchContext
)Inherited from:InteractionHandler
Defs
The customId definitions this handler decodes, e.g. [typeof AssignId].
Defs extends readonly AnyCustomId[]Cache
The interaction cache state, 'cached' by default.
Cache extends CacheType = 'cached'core
readonly core: TCoreInherited from:BaseHandler
- optional
dispatch
protected readonly dispatch: DispatchContext | undefinedInherited from:BaseHandler
event
protected readonly event: EventInherited from:BaseHandler
logger
protected readonly logger: LoggerInherited from:BaseHandler
protected members: UserSelectMenuInteraction<Cache>['members']params
The decoded params of the single route this handler is registered for.
Reading this decodes this.event.customId once (cached after the first read) and throws StaleCustomId or InvalidCustomId 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 never. Use match instead.
protected params: SingleParams<Defs>Inherited from:ComponentHandler
routeId
protected readonly routeId: stringInherited from:RepliableHandler
sender
The reply surface for this interaction. Pass the handler to reply from outside its class.
readonly sender: TSenderInherited from:RepliableHandler
protected users: UserSelectMenuInteraction<Cache>['users']values
The values this select picked. On every kind but the string menu they are snowflake ids.
protected values: string[]Inherited from:SelectMenuHandler
buildSender()
protected buildSender(
event: Event,
core: Core,
routeId: string
): ReplySenderInherited from:RepliableHandler
defer()
Show a "thinking" placeholder, then fill it later with edit.
Inherited from:RepliableHandler
deferUpdate()
Acknowledge the component without changing the source message.
Inherited from:ComponentHandler
delete()
Delete the initial reply or deferred placeholder. Pass a target to delete a message a prior send returned.
Inherited from:RepliableHandler
edit()
Rewrite the initial reply or deferred placeholder. The targeted form rewrites a message a prior send returned.
protected async edit(
response: ReplyResponse<TNative> | string
): Promise<TMessage>Inherited from:RepliableHandler
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() from running.
Inherited from:BaseHandler
followUp()
Send a new message once the interaction is acknowledged.
protected async followUp(
response: ReplyResponse<TNative> | string,
opts?: SendOpts
): Promise<TMessage>Inherited from:RepliableHandler
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.params directly. On a multi-route handler this.params is never, leaving match as 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 CustomIdMatchArmMissing. Decoding runs before any arm, so a stale or corrupt wire throws before an arm body executes.
protected async match<Ret>(arms: MatchArms<Defs, Ret>): Promise<Ret>armsOne callback per registered route, keyed by prefix.
Inherited from:ComponentHandler
reply()
Send the initial response, exactly once.
protected async reply(
response: ReplyResponse<TNative> | string,
opts?: SendOpts
): Promise<TMessage>Inherited from:RepliableHandler
send()
Routes to reply, followUp, or edit based on the current ack state.
protected async send(
response: ReplyResponse<TNative> | string,
opts?: SendOpts
): Promise<TMessage>Inherited 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>Inherited from:InteractionHandler
update()
Rewrite the source message this component interaction came from.
protected async update(
response: GatewayReplyResponse | string
): Promise<SentMessage>Inherited from:ComponentHandler