An open API service indexing awesome lists of open source software.

https://github.com/stefanopaolonii/quizbot

Telegram Quiz Bot โ€“ A Telegram bot written in Python that manages interactive quizzes with customizable questions. Supports multiple languages and topics. Easy to set up and modify.
https://github.com/stefanopaolonii/quizbot

automation bot-development chatbot json open-source python python-telegram-bot quiz-bot telegram-bot telegram-quiz-bot telegram-quiz-game

Last synced: 9 months ago
JSON representation

Telegram Quiz Bot โ€“ A Telegram bot written in Python that manages interactive quizzes with customizable questions. Supports multiple languages and topics. Easy to set up and modify.

Awesome Lists containing this project

README

          

![GitHub Repo stars](https://img.shields.io/github/stars/stefanopaolonii/quizbot?style=flat-square&logo=github&labelColor=0d1117&color=FFD700)
![Discord](https://img.shields.io/discord/1336983930015846400?style=flat-square&logo=discord&logoColor=ffffff&labelColor=0d1117&link=https%3A%2F%2Fdiscord.gg%2FWJDjPHANV7)

# Quiz-Bot: A Telegram Bot for Interactive Quizzes ๐Ÿค–๐ŸŽฎ

`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. ๐Ÿ”

## Features of Quiz-Bot โœจ

- **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. ๐Ÿ”„

## Requirements ๐Ÿ“‹

- **Python Version**: 3.7 or higher ๐Ÿ
- **Required Libraries**:
- `python-telegram-bot` (for Telegram API integration) ๐Ÿ“ฒ
- `asyncio` (for asynchronous functionality) โณ
- **Optional**: Docker for containerized deployment ๐Ÿšข

## Installation Guide ๐Ÿ› ๏ธ

### Install Quiz-Bot Using Python

1. **Fork and Clone the Repository**:
```bash
git clone https://github.com/your-username/quiz-bot.git
cd quiz-bot
```

2. **Create a Virtual Environment**:
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```

3. **Install Required Dependencies**:
```bash
pip install -r requirements.txt
```

### Install Quiz-Bot Using Docker

1. **Fork and Clone the Repository**:
```bash
git clone https://github.com/your-username/quiz-bot.git
cd quiz-bot
```

2. **Build the Docker Image**:
```bash
docker build -t quiz-bot .
```

3. **Run the Docker Container**:
```bash
docker run -d --name quiz-bot -v $(pwd)/config.py:/app/config.py -v $(pwd)/questions.json:/app/questions.json quiz-bot
```

## Configuration of Quiz-Bot โš™๏ธ

1. **Create a `config.py` File**:
Create a `config.py` file in the main project directory with the following content:
```python
TOKEN = "YOUR_BOT_TOKEN"
QUESTIONS_JSON_PATH = "data/questions.json"
STAFF_JSON_PATH = "data/staff.json"
REPORT_JSON_PATH = "data/reports.json"
```

2. **Setup Questions File (`questions.json`)**:
Ensure you have a `data/questions.json` file containing an array of questions in the following format:
```json
[
{
"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"
}
]
```

3. **Setup Staff File (`staff.json`)**:
Define the staff members and their roles in the `staff.json` file:
```json
[
{
"id": "YOUR_USER_ID",
"role": "Owner" # Possible roles: Owner, Admin, Mod
}
]
```

## Running the Quiz-Bot ๐Ÿš€

Once you've completed the installation and configuration steps, you can start the bot with the following command:

```bash
python main.py