How mirier1/tg_bot works
TG_Bot is an aiogram Telegram bot for learning about the Sustainable Development Goals (SDGs), with quizzes, mini-games, and community features. Its likely user journey starts in the bot’s menu, then branches into SDG content, quizzes or games; users can also submit questions, apply to be ambassadors, give feedback, or enter a contest. Admin handlers manage content, applications, and reporting. The README is only a title, so capabilities are inferred from the source index and excerpts; edges are limited to relationships those sources support.
Main entry points: bot.py Bot runtime · database.py Database access · main_menu.py Main menu · sdg.py SDG content
Components 28
Bot and profiles
- Bot runtime
bot.py - Configuration
config.py - Start and profile
handlers/start.py - Profile settings
handlers/settings.py - Main menu
handlers/main_menu.py - Menu keyboard
keyboards/main_menu_kb.py
SDG learning
- SDG content
handlers/sdg.py - SDG constants
utils/constants.py - SDG keyboards
keyboards/sdg_keyboards.py
Quizzes and games
- Quiz flow
handlers/quizzes.py - Quiz questions
data/quiz_questions.py - Game menu
handlers/games/menu.py - Mini-games
handlers/games - Game content
data/games_data.py - Story game
handlers/games/story.py - Story rules
data/story_engine.py
Community features
- Expert questions
handlers/questions.py - Ambassador applications
handlers/ambassador.py - Feedback
handlers/feedback.py - Video contest
handlers/contest.py
Data and administration
- Admin operations
handlers/admin.py - Content management
handlers/admin_content.py - Admin keyboards
keyboards/admin_kb.py - Activity analytics
services/analytics.py - Database access
database.py - Domain models
models.py - Game result helper
handlers/games/utils.py
Other components
- Telegram user
Connections 39
- Telegram user → Bot runtime: sends updates
- Bot runtime → Configuration: loads settings
bot.py - Bot runtime → Main menu: registers handler
bot.py - Bot runtime → SDG content: registers handler
bot.py - Bot runtime → Start and profile: registers handler
bot.py - Bot runtime → Profile settings: registers handler
bot.py - Bot runtime → Quiz flow: registers handler
bot.py - Bot runtime → Admin operations: registers handler
bot.py - Bot runtime → Mini-games: registers handlers
bot.py - Bot runtime → Ambassador applications: registers handler
bot.py - Bot runtime → Feedback: registers handler
bot.py - Bot runtime → Video contest: registers handler
bot.py - Main menu → Menu keyboard: builds menu
handlers/main_menu.py - Main menu → SDG content: routes to
handlers/main_menu.py - Main menu → Expert questions: routes to
handlers/main_menu.py - Main menu → Ambassador applications: routes to
handlers/main_menu.py - Main menu → Game menu: routes to
handlers/main_menu.py - SDG content → SDG constants: uses titles
handlers/sdg.py - SDG content → SDG keyboards: builds choices
handlers/sdg.py - SDG content → Activity analytics: logs activity
handlers/sdg.py - Quiz flow → Quiz questions: selects questions
handlers/quizzes.py - Quiz flow → Database access: reads and saves
handlers/quizzes.py - Quiz flow → Activity analytics: logs activity
handlers/quizzes.py - Mini-games → Game content: uses game content
handlers/games/good_habits.py - Story game → Story rules: uses story rules
handlers/games/story.py - Story game → Database access: saves progress
handlers/games/story.py - Story game → Game result helper: saves results
handlers/games/story.py - Game result helper → Database access: writes scores
handlers/games/utils.py - Expert questions → Database access: stores questions
handlers/questions.py - Ambassador applications → Database access: stores applications
handlers/ambassador.py - Feedback → Database access: stores feedback
handlers/feedback.py - Video contest → Database access: stores entries
handlers/contest.py - Admin operations → Database access: queries records
handlers/admin.py - Admin operations → Activity analytics: uses reporting
handlers/admin.py - Content management → Database access: updates content
handlers/admin_content.py - Admin operations → Admin keyboards: shows controls
handlers/admin.py - Database access → Domain models: creates tables
database.py - Activity analytics → Database access: writes activity
services/analytics.py - Activity analytics → Domain models: records activity
services/analytics.py