How iringil/open-weather-bot works
Open Weather Bot is a Telegram weather-forecast bot. A user starts a setup dialog, searches by city name or location, selects a city and units, then receives current conditions and a forecast image; saved settings support scheduled updates every three hours. The graph also preserves administration, localization, and supporting data/formatting components. Evidence is limited to the README, the source index, and the excerpts provided; unsampled modules are included only where their role or connection is documented there.
Main entry points: bot.py Webhook bot · weather.py Weather service · database.py User database · dialog.py Setup dialog
Components 21
Bot entry and interaction
- Webhook bot
bot.py - Setup dialog
tgbot/handlers/dialog.py - User commands
tgbot/handlers/commands.py - Admin handlers
tgbot/handlers/admin.py - Admin filter
tgbot/filters/admin.py - Inline keyboards
tgbot/keyboards/inline.py
Weather workflow
- Weather service
tgbot/services/weather.py - Weather parser
tgbot/services/parser.py - Weather formatter
tgbot/services/formatter.py - Forecast image
tgbot/services/image.py
User state and localization
- Weather data types
tgbot/services/classes.py - User database
tgbot/services/database.py - Localization middleware
tgbot/middlewares/localization.py - Translations
tgbot/locales
Operations
- Configuration
tgbot/config.py - Weather scheduler
tgbot/misc/scheduler.py
Other components
- Telegram user
- Telegram
- OpenWeather API
- PostgreSQL
- Redis FSM storage
Connections 29
- Telegram user → Telegram: sends requests
README.md - Telegram → Webhook bot: delivers updates
bot.py - Webhook bot → Setup dialog: registers handlers
bot.py - Webhook bot → User commands: registers handlers
bot.py - Webhook bot → Admin handlers: registers handlers
bot.py - Webhook bot → Admin filter: binds filter
bot.py - Webhook bot → Localization middleware: sets middleware
bot.py - Webhook bot → Weather scheduler: starts schedule
bot.py - Webhook bot → User database: creates tables
bot.py - Webhook bot → Configuration: loads settings
bot.py - Setup dialog → Weather service: requests weather
tgbot/handlers/dialog.py - Setup dialog → User database: reads and saves
tgbot/handlers/dialog.py - Setup dialog → Inline keyboards: builds choices
tgbot/handlers/dialog.py - Inline keyboards → Weather data types: uses city data
tgbot/keyboards/inline.py - Weather service → OpenWeather API: requests data
tgbot/services/weather.py - Weather service → User database: loads settings
tgbot/services/weather.py - Weather service → Weather parser: parses responses
tgbot/services/weather.py - Weather service → Weather formatter: formats conditions
tgbot/services/weather.py - Weather service → Forecast image: renders forecast
tgbot/services/weather.py - Weather parser → Weather data types: creates data types
tgbot/services/parser.py - Weather formatter → Weather data types: formats data types
tgbot/services/formatter.py - Forecast image → Weather data types: uses weather data
tgbot/services/image.py - User database → PostgreSQL: queries records
tgbot/services/database.py - Weather scheduler → Weather service: refreshes forecasts
tgbot/misc/scheduler.py - Weather scheduler → User database: loads users
tgbot/misc/scheduler.py - Admin handlers → User database: manages users
tgbot/handlers/admin.py - Localization middleware → Translations: loads messages
tgbot/middlewares/localization.py - Configuration → Redis FSM storage: configures storage
tgbot/config.py - Webhook bot → Telegram: sets webhook
bot.py