Skip to content
Classcorev0.12.0

RepliableHandler

Shared base the repliable handlers on both transports extend. Defines the reply members over one sender. The dispatch run builds that sender and passes it to the handler and each middleware.

abstract class RepliableHandler<
    Event,
    TCore extends CoreBase,
    TMessage extends { id: string },
    TNative,
    TSender extends BaseReplySender<TMessage, TNative>
> extends BaseHandler<Event, TCore>

Member visibility

Filter class members by access level.

constructor

Constructs a new instance of the RepliableHandler class

protected RepliableHandler(
    event: Event,
    core: TCore,
    dispatch: DispatchContext,
    sender: TSender
)

Showing members with Protected visibility and higher.

Event

The repliable interaction type this handler processes

Event

TCore

The transport's Core

TCore extends CoreBase

TMessage

The transport's created-message lens

TMessage extends { id: string; }

TNative

The transport's own file forms, beyond the portable ReplyFile

TNative

TSender

The transport's reply sender

TSender extends BaseReplySender<TMessage, TNative>

dispatch

The bag for this dispatch. Each interaction gets its own. Every handler for one event shares a single bag.

protected readonly dispatch: DispatchContext

Inherited from:BaseHandler

event

protected readonly event: Event

Inherited from:BaseHandler

route

The route that started this dispatch. Each handler base narrows it to its own routes.

protected readonly route: string

Inherited from:BaseHandler

sender

The reply surface for this interaction. Pass the handler to reply from outside its class.

public readonly sender: TSender

defer()

Show a "thinking" placeholder, then fill it later with edit.

protected async defer(opts?: DeferOpts): Promise<void>

delete()

Delete the initial reply or deferred placeholder. Pass a target to delete a message a prior send returned.

protected async delete(target?: TMessage): Promise<void>

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>

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>

send()

Routes to reply, followUp, or edit based on the current ack state.

protected async send(
    response: ReplyResponse<TNative> | string,
    opts?: SendOpts
): Promise<TMessage>