The Telegram Bot Framework.
Go to Latest
interface PollingOptions
import { type PollingOptions } from "";

Options that can be specified when running the bot via simple long polling.


limit: number

Limits the number of updates to be retrieved per getUpdates call. Values between 1-100 are accepted. Defaults to 100.

timeout: number

Timeout in seconds for long polling. grammY uses 30 seconds as a default value.

allowed_updates: ReadonlyArray<Exclude<keyof Update, "update_id">>

A list of the update types you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member (default). If not specified, the previous setting will be used.

Please note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time.

drop_pending_updates: boolean

Pass True to drop all pending updates before starting the long polling.

onStart: (botInfo: UserFromGetMe) => void | Promise<void>

A callback function that is useful for logging (or setting up middleware if you did not do this before). It will be executed after the setup of the bot has completed, and immediately before the first updates are being fetched. The bot information bot.botInfo will be available when the function is run. For convenience, the callback function receives the value of bot.botInfo as an argument.