A Telegram bot for class teachers to manage classes, students, grades, and progress reports from chat.
The project is built with Python, aiogram, and SQLite. It focuses on fast day-to-day teacher workflows such as creating classes, adding students, entering grades in multiple formats, generating summary reports, and exporting grade sheets to Excel.
- registers teachers automatically on first launch
- creates and stores classes in SQLite
- adds students to specific classes
- records grades by subject
- supports three grade entry modes:
- sequential entry by student list
- entry for one selected student
- bulk text or voice-based parsing
- generates class reports in:
- text format
- Excel format
- shows student performance summaries
- generates structured student feedback reports
- supports a developer mode for system inspection
- can temporarily disable the bot for regular users through middleware
/startonboarding- create the first class if the teacher has none yet
- open the main menu
- choose a class
- add students
- choose a subject
- enter grades
- review class and student performance
The bot supports several real-world workflows for entering grades:
-
By student list
- open a class
- choose a subject
- go through students one by one
- add grades using buttons or voice
-
For one selected student
- choose a specific student first
- enter only their grades
-
Bulk input
- send one text message like:
Ivanov 5 4 Petrov 3 - or send a voice message
- the parser matches students and grades before confirmation
- send one text message like:
- class grade sheet in Telegram text
- Excel export for a class and subject
- student performance summary
- generated student feedback report with:
- behavior
- diligence
- recommendation
- focus subjects
- optional teacher comment
If DEVELOPER_ID matches the Telegram user ID, the bot allows switching between:
- teacher mode
- developer mode
Developer mode lets you inspect:
- teachers
- classes
- students
- grade data
- overall system summary
- Python 3.11+
- aiogram
- SQLite
- python-dotenv
- openpyxl
- SpeechRecognition
- pydub
- static-ffmpeg
school_journal_bot/
|-- bot.py # Application entry point
|-- config.py # Environment configuration
|-- database.py # SQLite schema and data access
|-- grade_parser.py # Bulk text grade parsing
|-- keyboards.py # Telegram keyboards
|-- requirements.txt # Python dependencies
|-- handlers/
| |-- start.py # Onboarding and role switching
| |-- grades.py # Grade entry flows
| |-- students.py # Class and student management
| |-- reports.py # Text and Excel reports
| |-- support.py # Contact developer flow
| `-- developer.py # Developer inspection tools
|-- utils/
| |-- average.py # Average calculation helpers
| |-- excel_export.py # Excel report generation
| |-- ai_reporter.py # Student feedback report builder
| |-- middleware.py # Activation middleware
| `-- speech_to_text.py # Voice to text helper
`-- tests/
`-- test_bot_flows.py # Bot flow tests
python -m venv .venvPowerShell:
.\.venv\Scripts\Activate.ps1CMD:
.venv\Scripts\activate.batmacOS / Linux:
source .venv/bin/activatepip install -r requirements.txtWindows PowerShell:
Copy-Item .env.example .envmacOS / Linux:
cp .env.example .envRequired variables:
BOT_TOKEN=your_telegram_bot_token
DEVELOPER_ID=your_telegram_user_id
BOT_ENABLED=Truepython bot.pypython -m unittest discover -s testsRun the bot:
run_bot.batRun hidden:
start_bot_hidden.vbsStop the bot:
stop_bot.bat/start
After onboarding, the teacher can use the menu to:
- enter grades
- open the class list
- generate a grade sheet
- contact the developer
Ivanov 5 4 Petrov 3
- Start the bot with
/start - Create a class such as
7A - Add students
- Select a subject
- Choose a grade entry mode
- Save grades
- Generate a text or Excel report
- The bot interface is currently oriented toward Russian-speaking teachers and schools.
- SQLite databases are created locally and automatically.
- Voice recognition depends on the local speech stack and FFmpeg-related tooling.
- Default subjects are preloaded during database initialization.
The project includes automated flow tests for:
- onboarding
- duplicate class protection
- developer mode
- class management
- sequential grade entry
- bulk grade parsing
- report generation
- support flow
- voice input error handling
- activation middleware behavior
Run them with:
python -m unittest discover -s testsThis repository is prepared to exclude local-only files such as:
- virtual environments
- SQLite databases
- logs
- cache files
- temporary voice files
.env
Arseniy Atrokhov