These were never committed (hidden by status.showUntrackedFiles=no): without go.mod/go.sum a fresh clone would not build, and the source files committed in abb38e3 were missing their accompanying tests. |
||
|---|---|---|
| cmd/dyzur-bot | ||
| .dockerignore | ||
| .gitignore | ||
| .golangci.yml | ||
| .markdownlint-cli2.yaml | ||
| .pre-commit-config.yaml | ||
| Dockerfile | ||
| README.md | ||
| doc.go | ||
| go.mod | ||
| go.sum | ||
| scheduler.go | ||
| scheduler_test.go | ||
| service.go | ||
| service_test.go | ||
| sheet.go | ||
| sheet_test.go | ||
| store.go | ||
| store_test.go | ||
| telegram.go | ||
| telegram_test.go | ||
README.md
Dyżur-bot
A telegram bot for managing the cleaning rota in hackerspace. Bot offers weekly reminders about cleaning duties as well as on demand informations. Backend read the schedule from a Google sheet, store it in local JSON file.
Running
Requires GOOGLE_API_KEY, GOOGLE_SHEETS_ID, and BOT_TOKEN in the
environment or a .env file (see service.go/sheet.go for optional
SHEET_RANGE, ROTA_CACHE_PATH, SYNC_INTERVAL). Then:
go run ./cmd/dyzur-bot
The service loads the cached rota, syncs from Google Sheets in the background on
SYNC_INTERVAL (default 30m), and runs the Telegram bot via long polling until
interrupted (Ctrl-C / SIGTERM).
Run exactly one instance per bot token. The bot uses long polling (
getUpdates); two concurrent pollers on the same token make Telegram return HTTP 409 Conflict and updates get dropped. Do not scale this to multiple replicas.
Docker
docker build -t dyzur-bot .
docker run --rm --env-file .env -v dyzur-data:/data dyzur-bot
The image is a static binary on distroless (timezone data is embedded, so
reminders work without system tzdata). The rota cache lives at
/data/rota.json (ROTA_CACHE_PATH); mount a volume at /data to persist it
across restarts.
Commands
/kto_sprzata— who is on cleaning duty this week./sync— refresh the rota from Google Sheets now.
Reminders
If GROUP_CHAT_ID is set, the bot posts a weekly duty reminder to that chat.
Schedule (all optional, with defaults): REMINDER_WEEKDAY (default Monday),
REMINDER_HOUR (default 9, 0–23), DUTY_AHEAD_DAYS (default 14). The hour
is interpreted in Europe/Warsaw time. The reminder announces who is on duty
DUTY_AHEAD_DAYS from the fire time — e.g. every Monday 09:00, who cleans two
weeks out. Leave GROUP_CHAT_ID unset to disable reminders.