How msdzul/simple-golang-telegram-bot works
This is a small Telegram bot: startup loads optional dotenv configuration, creates the bot from BOT_TOKEN, registers command and callback routes, then starts polling. The main interaction is /start sending a welcome message with a Help button; callback handlers acknowledge and edit that message to navigate between Help and Home. The README also describes environment configuration and inline-keyboard navigation. Edges reflect calls shown in the excerpts; no storage or other product services are evidenced.
Main entry points: main.go Bot startup · callbacks.go Callback routes · start.go Start handler · help.go Help callback
Components 9
Startup & Configuration
- Bot startup
main.go - Environment config
.env.example
Routing
- Command routes
routes/commands.go - Callback routes
routes/callbacks.go
Bot Interactions
- Start handler
handlers/commands/start.go - Help callback
handlers/callbacks/help.go - Home callback
handlers/callbacks/home.go
Other components
- Telegram user
- Telegram Bot API
Connections 14
- Telegram user → Telegram Bot API: sends updates
README.md - Bot startup → Environment config: loads settings
main.go - Bot startup → Command routes: registers commands
main.go - Bot startup → Callback routes: registers callbacks
main.go - Bot startup → Telegram Bot API: starts bot
main.go - Command routes → Start handler: registers handler
routes/commands.go - Callback routes → Help callback: registers handler
routes/callbacks.go - Callback routes → Home callback: registers handler
routes/callbacks.go - Telegram Bot API → Start handler: dispatches /start
- Start handler → Telegram Bot API: sends welcome
handlers/commands/start.go - Telegram Bot API → Help callback: dispatches help
- Telegram Bot API → Home callback: dispatches home
- Help callback → Telegram Bot API: acks and edits
handlers/callbacks/help.go - Home callback → Telegram Bot API: acks and edits
handlers/callbacks/home.go