How ev-zhelak/commonlang_bot works
CommonLang is an under-development Telegram bot whose visible workflow receives text, translates it to English, and replies with the translation. Startup prepares data, initializes a SQLite users table, configures the bot and commands, registers handlers, then polls for updates. The README names translation and bot libraries; sampled code confirms the translation flow and user-table creation, but not persistence of messages or user records. Command-handler behavior and several database operations are not shown, so their internal relationships are omitted.
Main entry points: main.py Application startup · bot.py Bot and dispatcher · manager.py Database manager · messages.py Text handler
Components 15
Bot runtime
- Application startup
main.py - Bot and dispatcher
app/bot/bot.py - Command handlers
app/handlers/commands.py - Text handler
app/handlers/messages.py
Translation
- Translation helper
utils/tool.py
User storage
- Database manager
app/database/manager.py - SQL definitions
app/database/queries.py - User and message models
app/database/models.py
Configuration and support
- Configuration
config/config.py - Data setup
app/initialize/setup.py - Logging utilities
utils/log.py
Other components
- Chat user
- Telegram API
- Google Translate
- SQLite database
Connections 19
- Chat user → Telegram API: sends messages
- Telegram API → Bot and dispatcher: delivers updates
- Application startup → Data setup: runs setup
main.py - Application startup → Database manager: creates table
main.py - Application startup → Bot and dispatcher: creates dispatcher
main.py - Application startup → Bot and dispatcher: sets commands
main.py - Application startup → Command handlers: registers handler
main.py - Application startup → Text handler: registers handler
main.py - Application startup → Bot and dispatcher: starts polling
main.py - Bot and dispatcher → Configuration: gets token
app/bot/bot.py - Bot and dispatcher → Telegram API: sets commands
app/bot/bot.py - Text handler → Translation helper: translates text
app/handlers/messages.py - Translation helper → Google Translate: requests translation
utils/tool.py - Text handler → Telegram API: replies with translation
app/handlers/messages.py - Database manager → Configuration: gets database path
app/database/manager.py - Database manager → SQL definitions: executes table SQL
app/database/manager.py - Database manager → SQLite database: creates table
app/database/manager.py - Data setup → Logging utilities: uses decorator
app/initialize/setup.py - Logging utilities → Configuration: gets log level
utils/log.py