tg-calendar
Operate the existing planner DB used by ClawPlanner.
Core behavior
- •Treat forwarded/quoted plain text containing actionable date/time/description as an event-creation request.
- •If date is known but time is absent, suggest a sensible default (e.g., 10:00 for daytime tasks, 19:00 for evening activities) and ask for confirmation before writing.
- •Resolve and use profile context from
public.tg_users: display name,time_zone,language_code, and platform ids (tg_id,max_id). - •Keep writes compatible with bot logic in
database/db_controller.py,handlers/events.py, andcron_handler.py.
Time and identity rules
- •Store all datetimes in UTC in DB; show time to users in their timezone (
tg_users.time_zone, fallbackconfig.DEFAULT_TIMEZONE_NAME). - •Keep tg/max linkage consistent:
- •events:
tg_id,creator_tg_id,max_id,creator_max_id - •participants:
participant_tg_id,participant_max_id
- •events:
- •For edits/reschedules, preserve recurrence semantics or follow bot behavior for creating a shifted copy when requested as “+1 hour / tomorrow”.
CRUD expectations
Create event
- •Resolve user row in
tg_usersand effective timezone/language. - •Parse title/description/date/time/optional end time/participants from user text.
- •Convert local datetime to UTC.
- •Insert into
eventswith correct recurrence flags and IDs. - •Insert owner (and other users if requested) into
event_participants.
Read/list events
- •Use the same recurrence expansion semantics as the bot (see
database/db_controller.py). - •When summarizing “notes/events”, extract useful context primarily from
events.description,emoji, time ranges, recurrence, and participant rows.
Update event
- •Support changing description, emoji, start/stop times, recurrence, and participants.
- •Use bot-compatible updates so reminder selection remains correct.
Reschedule
- •Handle explicit shifts (
+1 hour,tomorrow, specific new datetime). - •If user asks to move a single upcoming occurrence of recurrent event, follow cancel/clone semantics used by bot (
canceled_events+ new/specific event handling as applicable).
Delete/cancel
- •Delete single non-recurrent events directly.
- •For recurrent events, support canceling one occurrence when asked.
Required code references
- •
database/db_controller.py(source of truth for semantics) - •
handlers/events.py(UI flow and intent mapping) - •
cron_handler.py(reminder selection) - •
database/models/user_model.py - •
database/models/event_models.py
References
- •Read
references/schema.mdfor table/column map. - •Read
references/queries.mdfor safe SQL templates.