quiz-bot
is a Telegram bot designed to create, manage, and take interactive quizzes. It allows users to start a quiz, add and modify questions, and review existing questions. The bot supports multiple languages and allows questions to be categorized by topics. 🌍📚
While all users can participate in quizzes, only authorized users (staff) can add, edit, and manage quiz questions, providing a flexible and secure environment for quiz management. 🔐
- Start Quiz: Users can initiate a quiz and answer a series of questions. 🎯
- Add Question: Authorized users (staff members) can add new questions to the quiz database. 📝
- Review Question: Users can review and explore existing quiz questions. 🔍
- Modify Question: Only staff members can modify or update existing questions. 🛠️
- Staff Management: An advanced system for managing staff with different roles, such as Owner, Admin, and Moderator. 👨💻👩💻
- Report System: Users can submit, review, and manage quiz-related reports. 📊
- Privacy Enhancements: User IDs are masked for added privacy and anonymity. 🕵️♂️
- Automated Testing: Ensures that updates do not break functionality by testing the bot automatically. 🧪
- Module Update Automation: Automatically manages and updates the bot’s dependencies. 🔄
- Python Version: 3.7 or higher 🐍
- Required Libraries:
python-telegram-bot
(for Telegram API integration) 📲asyncio
(for asynchronous functionality) ⏳
- Optional: Docker for containerized deployment 🚢
-
Fork and Clone the Repository:
git clone https://github.com/your-username/quiz-bot.git cd quiz-bot
-
Create a Virtual Environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Required Dependencies:
pip install -r requirements.txt
-
Fork and Clone the Repository:
git clone https://github.com/your-username/quiz-bot.git cd quiz-bot
-
Build the Docker Image:
docker build -t quiz-bot .
-
Run the Docker Container:
docker run -d --name quiz-bot -v $(pwd)/config.py:/app/config.py -v $(pwd)/questions.json:/app/questions.json quiz-bot
-
Create a
config.py
File:
Create aconfig.py
file in the main project directory with the following content:TOKEN = "YOUR_BOT_TOKEN" QUESTIONS_JSON_PATH = "data/questions.json" STAFF_JSON_PATH = "data/staff.json" REPORT_JSON_PATH = "data/reports.json"
-
Setup Questions File (
questions.json
):
Ensure you have adata/questions.json
file containing an array of questions in the following format:[ { "id": -1, "language": "en", "text": "What is the capital of France?", "options": [ "Berlin", "Madrid", "Paris", "Rome" ], "correct_index": 2, "verified": true, "explanation": "Paris is the capital city of France.", "topic": "Geography" } ]
-
Setup Staff File (
staff.json
):
Define the staff members and their roles in thestaff.json
file:[ { "id": "YOUR_USER_ID", "role": "Owner" # Possible roles: Owner, Admin, Mod } ]
Once you've completed the installation and configuration steps, you can start the bot with the following command:
python main.py