Echotron examples
March 6, 2026 · View on GitHub
Each subdirectory is a self-contained Go module that can be cloned as a project
skeleton with gonew:
gonew github.com/NicoNex/echotron/v3/example/<name> <your-module-path>
For example:
gonew github.com/NicoNex/echotron/v3/example/polling github.com/you/mybot
Examples
| Name | What it shows |
|---|---|
polling-simple | Stateless bot driven by a plain PollingUpdates channel; no Dispatcher. Shortest possible starting point. |
polling | Per-chat stateful bot using Dispatcher with long-polling. One struct instance per conversation. |
polling-keyboard | Inline keyboards attached to messages and callback query handling. |
polling-inline | Inline mode: the bot responds to @botname <query> from any chat. |
polling-ratelimit | Configuring the built-in dual-level rate limiter (global and per-chat). |
polling-fsm | Finite state machine pattern via a self-referential stateFn type. Multi-step conversations without external libraries. |
polling-fsm-lifecycle | FSM extended with session self-destruction: inactive bot instances remove themselves from the Dispatcher after a configurable idle timeout. |
polling-fsm-persistence | FSM extended with disk persistence using katalis. Per-chat data survives process restarts. |
webhook | Dispatcher with webhook delivery instead of long-polling. |
webhook-simple | Stateless bot driven by a plain WebhookUpdates channel; no Dispatcher. |
Suggested reading order
polling-simple— understand the raw update channelpolling— add per-chat state with theDispatcherpolling-keyboard— interactive keyboards and callbackspolling-inline— inline mode andPollOptionspolling-ratelimit— rate limiter configurationpolling-fsm— state machines for multi-step conversationspolling-fsm-lifecycle— memory management with session self-destructionpolling-fsm-persistence— durable state across restartswebhook/webhook-simple— webhook delivery
Prerequisites
- Go 1.21 or later
gonew:go install golang.org/x/tools/cmd/gonew@latest- A bot token from @BotFather, exported as
TELEGRAM_TOKEN