Teacher's Test Bot
Teacher’s Test Bot is an interactive Telegram bot designed to help educators create, manage, and grade tests directly within Telegram. Built with Python and the python-telegram-bot
library, it provides a seamless workflow for both teachers (test creators) and students (test takers), making it ideal for remote learning, quizzes, and classroom assessments.
The bot supports the full assessment lifecycle: teachers create tests with multiple-choice or open-ended questions, students take tests using a unique ID, and teachers can review and score open-ended responses—all within Telegram.
Key Features
- Test Creation: Teachers can create new tests, add MCQ or open-ended questions, and finalize tests with a unique 8-character ID for distribution.
- Flexible Question Types: Supports both multiple-choice (with inline answer selection) and open-ended questions (free-text responses).
- Test Administration: Students join tests using the provided ID, answer questions in sequence, and cannot retake tests.
- Automated Scoring: MCQ answers are auto-graded; open-ended responses are reviewed and scored by teachers via inline keyboards.
- Results & Reporting: Teachers can view test results, including per-student scores and pending open-ended reviews.
- User & Test Management: Teachers can list, review, and delete their own tests. All data is securely stored in SQLite.
Technical Architecture
- Backend: Written in Python, using
python-telegram-bot
for async Telegram API integration. All test, question, response, and score data is stored in SQLite. - Session Management: In-memory state dictionaries track ongoing test creation, test taking, and review sessions for each user.
- Database: Four main tables—Tests, Questions, Responses, and Scores—manage all relevant data, with foreign key relationships for integrity.
- Error Handling: Robust error messages for invalid test IDs, unauthorized actions, and session timeouts ensure a smooth user experience.
Example Workflow
- Teacher creates a test:
Starts with/create_test
, enters a title, adds MCQ or open-ended questions, and finalizes with/done
to receive a test ID. - Student takes a test:
Uses/take_a_test
, enters the test ID, and answers each question as prompted. - Teacher reviews open-ended answers:
Runs/review_open_questions <test_id>
, scores each response via inline buttons, and results are updated in real time. - View results:
Teacher uses/show_results <test_id>
to see all student scores and pending reviews.
Technologies Used
- Python 3
- python-telegram-bot
- SQLite
- AsyncIO
This project demonstrates how Telegram bots can automate and simplify the assessment process, making quizzes and tests more accessible for both teachers and students in any learning environment.