CF Workers Telegram Bot - v11.2.1
    Preparing search index...

    Class TelegramExecutionContext

    Class representing the context of execution

    Index

    Constructors

    Properties

    api: TelegramApi = ...

    reference to TelegramApi class

    args: string[] = []

    array of arguments parsed from the message

    an instance of the telegram bot

    an instance of the telegram update

    update_type: string = ''

    string representing the type of update that was sent

    Accessors

    • get text(): string

      Get the message text from the current update

      Returns string

      The message text as a string or empty string if not available

    • get userId(): number | undefined

      Get the user ID from the current update

      Returns number | undefined

      The user ID or undefined if not available

    Methods

    • Answer a guest query

      Parameters

      • message: string

        text to reply with

      • parse_mode: string = ''

        one of HTML, MarkdownV2, Markdown, or an empty string for ascii

      Returns Promise<Response>

      Promise with the API response

    • Answer a pre-checkout query

      Parameters

      • ok: boolean

        whether the payment can proceed

      • Optionalerror_message: string

        error message if not ok

      Returns Promise<Response>

      Promise with the API response

    • Get File from telegram file_id

      Parameters

      • file_id: string

        telegram file_id

      Returns Promise<Response>

      Promise with the file response

    • Reply to the last message with text

      Parameters

      • message: string

        text to reply with

      • parse_mode: string = ''

        one of HTML, MarkdownV2, Markdown, or an empty string for ascii

      • reply: boolean = true
      • options: Record<string, number | string | boolean> = {}

        any additional options to pass to sendMessage

      Returns Promise<Response | null>

      Promise with the API response

    • Reply to an inline message with a title and content

      Parameters

      • title: string

        title to reply with

      • message: string

        message contents to reply with

      • parse_mode: string = ''

        parse mode to use

      Returns Promise<Response | null>

      Promise with the API response

    • Reply to the last message with a photo

      Parameters

      • photo: string

        url or file_id to photo

      • caption: string = ''

        photo caption

      • options: Record<string, number | string | boolean> = {}

        any additional options to pass to sendPhoto

      Returns Promise<Response | null>

      Promise with the API response

    • Reply to the last message with a video

      Parameters

      • video: string

        string to a video on the internet or a file_id on telegram

      • options: Record<string, number | string | boolean> = {}

        any additional options to pass to sendVideo

      Returns Promise<Response | null>

      Promise with the API response

    • Send an invoice for Telegram Stars

      Parameters

      • title: string

        product name

      • description: string

        product description

      • payload: string

        bot-defined invoice payload

      • amount: number

        amount of stars

      Returns Promise<Response>

      Promise with the API response

    • Send typing in a chat

      Returns Promise<Response | null>

      Promise with the API response

    • Reply to the last message with a stream of text

      Parameters

      • message: string

        text to reply with

      • draft_id: number
      • parse_mode: string = ''

        one of HTML, MarkdownV2, Markdown, or an empty string for ascii

      • options: Record<string, number | string | boolean> = {}

        any additional options to pass to sendMessage

      Returns Promise<Response>

      Promise with the API response