A Telegram Quiz Bot designed to test your knowledge through fun and interactive quizzes. Easily configurable with a robust backend and seamless Telegram integration.
Use the following command to clone the repository:
git clone <repository_url>Navigate to the project directory and run the following command to install all required modules:
npm install- Open the
Modelfolder. - Execute the queries in your MySQL terminal or MySQL Workbench.
- Follow the sequence below to create and populate the tables:
- Users → Points → Quiz (first paragraphs, then mcq) → Logs
Start the server with the following command:
nodemon .\server.jsInteract with the bot on Telegram through this link:
Make a Quiz Bot
- Node.js: Handles server-side logic and processes Telegram API requests.
- JavaScript: The primary language used for writing bot functionality and logic.
- Telegraf: A Telegram Bot library to simplify bot integration and interaction.
- MySQL: Manages user data, quiz database, logs, and scoring efficiently.
- Table:
user- Columns:
userId(Primary Key)nametopicSelectedtopicScore
- Columns:
- Relationships:
- One-to-One with
pointstable (each user has one points table record). - One-to-Many with
user_logstable (each user can have multiple logs).
- One-to-One with
- Table:
points- Columns:
idstatus(1 - correct, 0 - incorrect)
- Columns:
- Table:
user_logs- Columns:
userIdmessage
- Primary Key: (
userId,message) - Foreign Key:
userId
- Columns:
- Tables:
-
paragraphs
- Columns:
id(Primary Key)topictopicIDparagraph
- Relationships:
- One-to-Many with
mcqtable (a paragraph can have multiple MCQs).
- One-to-Many with
- Columns:
-
mcq
- Columns:
topicID(Foreign Key)quesIdxquestionoption1option2option3option4correctAnswer
- Primary Key: (
topicID,quesIdx)
- Columns:
-