โโโโโโโโโโ โโโโโโ โโโโโโโโโ โโโ โโโโโโโโโโโโโโโโโ โโโโโโโ โโโโ โโโ
โโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโ
โโโ โโโ โโโโโโโโ โโโ โโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโ โโโ
โโโ โโโ โโโโโโโโ โโโ โโโโ โโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโ โโโ โโโ โโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโ
โโโโโโโโโโโโโโโโโโ โโโ โโโ โโโโโ โโโโโโโโโโโโโโ โโโโโโโ โโโ โโโโโ
Premium Telegram Quiz Bot ยท MongoDB ยท Python 3.11 ยท python-telegram-bot v22
สษชษชษชษช แด แดสสษชษดษข! ๐ แดกแดสแดแดแดแด แดแด แดสแด แดแด๊ฑแด แดแด แดสแดสสแด แดสแดแด แดสแดแด แดแดแดแดแดษดษชแดษด แดษด แดแดสแดษขสแดแด!
Miss Quiz is a production-ready, feature-rich Telegram quiz bot built for CLAT aspirants. It delivers interactive multiple-choice questions, tracks progress across groups, runs a live global leaderboard, and auto-broadcasts quizzes every 30 minutes โ all backed by MongoDB Atlas.
๐ค Users โ /quiz /score /stats /achievements /leaderboard
๐ก๏ธ Admins โ /addquiz /delquiz /editquiz /importquiz /broadcast
๐ Analytics โ /botstats + Web Admin Panel at /admin
โฐ Auto Quiz โ Every 30 min to all registered groups
|
|
Miss-Quiz/
โ
โโโ main.py โ Entry point (polling + webhook modes)
โ
โโโ src/
โ โโโ bot/
โ โ โโโ handlers_main.py โ TelegramQuizBot (assembles all mixins)
โ โ โโโ handlers.py โ Compat shim โ handlers_main
โ โ โโโ ui.py โ Design tokens, UI class, constants
โ โ โโโ tracking.py โ Group & user registration pipeline
โ โ โโโ poll_manager.py โ Poll persistence & answer handler
โ โ โโโ quiz_parser.py โ Bulk .txt import parser
โ โ โโโ dev_commands.py โ Developer-only extended commands
โ โ โโโ commands/
โ โ โโโ user_cmds.py โ /start /help /ping /info /categories
โ โ โโโ quiz_cmds.py โ /quiz /score /stats /achievements /botstats
โ โ โโโ leaderboard_cmds.py โ /leaderboard + pagination
โ โ โโโ admin_cmds.py โ /addquiz /delquiz /editquiz + more
โ โ
โ โโโ core/
โ โ โโโ config.py โ Environment config (Config dataclass)
โ โ โโโ database.py โ MongoDB data access layer (1090 lines)
โ โ โโโ quiz.py โ QuizManager โ in-memory cache + logic
โ โ โโโ exceptions.py โ Custom exception hierarchy
โ โ
โ โโโ utils/
โ โ โโโ rate_limiter.py โ Sliding-window per-user rate limiting
โ โ โโโ scheduler.py โ Auto-quiz scheduler (APScheduler)
โ โ
โ โโโ web/
โ โโโ app.py โ Flask REST API + webhook endpoint
โ โโโ wsgi.py โ Gunicorn / Waitress entry point
โ
โโโ templates/
โ โโโ admin.html โ Admin panel SPA (dark-mode)
โโโ static/js/
โ โโโ admin.js โ Admin panel JavaScript
โโโ tests/ โ 54 unit tests (pytest)
โโโ data/ โ Poll cache, restart flag
โโโ Dockerfile โ Multi-stage production build
โโโ docker-compose.yml โ Local dev stack
โโโ render.yaml โ One-click Render deployment
โโโ requirements.txt
git clone https://github.com/Ownermood/Miss-Quiz.git
cd Miss-Quiz
cp .env.example .envEdit .env:
TELEGRAM_TOKEN=your_bot_token_here
OWNER_ID=your_telegram_user_id
MONGODB_URL=mongodb+srv://user:pass@cluster.mongodb.net/
MONGODB_DB=quiz_bot
SESSION_SECRET=any_random_secretpip install -r requirements.txt
python main.pyBot starts in polling mode by default. Admin panel โ http://localhost:5000/admin
# Copy and fill .env first
docker build -t miss-quiz .
docker run --env-file .env -p 5000:5000 miss-quiz- Fork this repo
- Go to render.com โ New Web Service โ connect your fork
- Set environment variables:
| Variable | Value |
|---|---|
TELEGRAM_TOKEN |
Your bot token from @BotFather |
OWNER_ID |
Your Telegram user ID |
MONGODB_URL |
MongoDB Atlas connection string |
SESSION_SECRET |
Any random string |
MODE |
webhook |
RENDER_URL |
Your render app URL |
- Deploy โ
render.yamlhandles everything automatically โ
| Command | Description |
|---|---|
/quiz |
Get a random quiz question |
/quiz Legal Reasoning |
Quiz from a specific category |
/score |
Your personal score card |
/stats |
Detailed performance stats |
/achievements |
Badges & milestones |
/leaderboard |
Global top 50 leaderboard |
/botstats |
Bot-wide analytics |
/categories |
Browse all quiz categories |
/help |
Command reference |
/ping |
Bot health check |
| Command | Description |
|---|---|
/addquiz |
Add a question (inline format) |
/importquiz |
Bulk import from .txt file |
/delquiz |
Delete a question |
/editquiz |
Browse & edit question bank |
/broadcast |
Send message to all users & groups |
/delbroadcast |
Recall last broadcast |
/reload |
Sync questions from MongoDB |
/restart |
Graceful bot restart |
/dev |
Developer control panel |
Telegram API
โ
โผ
TelegramQuizBot โโโ inherits โโโ PollMixin
โ TrackingMixin
โ UserCommandsMixin
โ QuizCommandsMixin
โ LeaderboardMixin
โ AdminCommandsMixin
โ
โโโ QuizManager โโโ caches โโโ MongoDB (questions)
โ
โโโ DatabaseManager โโโโโโโโโโโ MongoDB Atlas
โ โโโ users_col
โ โโโ groups_col
โ โโโ activities_col
โ โโโ poll_map_col
โ โโโ broadcasts_col
โ
โโโ AutoQuizScheduler โโโโโโโโโโ every 30 min โ all groups
โ
โโโ Flask (Waitress) โโโโโโโโโโโ /admin /api/* /webhook
pip install pytest pytest-asyncio pytest-cov
pytest tests/ -vtests/test_config.py โ Config loading & validation
tests/test_quiz_manager.py โ QuizManager business logic
tests/test_ui.py โ UI helpers & design system
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
54 passed in 1.5s โ
Send a .txt file to the bot after /importquiz. The parser auto-detects:
1. Which Article of the Constitution abolishes untouchability?
A) Article 14
B) Article 17
C) Article 19
D) Article 21
Answer: B
Category: Legal Reasoning
2. ...
Supports numbered questions, lettered options (A) / a.), answer lines (Answer: / Ans: / asterisk marking), and automatic category tagging.
| Rank | Score | Grade |
|---|---|---|
| ๐ LEGEND | 500+ | S |
| ๐ฑ MASTER | 200+ | A+ |
| โ๏ธ EXPERT | 100+ | A |
| ๐ฏ ADVANCED | 50+ | B |
| ๐ RISING | 20+ | C |
| ๐ฑ BEGINNER | 5+ | D |
| ๐ฒ ROOKIE | 0โ4 | E |
XP Level: Bronze โ Silver โ Gold โ Platinum โ Diamond โ ๐ Legendary
- Fork the repo
- Create a branch:
git checkout -b feature/amazing-feature - Commit:
git commit -m "Add amazing feature" - Push:
git push origin feature/amazing-feature - Open a Pull Request
MIT ยฉ CLAT Vision