A Poller is responsible for deliveringDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/tucnak/telebot/llms.txt
Use this file to discover all available pages before exploring further.
Update objects to the bot’s internal channel. Telebot decouples update fetching from update processing, so you can swap pollers without touching your handlers.
The Poller interface
The bot instance. Use it to call
b.getUpdates or other API methods.Send each received
Update to this channel. The bot’s main loop reads from it.Closed by the bot when
b.Stop() is called. Your Poll implementation must return when this channel is closed.LongPoller
The default and most common poller. It callsgetUpdates in a loop and pushes each update into the channel.
Maximum number of updates to fetch per request. Telegram accepts values from 1 to 100. Defaults to the server default (100) when set to 0.
Long-polling timeout. The server holds the connection open for up to this duration if no updates are available. A value of 0 triggers short polling (not recommended for production).
The offset used in the next
getUpdates call. Automatically advanced after each batch of updates. You can set this to resume from a known position.Filter which update types the server delivers. When empty, all update types are received. Uses the same string values as the Telegram Bot API (
"message", "callback_query", etc.).Example
AllowedUpdates reference
The following strings are defined inpoller.go:
MiddlewarePoller
A poller wrapper that filters updates before they reach your handlers. This is useful for blocking updates early — before a context and handler chain are even created.Buffer size of the internal relay channel. Defaults to 1. Increase for high-throughput scenarios where filtering is expensive.
The underlying poller to wrap.
Return
true to pass the update through, false to drop it silently.Example — filter by chat type
MiddlewarePoller operates on raw *Update values — before any Context is created. For logic that needs a full context (sender info, c.Get/c.Set), use handler-level middleware instead.ProcessUpdate — manual update injection
When using webhooks or writing tests, you may want to inject updates directly without a polling loop:ProcessUpdate creates a new Context from the update and routes it through the same handler/middleware pipeline as the polling loop.