AgentOS Extensions API - v1.0.3
    Preparing search index...

    Service for interacting with Telegram Bot API

    TelegramBotService

    Index

    Constructors

    Methods

    • Answers a callback query

      Parameters

      • callbackQueryId: string

        Callback query ID

      • options: { cacheTime?: number; showAlert?: boolean; text?: string; url?: string } = {}

        Answer options

      Returns Promise<boolean>

      Success status

    • Initializes the bot connection.

      By default the bot is created in send-only mode (no polling, no webhook). This avoids taking over another process that may already be polling the same bot token — which would cause Telegram to kick the existing poller and potentially trigger unwanted side-effects such as the other process re-registering its own command menu.

      Polling / webhooks are only started when explicitly configured.

      Returns Promise<void>

    • Registers a message handler

      Parameters

      • pattern: string | RegExp

        Message pattern to match

      • handler: (msg: Message) => void

        Handler function

      Returns void

    • Pins a message in a chat

      Parameters

      • chatId: string | number

        Chat ID

      • messageId: number

        Message ID to pin

      • disableNotification: boolean = false

        Disable notification

      Returns Promise<boolean>

      Success status

    • Sends a document

      Parameters

      • chatId: string | number

        Chat ID

      • document: string | Buffer

        Document URL or buffer

      • options: {
            caption?: string;
            filename?: string;
            parseMode?: "Markdown" | "HTML";
            replyToMessageId?: number;
        } = {}

        Additional options

      Returns Promise<Message>

      Sent message

    • Sends a photo

      Parameters

      • chatId: string | number

        Chat ID

      • photo: string | Buffer

        Photo URL or buffer

      • options: { caption?: string; parseMode?: "Markdown" | "HTML"; replyToMessageId?: number } = {}

        Additional options

      Returns Promise<Message>

      Sent message