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

    Class TelegramBot

    Class representing a telegram bot.

    Index

    Constructors

    • Create a bot

      Parameters

      • token: string

        the telegram secret token

      • Optionaloptions: { defaultCommand?: string }

        optional configuration for the bot

      Returns TelegramBot

    Properties

    api: URL

    The telegram api URL

    commands: Record<
        string,
        (ctx: TelegramExecutionContext) => Promise<Response | void>,
    > = {}

    The telegram commands record map

    currentContext: TelegramExecutionContext

    The current bot context

    defaultCommand: string = ':message'

    Default command to use when no matching command is found

    middleware: ((ctx: TelegramExecutionContext) => Promise<void | Response>)[] = []

    Middleware functions to run before handlers

    token: string

    The telegram token

    update: TelegramUpdate = ...

    The telegram update object

    webhook: Webhook = ...

    The telegram webhook object

    Methods

    • Handle a request on a given bot

      Parameters

      • request: Request

        the request to handle

      Returns Promise<Response>