Anonymous Student-Teacher Relay Telegram Bot
This Telegram bot enables anonymous, structured communication between students and teachers in separate Telegram groups. Students can propose messages for teachers, but only messages that pass a peer voting threshold are forwarded—ensuring quality and relevance. Teachers can reply with feedback, make announcements, and set assignment deadlines, all managed transparently by the bot.
Key Features
- Anonymous Student Messaging:
Students submit messages for teachers using/msg_for_teacher
. Messages are only forwarded if at least 60% of peers approve via an in-group poll.
- Peer Voting System:
Each message triggers an anonymous poll. Voting is tracked, and polls close automatically when approval or disapproval thresholds are met. - Teacher Feedback & Announcements:
Teachers can send feedback on approved messages (/feedback
) and broadcast announcements (/announcement
) to the student group.
- Deadline Management:
Teachers set deadlines (/set_deadline 24h
or/set_deadline DD.MM.YYYY
). The bot sends reminders 24 hours and 1 hour before, and notifies when deadlines pass.
- User & Message Tracking:
All users, messages, votes, and deadlines are stored in SQLite for reliability. The bot tracks group membership and cleans up stale data automatically. - Scheduled Reminders & Cleanup:
Pending messages older than 24 hours are deleted. Reminders for pending votes and upcoming deadlines are sent automatically.
Technical Architecture
- Backend:
Written in Python, using thepython-telegram-bot
library for async Telegram API integration. - Database:
Uses SQLite to persist users, messages, votes, and deadlines. - Asynchronous Operations:
All Telegram interactions and scheduled jobs (reminders, cleanup) are handled asynchronously for responsiveness. - Error Handling & Logging:
Comprehensive logging and error management ensure reliability and easy debugging.
Example Workflow
- Student joins and registers:
The bot tracks new users and provides help instructions. - Student submits a message:
/msg_for_teacher [message]
triggers a poll. Peers vote anonymously. - Voting and forwarding:
If 60% approve, the message is forwarded to the teacher group. Otherwise, it’s disapproved or can be cancelled by the author. - Teacher responds:
Teachers reply with/feedback [text]
or broadcast with/announcement [text]
. Deadlines are set with/set_deadline
. - Reminders and status:
Students can check vote status (/status
), see pending messages (/list_pending
), and receive deadline reminders.
Technologies Used
- Python 3
- python-telegram-bot
- SQLite
- AsyncIO
This project demonstrates how Telegram bots can facilitate safe, anonymous, and structured communication in educational settings—empowering students to voice concerns and questions, while giving teachers tools for feedback and organization.