Skip to content
Classhttpv0.10.2

Paginator

A restart-proof paginator. Each nav button's customId encodes its full target page, so clicks are idempotent and survive a restart. A persistent @ButtonRoute on Handler dispatches the clicks.

class Paginator<Item, Prefix extends string> extends PaginatorBase<
    Item,
    Prefix,
    PageContext
>

Member visibility

Filter class members by access level.

Showing members with Protected visibility and higher.

Item

The item type, inferred from the source.

Item

Prefix

The route prefix, inferred from config.prefix.

Prefix extends string

cursor

The page cursor, pass it to your @ButtonRoute.

readonly cursor: PageCursor<Prefix>

Inherited from:PaginatorBase

Handler

The nav handler base. Extend it with an empty body and decorate it, @ButtonRoute(p.cursor).

public readonly Handler: PaginatorHandlerCtor<Prefix>

start()

Send a page through the handler's sender. The sender picks reply, edit, or followUp from its ack state.

public async start(
    handler: RepliableHandler<Repliables>,
    n?: number
): Promise<SentMessage>
Parameter: handler

The handler starting the paginator, normally this.

Parameter: n

The zero-based page to open on.