Skip to content
Classcorev0.10.0

BaseReplySender

Tracks acknowledgement state and throws a translated SeedcordError on an illegal verb before any transport call. Every verb runs the legality check, calls the transport's wire writer, then updates the state and the ack trace. Each transport binds TMessage to its own created-message type and supplies the writers.

abstract class BaseReplySender<
    TMessage extends { id: string },
    TNative = never
>

Member visibility

Filter class members by access level.

constructor

Constructs a new instance of the BaseReplySender class

protected BaseReplySender(
    telemetry: ReplyTelemetry,
    initialState?: AckState
)

TMessage

TMessage extends { id: string; }

routeId

protected routeId: string

guardModalSource()

protected guardModalSource(): void

remember()

protected remember(created: TMessage): TMessage

send()

Routes to the verb the current ack state permits. Every state has a route, so the illegal-ack throw is unreachable.

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

update()

After a deferUpdate the state stays deferred-update. Calling this again rewrites. The returned message is the source message, editable only through a bare update or edit. A targeted edit or delete of it throws the foreign-target error.

public async update(
    response: ReplyResponse<TNative> | string
): Promise<TMessage>

writeDeferUpdate()

protected abstract writeDeferUpdate(): Promise<void>

writeDeleteOriginal()

protected abstract writeDeleteOriginal(): Promise<void>

writeDeleteTarget()

protected abstract writeDeleteTarget(
    targetId: string
): Promise<void>