Overview of available sample bots
v2The samples/ directory contains several specialized bot implementations to serve as learning resources:
| Sample | Purpose |
|---|---|
callbackqueryBot | Demonstrates handling Telegram callback queries (e.g., button presses) and editing messages via callbacks. |
commandBot | Demonstrates handling Telegram commands (e.g., /start, /source). |
conversationBot | Demonstrates stateful conversation handlers for multi-step interactions. |
echoBot | A basic bot that repeats input; includes examples of implementing the gotgbot.BotClient interface for testing. |
echoMultiBot | Demonstrates running multiple bot instances simultaneously and using Updater.Stop() for graceful shutdown. |
echoWebhookBot | Demonstrates bot operation via webhooks instead of long polling. |
inlinequeryBot | Demonstrates basic inline query functionality. |
metricsBot | Shows how to collect Prometheus metrics from the dispatcher and bot client. |
middlewareBot | Demonstrates using middlewares to intercept and modify API requests. |
paymentsBot | Demonstrates Telegram's in-app purchase methods (Invoices, Checkouts) using Telegram Stars. |
statefulClientBot | Demonstrates using structs with methods to pass dependencies (DB, cache) to handlers without global variables. |
webappBot | Demonstrates serving a WebApp and using the updater's handler within a user-provided server. |