db123 9d123316e6 feat: Hijri calendar, virtual midnight crossover, overlap rejection, WAL mode
- Hijri (قمری) calendar added as 3rd calendar option with tabular conversion
- Calendar type select menu (like accent) with gregorian/jalali/hijri
- Calendar type applied to exports and reports
- Midnight crossover: virtual splits at computation time (no synthetic DB events)
  - Handles both UTC and local timezone boundaries
  - Timezone changes handled naturally (recomputed on-the-fly)
- Rate limiting per user ID instead of chat ID
- WAL mode enabled for SQLite
- Smart reply keyboard updates after every state change
- Overlapping time edits rejected (must preserve in/out alternation)
- Single event deletion warns if timeline needs repair
- Day off no longer prevents clock in/out
- Accent colors shown with descriptive names in select menu
- Delete button label changed to DEL for visual distinction
2026-06-24 09:39:15 +03:30
2026-06-23 22:36:41 +03:30

WorkTime Bot

A single-user Telegram time-tracking bot. Clock in/out, toggle remote/onsite, mark day off, get daily reports, and export monthly Excel reports.

Quick Start

cp .env.example .env
# edit .env — set BOT_TOKEN and BOT_ALLOWED_USERS
docker compose up -d

Environment Variables

Variable Purpose
BOT_TOKEN Telegram Bot API token (required)
BOT_ALLOWED_USERS Comma-separated Telegram user IDs (empty = allow all)
HTTPS_PROXY Outbound proxy for Telegram API (e.g. http://proxy:10808)
DB_PATH Path to SQLite database (default: db.sqlite3)
BOT_WEBHOOK_URL Set for webhook mode (omit for polling)

Usage

Persistent reply keyboard at the bottom: Clock In / Clock Out

Inline menu on /start:

  • Clock In / Clock Out
  • Report / Export
  • Toggle Remote/Onsite / Day Off

Commands

Command Action
/start Show inline menu
Clock In or /clockin Record clock-in
Clock Out or /clockout Record clock-out
/remote Toggle remote/onsite mode
/report Today's work & break summary
/export Monthly .xlsx report
/dayoff Toggle today as day off

Daily report is sent automatically at 23:00.

How Break Time Works

The gap between a clock-out and the next clock-in is counted as break:

09:00 Clock In     → work starts
12:00 Clock Out    → work: 3h, break starts
13:00 Clock In     → break: 1h, work resumes
17:00 Clock Out    → work: 4h
                    total: 7h work, 1h break

Project Structure

├── cmd/bot/           main.go, webhook.go
├── internal/
│   ├── bot/           handlers, export, totals
│   └── db/            SQLite store
├── db/schema.sql      Database schema
├── Dockerfile
└── docker-compose.yml

Build

docker compose up -d --build
Description
No description provided
Readme 375 KiB
Languages
Go 99.6%
Makefile 0.2%
Dockerfile 0.2%