How worksonmyserver/-spanish_fro_ua works
This is a Telegram bot for delivering Spanish-learning lessons, with administrator controls for generation, review, and publishing. The main flow runs from admin actions or scheduled jobs through lesson generation and persistence, then scheduled publication of vocabulary/audio, quizzes, and evening grammar/text. A separate OpenAI post-generation path is present in the source index but its trigger is not shown. Relationships reflect excerpts and index references; unsampled handler and generator behavior is not inferred.
Main entry points: scheduler.py Publishing Scheduler · handlers.py Admin Controls · gemini_pipeline.py Daily Lesson Generator · crud.py Lesson Data Access
Components 17
Bot Runtime
- Application Startup
main.py - Admin Controls
bot/handlers.py - Publishing Scheduler
bot/scheduler.py
Lesson Content
- Topic Catalog
generator/topics.py - Daily Lesson Generator
generator/gemini_pipeline.py - Speech Synthesis
generator/gemini_pipeline.py - Gemini API
- Edge TTS Service
Lesson Storage
- Database Sessions
database/connection.py - Lesson Data Access
database/crud.py - Learning Data Model
database/models.py - MySQL Database
Generated Posts
- Post Generator
generator/llm_pipeline.py - Post Schema
generator/schemas.py - OpenAI API
Other components
- Administrator
- Telegram
Connections 21
- Application Startup → Database Sessions: initializes database
main.py - Application Startup → Admin Controls: registers router
main.py - Application Startup → Publishing Scheduler: starts scheduler
main.py - Administrator → Admin Controls: sends commands
bot/handlers.py - Admin Controls → Lesson Data Access: reads and saves lessons
bot/handlers.py - Admin Controls → Daily Lesson Generator: requests generation
bot/handlers.py - Admin Controls → Topic Catalog: selects topics
bot/handlers.py - Publishing Scheduler → Lesson Data Access: loads and advances lessons
bot/scheduler.py - Publishing Scheduler → Daily Lesson Generator: generates next lesson
bot/scheduler.py - Publishing Scheduler → Topic Catalog: selects next topic
bot/scheduler.py - Publishing Scheduler → Telegram: publishes lessons
bot/scheduler.py - Daily Lesson Generator → Gemini API: generates lesson data
generator/gemini_pipeline.py - Daily Lesson Generator → Speech Synthesis: creates lesson audio
generator/gemini_pipeline.py - Speech Synthesis → Edge TTS Service: synthesizes speech
generator/gemini_pipeline.py - Daily Lesson Generator → Lesson Data Access: saves generated lesson
generator/gemini_pipeline.py - Lesson Data Access → Learning Data Model: queries and maps records
database/crud.py - Database Sessions → Learning Data Model: creates schema
database/connection.py - Database Sessions → MySQL Database: connects to
database/connection.py - Post Generator → Post Schema: parses structured output
generator/llm_pipeline.py - Post Generator → OpenAI API: requests completion
generator/llm_pipeline.py - Post Generator → Lesson Data Access: saves draft post
generator/llm_pipeline.py