Callback data builder, inspired by aiogram.

This can be used to simplify management of different callbacks.

Learn more in the docs

Type Parameters

  • T extends string

Constructors

Properties

Methods

Constructors

Properties

prefix: string

Prefix for the data. Use something unique across your bot.

sep: string = ':'

Methods

  • Create a filter for this callback data.

    You can either pass an object with field names as keys and values as strings or regexes, which will be compiled to a RegExp, or a function that will be called with the parsed data. Note that the strings will be passed to RegExp directly, so you may want to escape them.

    When using a function, you can either return a boolean, or an object with field names as keys and values as strings or regexes. In the latter case, the resulting object will be matched against the parsed data the same way as if you passed it directly.

    Type Parameters

    Parameters

    Returns UpdateFilter<Update, {
        match: Record<T, string>;
    }>