live
Semestra
Telegram bot that keeps a university timetable and reminds you before class.
Semestra keeps a university timetable. The timetable is exported once as an .ics file, and from then on the bot answers questions about it in a chat: what is next, what is today, what is this week. It also sends a reminder before a class starts and a notice when it does.
The interesting decisions are about time. The timezone is read from the file instead of asked for. Weekly repeats are expanded into one row per occurrence at import, so a schedule query is a range scan and not a recurrence calculation. Each import carries its own id and a re-import deletes by that id, so an event present in both files keeps its row, and a reminder already sent is not sent again. Merging a reissued timetable keeps the weeks already taught and replaces only what is still ahead.
The bot's clock is a module that can be pinned or shifted, which is how a bot whose whole job is time gets tested at a moment other than the one it happens to run. It runs as a systemd user service and deploys over SSH from a push to main.