Quizly is an intelligent Telegram bot that offers engaging quizzes on various subjects with adjustable difficulty levels. Powered by Google's Generative AI, it provides a dynamic learning experience for users.
- 📚 Multiple subjects: Mathematics, Physics, Chemistry, Biology, Computer Science, History, Geography, Politics, English, General Knowledge
- 🎯 User-defined topics within each subject
- 🔢 Three difficulty levels: Beginner, Intermediate, and Advanced
- 🧠 10-question quizzes generated dynamically using Google's Generative AI
- 📊 Score tracking and display
- 🌐 Multi-language support
- 📝 Feedback submission feature
- 🎥 YouTube video recommendations for improvement
/start
- Begin a new quiz/help
- Show available commands/about
- Display information about the bot/stop
- Stop the current quiz/feedback
- Submit feedback about the bot/language
- Set the bot's language
- Python 3.7+
- python-telegram-bot
- Google Generative AI (Gemini 1.5 Flash model)
- YouTube Data API
- Firebase Firestore
- smtplib for email notifications
-
Clone the repository:
git clone https://github.com/ShahbazCoder1/QuizBot.git cd QuizBot
-
Install the required dependencies:
pip install -r requirements.txt
-
Install gettext for translations:
- On Ubuntu/Debian:
sudo apt-get install gettext
- On macOS (using Homebrew):
brew install gettext
- On Windows: Download and install gettext from the GNU gettext website
- Set up environment variables:
TOKEN
: Your Telegram Bot TokenUSERNAME
: Your Telegram Bot UsernameAPI_KEY
: Your Google Generative AI API KeyYOUTUBE_API
: Your YouTube Data API Key
- Set up Firebase:
- Create a Firebase project and download the service account key JSON file
- Replace the
service_account.json
with the path of your service account key JSON file inTelegramBot/firestore/user_data.py:14
- Prepare translations:
- Compile .po files to .mo files:
msgfmt -o locale/<lang>/LC_MESSAGES/messages.mo locale/<lang>/LC_MESSAGES/messages.po
- NOTE: replace
<lang>
with language code, e.g., 'es' for Spanish
- Run the bot:
python quizly_telegram_bot.py
- For Production mode:
gunicorn app:app & python TelegramBot/quizly_telegram_bot.py
Note: Make sure to update your translations and recompile .mo files whenever you add or modify translatable strings in your code.
For users working with Google Project IDX, we provide a Project-IDX_nix_setup.txt
file in the repository. This file contains the .idx/dev.nix
configuration used in this project. To set up your Project IDX workspace:
- Create a
.idx
directory in your Project IDX workspace if it doesn't already exist. - Create a
dev.nix
file inside the.idx
directory. - Copy the contents of
Project-IDX_nix_setup.txt
and paste them into yourdev.nix
file.
This configuration sets up the necessary environment for running the Quizly bot in Project IDX, including Python and required dependencies. After setting up, you can proceed with the bot configuration and execution as described in the Setup section.
NOTE: Remember to first clone the code from this repository to Project IDX.
When a user starts the bot for the first time:
- The bot will greet the user and offer language selection
- User selects their preferred language
- The bot saves the user's language preference
- User is presented with the subject selection menu to start their first quiz
- The bot presents a list of subjects to choose from
- Users enter their desired topic within the chosen subject
- Users select the difficulty level
- The bot generates a 10-question quiz using Google's Generative AI
- Questions are presented one at a time as Telegram polls
- The bot tracks correct and incorrect answers
- After completing the quiz, users receive their final score
- For scores of 5 or less, the bot suggests relevant YouTube videos for improvement
Users can submit feedback using the /feedback
command. Feedback is sent via email to the developers.
- Vidhi Agrawal (Initial development phase)
This project was initially developed collaboratively, with Vidhi Agrawal contributing during the early stages. Since then, Md Shahbaz Hashmi Ansari has continued solo development and maintenance of the project.
This project is open source and available under the GPL-3.0 License.
If you encounter any issues or have questions, please open an issue on the GitHub repository.
Click the image above to watch a demo of the Quizly Bot in action!