InteractionHandler
Shared base the typed interaction handlers extend.
For a handler with a route, extend SlashHandler, UserContextMenuHandler,
MessageContextMenuHandler, ButtonHandler, ModalHandler, or one of the select menu
bases. Extend this class directly only for interactions.unhandled, which answers every interaction
without a handler except autocomplete. This class adds showModal on top of the reply members those
bases share.
abstract class InteractionHandler<
Repliable extends Repliables
> extends RepliableHandler<Repliable>Member visibility
Filter class members by access level.
InteractionHandler(
event: Repliable,
core: Core,
dispatch: DispatchContext,
sender: ReplySender
)Repliable
The interaction type this handler processes
Repliable extends Repliablescore
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
route
The route that started this dispatch. Each handler base narrows it to its own routes.
protected readonly route: stringInherited from:BaseHandler
sender
The reply surface for this interaction. Pass the handler to reply from outside its class.
readonly sender: TSenderInherited from:RepliableHandler
protected 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. After defer, the first one fills the placeholder.
protected async followUp(
response: ReplyResponse<TNative> | string,
opts?: SendOpts
): Promise<TMessage>Inherited from:RepliableHandler
reply()
Send the initial response, exactly once.
protected async reply(
response: ReplyResponse<TNative> | string,
opts?: SendOpts
): Promise<TMessage>Inherited from:RepliableHandler
protected async send(
response: ReplyResponse<TNative> | string,
opts?: SendOpts
): Promise<TMessage>Inherited from:RepliableHandler
protected async showModal(
this: InteractionHandler<NonModalInteraction>,
modal: ModalLike
): Promise<void>