Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/grammy/bot.ts>PollingOptions

The Telegram Bot Framework.
Very Popular
Latest
interface PollingOptions
import { type PollingOptions } from "https://deno.land/x/grammy@v1.30.1/bot.ts";

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

Properties

optional
limit: number

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

optional
timeout: number

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

optional
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, message_reaction, and message_reaction_count (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.

optional
drop_pending_updates: boolean

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

optional
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.

When this function is invoked, the bot already signals that it is running. In other words, bot.isRunning() already returns true.