abstract class UserContextMenuHandler<
Names extends NamesFor<ApplicationCommandType.User>
> extends InteractionHandler<APIUserApplicationCommandInteraction>Member visibility
Filter class members by access level.
constructor
Constructs a new instance of the InteractionHandler class
InteractionHandler(
event: Event,
core: Core,
dispatch?: DispatchContext
)Inherited from:InteractionHandler
Showing members with Protected visibility and higher.
Names
One or more command names from the generated user registry.
Names extends NamesFor<ApplicationCommandType.User>api
Typed Discord REST API (@discordjs/core/http-only) over core.rest, one instance per core. The interaction callbacks on api.interactions bypass the reply surface. The no-raw-interaction-acks rule flags them in handler classes.
protected api: APIInherited from:RepliableHandler
protected commandName: Namescore
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
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 target: APIUserprotected targetMember: APIInteractionDataResolvedGuildMember | nullbuildSender()
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
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
Run the arm for whichever command fired. Use this only when the handler is registered for several names.
Provide one arm per registered name, keyed by the name Discord shows in the right-click menu. Each arm receives the clicked user and that user's guild member. The arms must cover every name in the generic. A missing name or an unknown key is a compile error.
protected async match<Ret>(
arms: UserMenuArms<Names, Ret>
): Promise<Ret>armsOne handler per registered command name.
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<
Exclude<Repliables, APIModalSubmitInteraction>
>,
modal: ModalLike
): Promise<void>Inherited from:InteractionHandler