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

    Class PurchasedPaidMediaHandler<C, R>

    Handler for purchased paid media events (purchased_paid_media updates).

    Triggered when a user buys paid media using Telegram Stars.

    const handler = new PurchasedPaidMediaHandler(async (update, context) => {
    console.log(`User ${update.effective_user?.id} bought media payload: ${update.purchased_paid_media?.paid_media_payload}`);
    });

    Type Parameters

    Hierarchy (View Summary)

    Index
    • Creates a new handler instance.

      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>

        Async function executed when this handler matches an update.

      Returns PurchasedPaidMediaHandler<C, R>

    callback: HandlerCallback<C, R>

    The underlying callback function to invoke on match.

    • Checks whether the incoming update contains a purchased_paid_media event.

      Parameters

      • update: Update

        The update to test.

      Returns Promise<boolean>

      true if update has purchased_paid_media.

    • 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.