How itwistiks/physics_bot works
Physics Bot is a Telegram study bot for OGE physics practice. Students choose a practice mode—random tasks, exam part, full variant, topic, or difficult tasks—then receive tasks, submit answers, and see results; the bot also tracks progress and awards achievements. Administrative handlers manage statistics and reminders, while scheduled jobs send inactivity reminders. The graph follows documented handler and service references; some README-described capabilities are included despite incomplete source excerpts, so their internal wiring is left unspecified where not evidenced.
Main entry points: inline_handlers.py Task callback handlers · reply_handlers.py Menu and practice handlers · reminder_service.py Inactivity reminders · models.py Learning and user models
Components 24
Telegram interaction
- Bot startup and routing
core/bot.py - Menu and practice handlers
core/handlers/reply_handlers.py - Task callback handlers
core/handlers/inline_handlers.py - Practice keyboards
core/keyboards/reply.py - Answer keyboards
core/keyboards/inline.py - Practice state
core/fsm/states.py
Practice and learning
- Task presentation
core/services/task_display.py - Task selection and checking
core/services/task_service.py - Task query utilities
core/services/task_utils.py - Answer evaluation
core/services/answer_checker.py - Answer processing
core/services/answer_processing.py
Progress and rewards
- User records
core/services/user_service.py - Progress and statistics
core/services/stats_service.py - Achievements and rewards
core/services/achievement_service.py
Administration and reminders
- Admin controls
core/handlers/admin.py - Teacher and moderator controls
core/handlers/teacher.py - Staff authorization
core/filters/admin.py - Inactivity reminders
core/services/reminder_service.py - Reminder scheduler
core/utils/reminder_scheduler.py - Reminder jobs
core/utils/reminder_jobs.py
Persistence
- Learning and user models
core/database/models.py - MySQL session and engine
config/database.py
Other components
- Student
- Telegram Bot API
Connections 35
- Student → Telegram Bot API: sends requests
README.md - Bot startup and routing → Telegram Bot API: serves updates
README.md - Bot startup and routing → Menu and practice handlers: registers routes
core/bot.py - Bot startup and routing → Task callback handlers: registers routes
core/bot.py - Bot startup and routing → Reminder scheduler: starts scheduler
core/bot.py - Menu and practice handlers → Practice keyboards: presents menus
core/handlers/reply_handlers.py - Menu and practice handlers → Task presentation: displays tasks
core/handlers/reply_handlers.py - Menu and practice handlers → Task query utilities: queries tasks
core/handlers/reply_handlers.py - Menu and practice handlers → Task selection and checking: uses task service
core/handlers/reply_handlers.py - Menu and practice handlers → Progress and statistics: loads statistics
core/handlers/reply_handlers.py - Task callback handlers → Task presentation: displays tasks
core/handlers/inline_handlers.py - Task callback handlers → Task query utilities: queries tasks
core/handlers/inline_handlers.py - Task callback handlers → Task selection and checking: checks answers
core/handlers/inline_handlers.py - Task callback handlers → Achievements and rewards: loads achievements
core/handlers/inline_handlers.py - Task callback handlers → Answer keyboards: builds answer UI
core/handlers/inline_handlers.py - Task callback handlers → Practice state: updates state
core/handlers/inline_handlers.py - Task selection and checking → Task query utilities: gets random task
core/services/task_service.py - Task selection and checking → Answer evaluation: delegates checking
core/services/task_service.py - Answer evaluation → Progress and statistics: updates statistics
core/services/answer_checker.py - Answer evaluation → Achievements and rewards: checks achievements
core/services/answer_checker.py - Task presentation → Answer keyboards: builds task controls
core/services/task_display.py - Task presentation → Practice keyboards: builds navigation
core/services/task_display.py - Admin controls → Staff authorization: restricts commands
core/handlers/admin.py - Teacher and moderator controls → Staff authorization: checks staff access
core/handlers/teacher.py - Admin controls → Progress and statistics: manages statistics
core/handlers/admin.py - Admin controls → Achievements and rewards: manages achievements
core/handlers/admin.py - Admin controls → Inactivity reminders: sends reminders
core/handlers/admin.py - Reminder scheduler → Inactivity reminders: schedules reminders
core/utils/reminder_scheduler.py - Reminder jobs → Inactivity reminders: runs reminder job
core/utils/reminder_jobs.py - Inactivity reminders → Telegram Bot API: sends messages
core/services/reminder_service.py - MySQL session and engine → Learning and user models: provides persistence
- User records → Learning and user models: manages user records
core/services/user_service.py - Progress and statistics → Learning and user models: reads and updates
core/services/stats_service.py - Achievements and rewards → Learning and user models: reads and updates
core/services/achievement_service.py - Inactivity reminders → Learning and user models: reads reminder data
core/services/reminder_service.py