How derain/tt-bot works
tt-bot is a stateless Telegram interface for managing qBittorrent downloads. Whitelisted users issue commands or interact with inline views; the bot lists and searches torrents, supports category-based adds, detail/file management and pause/resume/removal, then formats responses for Telegram. A background poller detects newly completed downloads and sends notifications. The graph reflects documented capabilities, but several detailed handler branches were not sampled; those feature links rely on the README rather than inferred call chains.
Main entry points: handler.go Update and message handler · main.go Bot entry point · client.go qBittorrent client interface · callback.go Inline callbacks
Components 17
Runtime setup
- Environment config
internal/config/config.go - Bot entry point
cmd/bot/main.go
Telegram interaction
- User whitelist
internal/bot/auth.go - Command registration
internal/bot/commands.go - Update and message handler
internal/bot/handler.go - Inline callbacks
internal/bot/callback.go - Torrent upload handling
internal/bot/download.go - Telegram sender adapter
internal/bot/sender.go - Messages and keyboards
internal/formatter/format.go
Torrent service
- qBittorrent client interface
internal/qbt/client.go - qBittorrent HTTP client
internal/qbt/http.go - Torrent data types
internal/qbt/types.go
Completion alerts
- Completion poller
internal/poller/poller.go - Telegram completion notifier
cmd/bot/main.go
Other components
- Telegram user
- Telegram API
- qBittorrent Web API
Connections 21
- Telegram user → Telegram API: sends updates
README.md - Telegram API → Bot entry point: delivers updates
cmd/bot/main.go - Environment config → Bot entry point: configures
cmd/bot/main.go - Bot entry point → Command registration: registers commands
cmd/bot/main.go - Bot entry point → Update and message handler: dispatches updates
cmd/bot/main.go - Update and message handler → User whitelist: checks access
- Update and message handler → Inline callbacks: dispatches callbacks
- Update and message handler → Torrent upload handling: handles uploads
- Update and message handler → Messages and keyboards: formats responses
- Inline callbacks → Messages and keyboards: formats views
internal/bot/callback.go - Update and message handler → qBittorrent client interface: manages torrents
- Inline callbacks → qBittorrent client interface: controls torrents
internal/bot/callback.go - Messages and keyboards → Torrent data types: formats torrent data
internal/formatter/format.go - Bot entry point → qBittorrent HTTP client: creates and logs in
cmd/bot/main.go - qBittorrent HTTP client → qBittorrent Web API: calls Web API
internal/qbt/http.go - qBittorrent HTTP client → qBittorrent client interface: implements
- qBittorrent client interface → Torrent data types: uses data types
internal/qbt/client.go - Bot entry point → Completion poller: starts poller
cmd/bot/main.go - Completion poller → qBittorrent client interface: lists torrents
internal/poller/poller.go - Completion poller → Telegram completion notifier: notifies completion
- Telegram completion notifier → Telegram API: sends message
cmd/bot/main.go