# leea28/sumup architecture

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

- Interactive diagram: https://gitdiagram.com/leea28/sumup
- Repository: https://github.com/leea28/sumup

## Overview

SumUp is a Discord catch-up bot: a user requests a private summary, the bot chooses the channel-history window, formats messages, asks an AI model to summarize them, and records successful catch-up state. The graph includes the documented command and privacy/settings capabilities. Source evidence is strongest for the excerpted bot, database, summarizer, and time utilities; the README documents major behavior where the excerpt omits command details.

Main entry points: [`bot.py`](https://github.com/leea28/sumup/blob/main/bot.py) (Commands and orchestration), [`summarizer.py`](https://github.com/leea28/sumup/blob/main/summarizer.py) (Summary generation), [`state.py`](https://github.com/leea28/sumup/blob/main/state.py) (User state access), [`timeutils.py`](https://github.com/leea28/sumup/blob/main/timeutils.py) (Since and timezone parsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discord["Discord interaction"]
  node_bot["Commands and orchestration<br/>[bot.py]"]
end

subgraph group_catchup["Catch-up workflow"]
  node_window["History window selection<br/>[bot.py]"]
  node_transcript["Transcript formatting<br/>[bot.py]"]
  node_summary["Summary generation<br/>[summarizer.py]"]
end

subgraph group_personalization["User settings"]
  node_time["Since and timezone parsing<br/>[timeutils.py]"]
  node_state["User state access<br/>[state.py]"]
end

subgraph group_services["External services"]
  node_postgres[("PostgreSQL state")]
  node_discordsvc{{"Discord platform"}}
  node_openai{{"OpenAI API"}}
end

node_user(("Discord user"))

node_user -->|"invokes commands"| node_bot
node_bot -->|"reads channel history"| node_discordsvc
node_bot -->|"selects messages"| node_window
node_bot -->|"parses since"| node_time
node_bot -->|"loads and saves state"| node_state
node_window -.->|"formats messages"| node_transcript
node_bot -->|"requests summary"| node_summary
node_summary -->|"sends transcript"| node_openai
node_bot -->|"sends private reply"| node_discordsvc
node_state -->|"reads and writes"| node_postgres
node_bot -->|"registers commands"| node_discordsvc

click node_bot "https://github.com/leea28/sumup/blob/main/bot.py"
click node_window "https://github.com/leea28/sumup/blob/main/bot.py"
click node_transcript "https://github.com/leea28/sumup/blob/main/bot.py"
click node_summary "https://github.com/leea28/sumup/blob/main/summarizer.py"
click node_time "https://github.com/leea28/sumup/blob/main/timeutils.py"
click node_state "https://github.com/leea28/sumup/blob/main/state.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_bot,node_user toneBlue
class node_window,node_transcript,node_summary toneAmber
class node_time,node_state toneMint
class node_postgres,node_discordsvc,node_openai toneRose
```

## Components

### Discord interaction

- [Commands and orchestration](https://github.com/leea28/sumup/blob/main/bot.py): `bot.py`

### Catch-up workflow

- [History window selection](https://github.com/leea28/sumup/blob/main/bot.py): `bot.py`
- [Transcript formatting](https://github.com/leea28/sumup/blob/main/bot.py): `bot.py`
- [Summary generation](https://github.com/leea28/sumup/blob/main/summarizer.py): `summarizer.py`

### User settings

- [Since and timezone parsing](https://github.com/leea28/sumup/blob/main/timeutils.py): `timeutils.py`
- [User state access](https://github.com/leea28/sumup/blob/main/state.py): `state.py`

### External services

- **PostgreSQL state**
- **Discord platform**
- **OpenAI API**

### Other components

- **Discord user**

## Connections

- Discord user → Commands and orchestration: invokes commands (evidence: `README.md`)
- Commands and orchestration → Discord platform: reads channel history (evidence: `README.md`)
- Commands and orchestration → History window selection: selects messages (evidence: `bot.py`)
- Commands and orchestration → Since and timezone parsing: parses since (evidence: `bot.py`)
- Commands and orchestration → User state access: loads and saves state (evidence: `bot.py`)
- History window selection → Transcript formatting: formats messages (evidence: `bot.py`)
- Commands and orchestration → Summary generation: requests summary (evidence: `bot.py`)
- Summary generation → OpenAI API: sends transcript (evidence: `summarizer.py`)
- Commands and orchestration → Discord platform: sends private reply (evidence: `README.md`)
- User state access → PostgreSQL state: reads and writes (evidence: `state.py`)
- Commands and orchestration → Discord platform: registers commands (evidence: `bot.py`)
