abstract class UserContextMenuHandler<
Names extends NamesFor<ApplicationCommandType.User>,
Cache extends CacheType = MenuCacheFor<ApplicationCommandType.User, Names>
> extends InteractionHandler<UserContextMenuCommandInteraction<Cache>>Member visibility
Filter class members by access level.
InteractionHandler(
event: Repliable,
core: Core,
dispatch: DispatchContext,
sender: ReplySender
)Inherited from:InteractionHandler
Names
One or more command names from the generated user registry.
Names extends NamesFor<ApplicationCommandType.User>Cache
The interaction cache state. The command's contexts set it.
Cache extends CacheType = MenuCacheFor<ApplicationCommandType.User, Names>core
readonly core: TCoreInherited from:BaseHandler
dispatch
The bag for this dispatch. Each interaction gets its own. Every handler for one event shares a single bag.
protected readonly dispatch: DispatchContextInherited from:BaseHandler
event
protected readonly event: EventInherited from:BaseHandler
logger
protected readonly logger: LoggerInherited from:BaseHandler
protected readonly route: Namessender
The reply surface for this interaction. Pass the handler to reply from outside its class.
readonly sender: TSenderInherited from:RepliableHandler
protected target: Userprotected targetMember: CacheTypeReducer<Cache, GuildMember, APIInteractionGuildMember> | nullprotected user: UserInherited 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.
abstract execute(): Promisable<void>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 case for the selected command. Use this only when the handler is registered for several names.
Provide one case per registered name, keyed by the name Discord shows in the right-click menu. Each case receives the clicked user and that user's guild member, both narrowed to the cache state of that one command. The cases must cover every name in the generic. A missing name or an unknown key is a compile error.
protected async match<Ret, Cases>(
cases: OnlyCases<Cases, UserMenuCases<Names, Ret>>
): Promise<MatchResult<Ret, Cases>>casesOne handler per registered command name.
RetThe type that every case must return. Leave it out to get the union of what the cases return.
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
protected async showModal(
this: InteractionHandler<NonModalInteraction>,
modal: ModalLike
): Promise<void>Inherited from:InteractionHandler