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

    Class ChosenInlineResultHandler<C, R>

    Handler for tracking results chosen by users from inline queries.

    const chosenHandler = new ChosenInlineResultHandler(async (update, context) => {
    console.log("Chosen result ID:", update.chosen_inline_result?.result_id);
    });

    Type Parameters

    Hierarchy (View Summary)

    Index
    • Constructs a new ChosenInlineResultHandler.

      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

      • callbackOrPattern:
            | string
            | RegExp
            | HandlerCallback<C, R>
            | ((resultId: string) => boolean)
            | null
            | undefined

        Callback function or string/RegExp match pattern.

      • OptionalcallbackOrPattern2: string | RegExp | HandlerCallback<C, R> | ((resultId: string) => boolean) | null

        Callback function or string/RegExp match pattern.

      Returns ChosenInlineResultHandler<C, R>

    callback: HandlerCallback<C, R>

    The underlying callback function to invoke on match.

    pattern?: string | RegExp | ((resultId: string) => boolean)

    Optional pattern or predicate string/regex matching result_id or query.

    • Checks whether the chosen inline result matches the pattern.

      Parameters

      • update: Update

        The update to test.

      Returns Promise<boolean>

      true if chosen result matches, false otherwise.

    • Populates context.matches if using a RegExp pattern and executes callback.

      Parameters

      • update: Update

        The incoming update.

      • context: C

        Callback context instance.

      Returns Promise<R>

      Result from callback execution.