/** Raw Telegram update (subset of the full schema we use). */ export interface TelegramUpdate { update_id: number; message?: TelegramMessage; callback_query?: TelegramCallbackQuery; } export interface TelegramMessage { message_id: number; chat: { id: number; type: string; title?: string; }; from?: { id: number; is_bot?: boolean; first_name?: string; username?: string; }; text?: string; caption?: string; reply_to_message?: TelegramMessage; entities?: { type: string; offset: number; length: number; }[]; photo?: { file_id: string; file_unique_id: string; width: number; height: number; }[]; document?: { file_id: string; file_name?: string; }; voice?: { file_id: string; }; video?: { file_id: string; }; audio?: { file_id: string; }; sticker?: { file_id: string; }; } export interface TelegramCallbackQuery { id: string; from: { id: number; username?: string; }; message?: TelegramMessage; data?: string; } /** Options accepted by `sendMessage` (parse_mode, reply_markup, …). */ export interface SendMessageOptions { parse_mode?: "HTML" | "MarkdownV2"; reply_to_message_id?: number; reply_markup?: unknown; disable_web_page_preview?: boolean; } export interface TelegramClientConfig { botToken: string; /** getUpdates polling timeout (seconds). Default 50. */ pollingTimeoutSeconds?: number; /** getUpdates long-poll gap after an error. Default 3s. */ retryDelayMs?: number; /** HTTP timeout for each API call (ms). Default 15s. */ timeoutMs?: number; /** Optional base URL override (e.g. for a local Bot API server). */ baseUrl?: string; } /** Normalized photo/file location after download. */ export interface DownloadedResource { path: string; kind: "image" | "file"; error?: string; } export declare class TelegramClient { readonly config: TelegramClientConfig; private offset; constructor(config: TelegramClientConfig); private base; private call; /** Long-poll for new updates. Does NOT advance the offset — the caller confirms each update via {@link confirmOffset} after processing it, so a failure mid-batch never loses the remaining updates. */ pollUpdates(): Promise; /** Advance the polling offset past `updateId` — call only after the update was fully handled. */ confirmOffset(updateId: number): void; /** Skip all pending updates (used on startup so we don't replay history). */ resetOffset(): Promise; /** Fetch the bot's own identity (id + username) — used for @-mention / reply-to checks. */ getMe(): Promise<{ id: number; username?: string; }>; sendMessage(chatId: number | string, text: string, opts?: SendMessageOptions): Promise; editMessageText(chatId: number | string, messageId: number, text: string, opts?: SendMessageOptions): Promise; sendPhoto(chatId: number | string, photoPath: string, caption?: string, opts?: SendMessageOptions): Promise; sendDocument(chatId: number | string, documentPath: string, opts?: SendMessageOptions): Promise; answerCallbackQuery(callbackQueryId: string, text?: string): Promise; /** Download a file (photo / document / …) by file_id into a temp dir; returns the local path. */ downloadFile(fileId: string, dir: string, fileName?: string): Promise; /** Convenience: download to the OS temp dir. */ downloadFileToTemp(fileId: string, fileName?: string): Promise; } /** Pick the Bot API method for a local file (sendPhoto vs sendDocument). */ export declare function telegramFileMethod(filename: string): "sendPhoto" | "sendDocument"; /** Strip path separators / control chars from a downloaded file's name. */ export declare function sanitizeFileName(name: string): string; //# sourceMappingURL=client.d.ts.map