PazniculGrupei is a Telegram bot that makes tracking and viewing student attendance a breeze.
Group leaders can mark attendance with a tap, view detailed reports, and students can self-check their stats—all without leaving Telegram.
See the features of @PazniculGrupeiBot
The Greeting Page is your bot's central dashboard, designed for maximum convenience and lightning‑fast access:
- Instantly view yesterday's, today's, tomorrow's or this week's timetable.
- Toggle between dark and light modes for comfortable viewing in any environment.
-
Displays the student's name and role (Student, Monitor, Admin, etc.) pulled directly from the database.
Clicking "This Week" brings up your full timetable for the current week, with:
Odd/Even Indicator
- A clear badge (Odd or Even) shows which rotation you're in.
Day-by-Day Grid
- Columns for Monday → Friday (or Saturday, Sunday if you have weekend classes)
- Rows for each time slot (08:00–09:30, 09:45–11:15, etc.)
Cells display:
- Session type (curs., sem., lab.)
- Subject name
- Location (room or lab)
-
View My Attendance (individual student history)
-
Log Attendance (for Monitors and Admins)
-
View Group Attendance (full group statistics for Monitors and Admins)
Everything you need as a Monitor - schedule lookup, attendance logging, and analytics—is automated and just one click away.
Each student can view and analyze their own attendance data through:
-
Today, This Week, This Month, and All Time.
-
Shows total sessions, total absences (unmotivated vs. motivated) and absence rate.
-
All Time card adds "Lab Misses" count and an Estimated Fee for any missed labs.
-
Lecture, seminar and lab absence counts & percentages
-
Overall absence rate per subject
-
This Week
-
This Month
-
All Time
This page gives students both a high‑level snapshot and deep dives into their attendance history—complete with custom lab‑fee estimates for missed practical sessions.
This page empowers Monitors, Admins, and Moderators to record and review group attendance with ease:
- Quickly jump to any past session using the "← 4d", "← 3d", "Today", "→ 1d" buttons, then return to the full schedule.
- Each student's row shows one toggle per time slot—green for present, red for absent.
- For any absence, check Motivated and enter a custom reason (e.g. "Being late", "Feels sick").
- See which user marked each attendance entry and when, directly in the table.
- Monitors, Admins, and Moderators can update attendance toggles or motivation flags after the fact.
- Each edited cell shows the user's name and the exact timestamp of the last change.
- Every update is recorded in the database, ensuring a complete, tamper‑proof audit trail.
Everything is laid out in a responsive, dark/light‑theme table for fast, accurate logging and complete accountability.
This page provides a high‑level overview of your entire group's attendance:
-
Today, This Week, This Month, and All Time
-
Format: Present / Total (S%)
- Today, This Week, Month, All Time – sessions attended / total (%)
All percentages are calculated on‑the‑fly, giving you instant insight into who's on track and who may need follow‑up.
The Export Attendance feature lets you download your group's attendance data as a CSV file. You can choose from five export modes:
| Button | Description |
|---|---|
| This Week | All sessions from Monday through Sunday of the current week |
| This Month | All sessions in the current calendar month |
| All Time | Every recorded session since the database was created |
| By Subject | Attendance broken out per subject over the selected period |
| By Student | Detailed, per-student history over the selected period |
-
Header rows
- Row 1:
Group,<Your-Group-Name> - (When exporting "By Subject" only) Row 2:
Subject,<Subject-Name> - Next row:
Date,<Date1>,<Date2>,…
- Row 1:
-
Data rows
-
File naming convention
Example: group_241_attendance_month_01.08.2025
├── config.php # Database & app configuration (env-based)
├── db.php # Database functions & queries
├── index.php # Main attendance logging page
├── edit_attendance.php # Edit historical attendance records
├── view_attendance.php # View individual attendance stats
├── view_group_attendance.php # View group-level attendance
├── greeting.php # Landing/greeting page
├── time_restrict.php # Time-based access control logic
├── oe_weeks.php # Semester/week type calculations
├── log_stats.php # Statistics logging endpoint
├── export.php # Export attendance data
├── script.js # Frontend UI logic (minified)
├── style.css # Main stylesheet
├── tableb.css # Compact table layout
├── tablec.css # Big table layout
└── init_db.sql # SQL DB Structure example
- PHP 8.0+ with PDO MySQL extension
- nginx or Apache2 modules
- MySQL 5.7+ or MariaDB 10.3+ for the DB
- Telegram Bot Token from BotFather
Click to expand (Core Setup)
-
Open a chat with @BotFather in Telegram.
-
Send
/newbot, then follow prompts to choose:- Name: Your bot's display name (e.g. AttendanceBot)
- Username: Must end in
_bot(e.g. AttendanceDemo_bot)
-
When BotFather returns your API token, copy it.
-
Enable Mini App:
- Send
/mybots, then choose your bot - Bot Settings → Configure Mini App → Enable Mini App
- Set the Mini App URL (see hosting setup below)
- Send
-
Store your Bot Token securely:
- Create
/etc/attendance-bot.envwith:BOT_TOKEN=your-telegram-bot-token APP_HOST=https://your-domain-or-tunnel.com SECRET_TOKEN=some-random-secret DB_HOST=127.0.0.1 DB_NAME=attendance_utm DB_USER=DBuser DB_PASS=your-db-password
- Create
Click to expand (Recommended for always-on setup)
- Raspberry Pi (Zero 2 W is more than enough for a few grups)
- A domain (e.g.,
domain-example.com) - Cloudflare account (free tier account is OK)
sudo apt update && sudo apt upgrade -y
sudo apt install -y nginx php-fpm php-mysql mysql-server git curl
# Enable and start services
sudo systemctl enable nginx php-fpm
sudo systemctl start nginx php-fpmCreate /etc/nginx/sites-available/attendance-bot:
sudo tee /etc/nginx/sites-available/attendance-bot > /dev/null << 'EOF'
server {
listen 80;
server_name _;
root /var/www/html/attendance-bot;
index index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
EOF
sudo ln -s /etc/nginx/sites-available/attendance-bot /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginxcd /var/www/html
sudo git clone <your-repo> attendance-bot
cd attendance-bot
sudo chown -R www-data:www-data .sudo mysql -u root -p < migration_slotid_time_slots.sql
# Create database user if not exists:
# CREATE USER 'DBuser'@'localhost' IDENTIFIED BY 'your-db-password';
# GRANT ALL PRIVILEGES ON attendance_utm.* TO 'DBuser'@'localhost';sudo tee /etc/attendance-bot.env > /dev/null << 'EOF'
BOT_TOKEN=your-bot-token-here
APP_HOST=https://domain-example.com
SECRET_TOKEN=your-secret-token-here
DB_HOST=127.0.0.1
DB_NAME=attendance_utm
DB_USER=DBuser
DB_PASS=your-db-password
EOF
sudo chmod 600 /etc/attendance-bot.env# Install cloudflared
curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm64.deb
sudo dpkg -i cloudflared.deb
# Authenticate
cloudflared tunnel login
# Follow the browser prompt to authorize your Cloudflare account
# Create tunnel
cloudflared tunnel create attendance-bot
cloudflared tunnel route dns attendance-bot domain-example.comCreate ~/.cloudflared/config.yml:
tunnel: attendance-bot
credentials-file: /home/pi/.cloudflared/attendance-bot.json
ingress:
- hostname: domain-example.com
service: http://localhost
- service: http_status:404sudo cloudflared service install
sudo systemctl start cloudflared
sudo systemctl enable cloudflared
# Check status
sudo systemctl status cloudflaredhttps://domain-example.com/greeting.php
- Open your bot in Telegram
- Tap the Mini App button
- You should see the greeting page
Click to expand (skip if you've already done this)
- XAMPP Control Panel installed and running:
- Apache → port 80
- MySQL → port 3306
- Your bot's code in
C:\xampp\htdocs\TG-Bot-Folder
Open in your browser: http://localhost/TG-Bot-Folder
You should see your page.
As Admin in PowerShell:
Through Chocolatey choco install ngrok -y then run ngrok http 80
Chocolatey Installation:
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Or Manually:
- Download ngrok: https://ngrok.com/download
- Unzip
ngrok.exeto, e.g.,C:\tools\ngrok\ - Sign up at https://dashboard.ngrok.com/signup and copy your authtoken from "Get Started"
- In PowerShell:
cd C:\tools\ngrok .\ngrok.exe config add-authtoken YOUR_AUTHTOKEN
cd C:\tools\ngrok
.\ngrok.exe http 80
Copy the Forwarding URL (e.g. https://abcd1234.ngrok-free.app).
Invoke-WebRequest "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook?url=<NGROK_URL>/TG_Bot/webhook.php"
Send /start to your bot; it should reply.
View live HTTP logs at: http://127.0.0.1:4040/inspect/http
| Variable | Description | Example |
|---|---|---|
APP_HOST |
Public URL of your app | https://domain-example.com |
BOT_TOKEN |
Telegram Bot API token | 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11 |
SECRET_TOKEN |
Secret for request validation | your-random-secret-key |
DB_HOST |
MySQL host | 127.0.0.1 |
DB_NAME |
Database name | attendance_utm |
DB_USER |
Database user | DBuser |
DB_PASS |
Database password | your-secure-password |
- HTTPS only: Ensure your domain uses HTTPS (Cloudflare provides free SSL).
- Database backups: Regularly back up your MySQL database.
- Access control: Role-based permissions are enforced in
time_restrict.php.
Click to expand
- Verify
BOT_TOKENis correct in/etc/attendance-bot.env. - Check that your tunnel (Cloudflare or ngrok) is active and properly configured.
- Ensure MySQL is running:
sudo systemctl status mysql - Verify credentials in
/etc/attendance-bot.env. - Test connection:
mysql -u DBuser -p -h 127.0.0.1 attendance_utm
- If
Invalid user/Telegram IDcheck the DB tableusersfor wrongtg_idorrole. - Verify
APP_HOSTmatches your actual domain. - Check PHP error logs:
/var/log/php-errors.logorjournalctl -u apache2
