telebot-ts API Documentation - v1.0.0
    Preparing search index...

    Class ChatBoostHandler<C, R>

    Handler for chat boost additions and removals (chat_boost and removed_chat_boost updates).

    const handler = new ChatBoostHandler(async (update, context) => {
    if (update.chat_boost) {
    console.log("Chat boosted by user:", update.chat_boost.boost.source);
    }
    });

    Type Parameters

    Hierarchy (View Summary)

    Index
    • Constructs a new ChatBoostHandler.

      Type Parameters

      • C extends CallbackContext<
            Record<string, unknown>,
            Record<string, unknown>,
            Record<string, unknown>,
        > = CallbackContext<
            Record<string, unknown>,
            Record<string, unknown>,
            Record<string, unknown>,
        >

        Type of the callback context.

      • R = unknown

        Return value type.

      Parameters

      • callback: HandlerCallback<C, R>

        Function invoked when the update matches.

      • boostTypes: number = ChatBoostHandler.ANY

        Filter mask (ADDED, REMOVED, or ANY).

      Returns ChatBoostHandler<C, R>

      ChatBoostHandler.ANY

    boostTypes: number
    callback: HandlerCallback<C, R>

    The underlying callback function to invoke on match.

    ADDED: 1

    Target only added or updated boosts (chat_boost)

    ANY: 3

    Target any boost event

    REMOVED: 2

    Target only removed boosts (removed_chat_boost)

    • Checks whether the incoming update matches the configured boost filter.

      Parameters

      • update: Update

        The update to test.

      Returns Promise<boolean>

      true if update matches.

    • Executes the registered handler callback with the given update and context.

      Parameters

      • update: Update

        The Telegram update to process.

      • context: C

        Callback context instance.

      Returns Promise<R>

      The value returned by the callback function.