UNPKG

agents

Version:

A home for your AI agents

107 lines (105 loc) 3.39 kB
import { F as ChannelMessageSurface, d as ChannelRoute, k as ChannelIngress, n as Channel, u as ChannelMessage } from "../channel-Bnm4S7T2.js"; //#region src/channels/adapters/telegram.d.ts type TelegramUser = { id: number; is_bot: boolean; first_name: string; last_name?: string; username?: string; [key: string]: unknown; }; type TelegramChat = { id: number; type: "private" | "group" | "supergroup" | "channel"; title?: string; username?: string; first_name?: string; last_name?: string; [key: string]: unknown; }; type TelegramMessage = { message_id: number; date: number; chat: TelegramChat; message_thread_id?: number; from?: TelegramUser; sender_chat?: TelegramChat; text?: string; edit_date?: number; reply_to_message?: TelegramMessage; [key: string]: unknown; }; /** Authenticated JSON body delivered by a Telegram webhook. */ type TelegramUpdate = { update_id: number; message?: TelegramMessage; edited_message?: TelegramMessage; [key: string]: unknown; }; type TelegramMessageSurface = ChannelMessageSurface< string, { chatId: string; botUserId?: number; messageThreadId?: number; replyToMessageId?: number; } >; /** Configuration for a Telegram Channel. */ type TelegramChannelOptions = { /** Bot token issued by BotFather. */ botToken: string /** Telegram Bot API origin. @default "https://api.telegram.org" */; apiBaseUrl?: string /** Maximum text length accepted by this route. @default 4096 */; maxLength?: number /** Project the canonical message into Telegram text. */; toText?: ( message: ChannelMessage ) => string /** Parse mode for caller-formatted delivery text. */; parseMode?: "HTML" | "MarkdownV2"; /** * Smallest gap between `sendMessageDraft` previews. Snapshots produced * inside one interval are replaced rather than sent. @default 500 */ streamIntervalMs?: number /** Select an application route from the event, raw update, and Host context. */; route?: ChannelRoute<TelegramUpdate> /** Add secret-verified Telegram webhook ingress to the returned Channel. */; webhook?: { secretToken: string /** Exact webhook pathname accepted by this ingress. @default "/webhooks/telegram" */; path?: string; } /** Override fetch for testing or custom network routing. */; fetch?: typeof globalThis.fetch; }; type TelegramWebhookOptions = { /** Telegram webhook secret configured through setWebhook. */ secretToken: string /** Exact webhook pathname accepted by this ingress. @default "/webhooks/telegram" */; path?: string; /** * Numeric user id of this bot, used to prove that an approval reply answers * a message this bot sent. Without it, marker replies stay ordinary * messages because their provenance cannot be established. */ botUserId?: number; }; /** Create dependency-free Telegram webhook ingress for a destination chat. */ declare function telegramWebhook( options: TelegramWebhookOptions ): ChannelIngress<TelegramUpdate>; /** Create a configured Telegram Bot API Channel. */ declare function telegram( options: TelegramChannelOptions ): Channel<TelegramUpdate>; //#endregion export { TelegramChannelOptions, TelegramChat, TelegramMessage, TelegramMessageSurface, TelegramUpdate, TelegramUser, TelegramWebhookOptions, telegram, telegramWebhook }; //# sourceMappingURL=telegram.d.ts.map