A Telegram bot that allows students of the Department of Mathematics and Computer Science at the University of Perugia to view and book seats for daily lectures, with real-time availability tracking.
Developed by Luca Capuccini and Edoardo Tommasi for the Software Engineering course — Bachelor's Degree in Computer Science, University of Perugia.
- Student authentication — login via 6-digit student ID (matricola) and password
- Daily lecture schedule — fetched live from the university's room booking system (MRBS)
- Seat booking — reserve a seat in a lecture with real-time availability check per classroom
- Booking cancellation — cancel an existing reservation, which frees up the seat
- Capacity enforcement — each classroom has a defined maximum capacity; bookings are blocked when full
| Component | Technology |
|---|---|
| Bot framework | pyTelegramBotAPI |
| Database | SQLite3 |
| Schedule scraping | requests + BeautifulSoup |
| Language | Python 3 |
Three tables managed in database_tg.db:
freshman— student credentials (matricola,password)prenotazioni— bookings (matricola,lezione) — primary key on both columns prevents duplicatesposti_prenotati— seat counter per lecture (lezione,posti)
| Command | Description |
|---|---|
/start |
Start the bot and authenticate with student ID and password |
/lista_lezioni |
Show today's lecture schedule with room and time info |
/prenotazione_lezioni |
Book a seat in a lecture |
/cancella_prenotazione |
Cancel an existing booking |
- The bot scrapes today's timetable from
servizi.dmi.unipg.it/mrbsat startup. - The student logs in with their matricola and password (verified against the
freshmantable). - Once authenticated, the student can list available lectures, book one by name, or cancel a previous booking.
- Before confirming a booking, the bot checks available seats by comparing booked seats against the room's capacity.
| Room | Capacity |
|---|---|
| A0 | 180 |
| A2 | 180 |
| I1 | 215 |
| I2 | 90 |
| A3 | 70 |
| Riunioni | 40 |
| B3 | 35 |
| B1 | 30 |
| C3 | 25 |
| C2 | 20 |
| Verde | 18 |
| Gialla | 17 |
-
Install dependencies:
pip install pyTelegramBotAPI requests beautifulsoup4
-
Set your bot token in
Migliorato.py:TOKEN = "your_token_here"
-
Run the bot:
python Migliorato.py