How duama20180/weather_bot works
Weather Bot is a Telegram assistant for location-based current weather, AI clothing advice, and scheduled notifications. Users share a location or enter a place name, then request a forecast or tips, or configure a daily schedule. The handlers coordinate these interactions and persist user settings; a background scheduler checks saved times and sends weather and optional tips. The README documents these capabilities, while sampled source confirms the principal calls. Location lookup uses Gemini and forecast retrieval uses Weatherstack; unsampled details are represented only where documented.
Main entry points: main.py Bot startup · handlers.py Message handlers · scheduler.py Reminder scheduler · forecast.py Weather reports
Components 15
Bot runtime
- Bot startup
main.py - Environment config
app/config.py
User interaction
- Message handlers
app/handlers.py - Bot keyboards
app/keyboards.py
Weather and advice
- Location lookup
app/forecast.py - Weather reports
app/forecast.py - Clothing advice
app/ai_adviser.py
Persistence and scheduling
- Database setup
app/db_create.py - User data access
app/db_handlers.py - PostgreSQL users
- Reminder scheduler
app/scheduler.py
Other components
- Telegram user
- Weatherstack API
- Gemini AI
- Telegram platform
Connections 24
- Telegram user → Bot startup: sends requests
README.md - Bot startup → Database setup: creates schema
main.py - Bot startup → User data access: initializes database
main.py - Bot startup → Message handlers: registers router
main.py - Bot startup → Reminder scheduler: starts checker
main.py - Bot startup → Telegram platform: starts polling
main.py - Message handlers → Bot keyboards: uses keyboards
app/handlers.py - Message handlers → Location lookup: resolves place
app/handlers.py - Message handlers → Weather reports: requests weather
app/handlers.py - Message handlers → Clothing advice: requests tips
app/handlers.py - Message handlers → User data access: reads and saves settings
app/handlers.py - Location lookup → Gemini AI: looks up coordinates
app/forecast.py - Weather reports → Weatherstack API: fetches conditions
app/forecast.py - Weather reports → Gemini AI: formats report
app/forecast.py - Clothing advice → Gemini AI: generates advice
app/ai_adviser.py - Reminder scheduler → User data access: reads locations
app/scheduler.py - Reminder scheduler → Weather reports: fetches reports
app/scheduler.py - Reminder scheduler → Clothing advice: requests enabled tips
app/scheduler.py - Reminder scheduler → Telegram platform: sends reminders
app/scheduler.py - Database setup → PostgreSQL users: creates database and table
app/db_create.py - User data access → PostgreSQL users: reads and updates users
app/db_handlers.py - User data access → Environment config: uses connection settings
app/db_handlers.py - Weather reports → Environment config: uses API keys
app/forecast.py - Clothing advice → Environment config: uses AI key
app/ai_adviser.py