How andcher03/tg_bot_kddm works
Молодёжь Казани is a Telegram youth-information bot paired with a FastAPI admin panel and a separate mailing worker. Users browse city resources, register for events, manage profiles and subscriptions, and submit reviews; administrators manage users, events, registrations, reviews, and campaigns. Both interfaces share PostgreSQL. The graph preserves documented product areas whose implementation was not sampled, while omitting uncertain internal links. Edges cite excerpts, SOURCE INDEX references, or README statements; the README establishes several cross-process relationships.
Main entry points: database.py PostgreSQL · bot.py Bot application · app.py Admin application · profile.py Profile and registration
Components 30
Telegram experience
- Bot application
bot.py - Profile and registration
handlers/profile.py - Event discovery
handlers/afisha.py - City information
handlers/main_sections.py - Youth organizations
handlers/youth_organizations.py - Youth map
handlers/youth_map.py - Quizzes
handlers/quiz.py - User subscriptions
handlers/subscription.py
Platform services
- Channel statistics
services/channel_stats_service.py - User records
services/postgres_user_service.py - Event records
services/postgres_event_service.py - Event registration
services/registration_service.py - Event reviews
services/review_service.py - Mailing subscriptions
services/mailing_service.py
Web administration
- Admin application
web_admin/app.py - Admin authentication
web_admin/auth.py - User management
web_admin/routers/users.py - Event management
web_admin/routers/events.py - Registration management
web_admin/routers/registrations.py - Review management
web_admin/routers/reviews.py - Admin dashboard
web_admin/routers/dashboard.py
Campaign delivery
- Campaign setup
web_admin/routers/mailing.py - Mailing worker
services/mailing_worker.py - Campaign queue
services/mailing_queue.py - Telegram bot client
services/telegram_bot.py
Shared state
- PostgreSQL
services/database.py - Data models
services/models.py
Other components
- Telegram user
- Telegram API
- Administrator
Connections 45
- Telegram user → Bot application: uses
- Bot application → Profile and registration: dispatches
bot.py - Bot application → Event discovery: dispatches
bot.py - Bot application → City information: dispatches
bot.py - Bot application → Youth organizations: dispatches
bot.py - Bot application → Youth map: dispatches
bot.py - Bot application → Quizzes: dispatches
bot.py - Bot application → User subscriptions: dispatches
bot.py - Bot application → Channel statistics: records stats
bot.py - Profile and registration → User records: uses
handlers/profile.py - Profile and registration → Event records: uses
handlers/profile.py - Profile and registration → Event registration: uses
handlers/profile.py - Profile and registration → Event reviews: uses
handlers/profile.py - Profile and registration → Mailing subscriptions: manages subscriptions
handlers/profile.py - Event discovery → Event records: searches events
handlers/afisha.py - Event discovery → Event registration: registers users
handlers/afisha.py - Event discovery → Event reviews: submits reviews
handlers/afisha.py - City information → Youth organizations: offers section
- Bot application → Telegram API: communicates
- Channel statistics → Telegram API: reads membership
services/channel_stats_service.py - User records → PostgreSQL: reads and writes
services/postgres_user_service.py - Event records → PostgreSQL: reads and writes
services/postgres_event_service.py - Event registration → PostgreSQL: reads and writes
services/registration_service.py - Event reviews → PostgreSQL: reads and writes
services/review_service.py - Channel statistics → PostgreSQL: stores statistics
services/channel_stats_service.py - PostgreSQL → Data models: stores
services/database.py - Administrator → Admin application: uses
- Admin application → Admin authentication: applies middleware
web_admin/app.py - Admin application → User management: mounts router
web_admin/app.py - Admin application → Event management: mounts router
web_admin/app.py - Admin application → Registration management: mounts router
web_admin/app.py - Admin application → Review management: mounts router
web_admin/app.py - Admin application → Admin dashboard: mounts router
web_admin/app.py - Admin application → Campaign setup: mounts router
web_admin/app.py - User management → PostgreSQL: manages users
- Event management → PostgreSQL: manages events
web_admin/routers/events.py - Registration management → PostgreSQL: manages registrations
- Review management → PostgreSQL: reads reviews
web_admin/routers/reviews.py - Admin dashboard → PostgreSQL: reads dashboard data
- Campaign setup → PostgreSQL: selects audience
web_admin/routers/mailing.py - Campaign setup → Campaign queue: queues campaign
web_admin/routers/mailing.py - Mailing worker → Campaign queue: polls deliveries
mailing_worker.py - Mailing worker → Telegram bot client: sends messages
mailing_worker.py - Telegram bot client → Telegram API: delivers campaign
- Campaign queue → PostgreSQL: persists queue
services/mailing_queue.py