How bora168-coder-kh/telegram-ai-chatbot-management-system works
Telegram users send messages through the bot; handlers register users, enforce access rules, dispatch commands or route questions, then save and send replies. The router checks rules, FAQ, knowledge articles, AI, and fallback in order. Users can request human support and rate answers. Administrators use the dashboard to review users, FAQs, unknown questions, and statistics. The README documents broader capabilities than the sampled implementation; unsampled or planned features are represented only where supported by the tree or documentation, and evidence limits are reflected in the edges.
Main entry points: handlers.py Bot handlers · models.py Domain models · db.py Database access · main.py Admin dashboard
Components 18
Telegram bot
- Bot runtime
app/bot/main.py - Bot handlers
app/bot/handlers.py - Keyboards
app/bot/keyboards.py - Localization
app/i18n.py
Answering services
- User conversations
app/services/users.py - Response router
app/services/router.py - Keyword rules
app/services/rules.py - AI service
app/services/ai.py - Human handoff
app/services/users.py
Admin dashboard
- Admin dashboard
app/web/main.py - Dashboard statistics
app/services/stats.py
Data and configuration
- Default data
app/seed.py - Application settings
app/config.py - Database access
app/db.py - Domain models
app/models.py - SQL database
Other components
- Telegram user
- Telegram API
Connections 28
- Telegram user → Telegram API: sends messages
README.md - Telegram API → Bot runtime: delivers updates
README.md - Bot runtime → Bot handlers: registers router
app/bot/main.py - Bot runtime → Database access: initializes database
app/bot/main.py - Bot runtime → Default data: seeds defaults
app/bot/main.py - Bot handlers → Telegram API: sends replies
README.md - Bot handlers → User conversations: manages sessions
app/bot/handlers.py - Bot handlers → Response router: routes questions
app/bot/handlers.py - Bot handlers → Keyboards: builds keyboards
app/bot/handlers.py - Keyboards → Localization: gets button text
app/bot/keyboards.py - Bot handlers → Localization: gets response text
app/bot/handlers.py - Bot handlers → Human handoff: requests support
README.md - Response router → Keyword rules: checks rules
app/services/router.py - Response router → AI service: requests generation
app/services/router.py - Response router → Domain models: queries FAQ and articles
app/services/router.py - Bot handlers → Domain models: records feedback
app/bot/handlers.py - Admin dashboard → Dashboard statistics: loads KPIs
app/web/main.py - Admin dashboard → Domain models: reads and updates records
app/web/main.py - Admin dashboard → Database access: opens sessions
app/web/main.py - Admin dashboard → Default data: seeds defaults
app/web/main.py - Dashboard statistics → Domain models: counts activity
app/services/stats.py - User conversations → Domain models: persists conversations
app/services/users.py - Human handoff → Domain models: marks support open
README.md - Database access → Application settings: reads database URL
app/db.py - Database access → Domain models: creates schema
app/db.py - Database access → SQL database: connects to
app/db.py - Default data → Domain models: adds defaults
app/seed.py - AI service → Application settings: reads AI settings
app/services/ai.py