# togi-png/telegram-bot architecture

> Architecture diagram of the GitHub repository togi-png/telegram-bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/togi-png/telegram-bot
- Repository: https://github.com/togi-png/telegram-bot

## Overview

This repository combines a Telegram task-add command handler with a calendar-based academic planner that sends a daily summary. The planner fetches Canvas assignments and Google Calendar events, interprets deadlines and schedules, then formats and sends a notification. The README describes weekly assignment notifications, while the sampled notifier code shows classes, personal events, upcoming work, and suggested study blocks. The graph separates those product stages; unsampled implementation details are omitted.

Main entry points: [`notifier.py`](https://github.com/togi-png/telegram-bot/blob/main/notifier.py) (Planner Orchestrator), [`command_handler.py`](https://github.com/togi-png/telegram-bot/blob/main/command_handler.py) (Command Handler), [`tasks.json`](https://github.com/togi-png/telegram-bot/blob/main/tasks.json) (Task Store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_command["Task Commands"]
  node_command_handler["Command Handler<br/>[command_handler.py]"]
  node_task_store[("Task Store<br/>[tasks.json]")]
end

subgraph group_planner["Academic Planner"]
  node_notifier["Planner Orchestrator<br/>[notifier.py]"]
  node_calendar_events["Calendar Event Parsing<br/>[notifier.py]"]
  node_assignment_processing["Assignment Processing<br/>[notifier.py]"]
  node_study_planning["Study Block Planning<br/>[notifier.py]"]
  node_summary["Summary Formatting<br/>[notifier.py]"]
end

subgraph group_delivery["Notification Delivery"]
  node_message_sender["Message Sender<br/>[notifier.py]"]
end

node_student(("Student"))
node_telegram["Telegram API"]
node_google_calendar["Google Calendar Feed"]
node_canvas["Canvas Assignment Feed"]

node_student -->|"sends commands"| node_telegram
node_command_handler -->|"polls updates"| node_telegram
node_command_handler -->|"loads and saves"| node_task_store
node_command_handler -->|"sends confirmation"| node_telegram
node_notifier -->|"fetches feed"| node_google_calendar
node_notifier -->|"fetches feed"| node_canvas
node_notifier -->|"gets events"| node_calendar_events
node_notifier -->|"gets assignments"| node_assignment_processing
node_calendar_events -->|"provides classes"| node_study_planning
node_assignment_processing -->|"provides assignments"| node_study_planning
node_notifier -->|"builds report"| node_summary
node_summary -->|"provides message"| node_message_sender
node_message_sender -->|"sends notification"| node_telegram

click node_command_handler "https://github.com/togi-png/telegram-bot/blob/main/command_handler.py"
click node_task_store "https://github.com/togi-png/telegram-bot/blob/main/tasks.json"
click node_notifier "https://github.com/togi-png/telegram-bot/blob/main/notifier.py"
click node_calendar_events "https://github.com/togi-png/telegram-bot/blob/main/notifier.py"
click node_assignment_processing "https://github.com/togi-png/telegram-bot/blob/main/notifier.py"
click node_study_planning "https://github.com/togi-png/telegram-bot/blob/main/notifier.py"
click node_summary "https://github.com/togi-png/telegram-bot/blob/main/notifier.py"
click node_message_sender "https://github.com/togi-png/telegram-bot/blob/main/notifier.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_command_handler,node_task_store toneBlue
class node_notifier,node_calendar_events,node_assignment_processing,node_study_planning,node_summary toneAmber
class node_message_sender,node_telegram toneMint
class node_student,node_google_calendar,node_canvas toneIndigo
```

## Components

### Task Commands

- [Command Handler](https://github.com/togi-png/telegram-bot/blob/main/command_handler.py): `command_handler.py`
- [Task Store](https://github.com/togi-png/telegram-bot/blob/main/tasks.json): `tasks.json`

### Academic Planner

- [Planner Orchestrator](https://github.com/togi-png/telegram-bot/blob/main/notifier.py): `notifier.py`
- [Calendar Event Parsing](https://github.com/togi-png/telegram-bot/blob/main/notifier.py): `notifier.py`
- [Assignment Processing](https://github.com/togi-png/telegram-bot/blob/main/notifier.py): `notifier.py`
- [Study Block Planning](https://github.com/togi-png/telegram-bot/blob/main/notifier.py): `notifier.py`
- [Summary Formatting](https://github.com/togi-png/telegram-bot/blob/main/notifier.py): `notifier.py`

### Notification Delivery

- [Message Sender](https://github.com/togi-png/telegram-bot/blob/main/notifier.py): `notifier.py`

### Other components

- **Student**
- **Telegram API**
- **Google Calendar Feed**
- **Canvas Assignment Feed**

## Connections

- Student → Telegram API: sends commands
- Command Handler → Telegram API: polls updates (evidence: `command_handler.py`)
- Command Handler → Task Store: loads and saves (evidence: `command_handler.py`)
- Command Handler → Telegram API: sends confirmation (evidence: `command_handler.py`)
- Planner Orchestrator → Google Calendar Feed: fetches feed (evidence: `notifier.py`)
- Planner Orchestrator → Canvas Assignment Feed: fetches feed (evidence: `notifier.py`)
- Planner Orchestrator → Calendar Event Parsing: gets events (evidence: `notifier.py`)
- Planner Orchestrator → Assignment Processing: gets assignments (evidence: `notifier.py`)
- Calendar Event Parsing → Study Block Planning: provides classes (evidence: `notifier.py`)
- Assignment Processing → Study Block Planning: provides assignments (evidence: `notifier.py`)
- Planner Orchestrator → Summary Formatting: builds report (evidence: `notifier.py`)
- Summary Formatting → Message Sender: provides message (evidence: `notifier.py`)
- Message Sender → Telegram API: sends notification (evidence: `notifier.py`)
