UNPKG

telebot

Version:

The easy way to write Telegram bots.

57 lines (56 loc) 2 kB
import { Message, TelegramBotToken, UpdateTypes } from "./telegram"; import { RequireFields } from "./utilites"; import { TeleBotDevOptions } from "../telebot/devkit"; export declare type TeleBotOptions = { token: TelegramBotToken; botAPI?: string; polling?: Partial<TeleBotPolling>; webhook?: WebhookOptions; allowedUpdates?: UpdateTypes | undefined; debug?: boolean | TeleBotDevOptions; }; export declare type WebhookOptions = { url: string; host?: string; port?: number; key?: string; cert?: string; }; export declare type TeleBotFlags = { isRunning: boolean; canFetch: boolean; waitEvents: boolean; }; export declare type TeleBotPolling = { offset: number; interval: number | false; timeout: number; limit: number; retryTimes: number; retryTimeout: number; }; export declare enum TeleBotScenario { Reconnect = "reconnect", Restart = "restart", Terminate = "terminate", Pass = "pass" } export declare type TeleBotRunningInstanceScenario = TeleBotScenario.Restart | TeleBotScenario.Terminate | TeleBotScenario.Pass; export declare type TelegramFetchErrorScenario = TeleBotScenario.Reconnect | TeleBotScenario.Terminate; export declare type TeleBotEventNames = { text: RequireFields<Message, "text">; audio: RequireFields<Message, "audio">; video: RequireFields<Message, "video">; game: RequireFields<Message, "game">; photo: RequireFields<Message, "photo">; sticker: RequireFields<Message, "sticker">; voice: RequireFields<Message, "voice">; videoNote: RequireFields<Message, "video_note">; location: RequireFields<Message, "location">; poll: RequireFields<Message, "poll">; venue: RequireFields<Message, "venue">; }; export declare type TeleBotEventProcessorContext = { unsubscribe: Function; }; export declare type TeleBotEventProcessor<T extends keyof TeleBotEventNames> = (data: TeleBotEventNames[T], context: TeleBotEventProcessorContext) => any;