# pbew/olp-noir architecture

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

- Interactive diagram: https://gitdiagram.com/pbew/olp-noir
- Repository: https://github.com/pbew/olp-noir

## Overview

OLP-Noir is a Discord bot for operating a hosting/cafe service: staff create and extend customer bills, staff accept jobs, customers pay by sending a slip, and admins verify payment. Separate workflows handle support tickets, VIP purchases and lifecycle, reviews, reminders, and accounting cycles. The graph uses documented capabilities for unsampled cogs; their internal call wiring is not inferred. SQLite is the durable store; Google Sheets is an optional accounting integration.

Main entry points: [`core/database.py`](https://github.com/pbew/olp-noir/blob/main/core/database.py) (SQLite state), [`cogs/scheduler.py`](https://github.com/pbew/olp-noir/blob/main/cogs/scheduler.py) (Reminders and cycles), [`cogs/reception.py`](https://github.com/pbew/olp-noir/blob/main/cogs/reception.py) (Reception bills), [`cogs/vip.py`](https://github.com/pbew/olp-noir/blob/main/cogs/vip.py) (VIP self-service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_bot["Bot entry<br/>[bot.py]"]
end

subgraph group_billing["Service billing"]
  node_reception["Reception bills<br/>[reception.py]"]
  node_request["Request panel<br/>[requestpanel.py]"]
  node_payments["Payment review<br/>[payments.py]"]
  node_pricing["Pricing and quotas<br/>[pricing.py]"]
end

subgraph group_community["Support and reviews"]
  node_dmrouter["DM routing<br/>[dmrouter.py]"]
  node_tickets["Support tickets<br/>[tickets.py]"]
  node_reviews["Review moderation<br/>[reviews.py]"]
end

subgraph group_vip["VIP membership"]
  node_vip["VIP self-service<br/>[vip.py]"]
  node_viplogic["VIP lifecycle<br/>[vip_logic.py]"]
end

subgraph group_accounting["State and accounting"]
  node_scheduler["Reminders and cycles<br/>[scheduler.py]"]
  node_database[("SQLite state<br/>[database.py]")]
  node_sheets["Sheets client<br/>[sheets.py]"]
end

node_customer(("Customer"))
node_staff(("Staff"))
node_admin(("Admin"))
node_discord(("Discord"))
node_google[("Google Sheets")]

node_bot -->|"connects"| node_database
node_bot -->|"starts"| node_sheets
node_bot -->|"runs on"| node_discord
node_customer -->|"uses"| node_discord
node_staff -->|"uses"| node_discord
node_admin -->|"uses"| node_discord
node_discord -->|"invokes"| node_reception
node_discord -->|"invokes"| node_request
node_discord -->|"invokes"| node_vip
node_reception -->|"quotes"| node_pricing
node_reception -->|"stores bills"| node_database
node_reception -->|"starts payment"| node_payments
node_payments -->|"updates bills"| node_database
node_payments -->|"records paid bills"| node_sheets
node_dmrouter -->|"routes slips"| node_payments
node_dmrouter -->|"relays messages"| node_tickets
node_tickets -->|"stores tickets"| node_database
node_reviews -->|"stores reviews"| node_database
node_reviews -->|"posts approved reviews"| node_discord
node_vip -->|"calculates lifecycle"| node_viplogic
node_vip -->|"stores membership"| node_database
node_vip -->|"changes roles"| node_discord
node_scheduler -->|"checks scheduled state"| node_database
node_scheduler -->|"requests review invite"| node_reviews
node_scheduler -->|"starts accounting cycle"| node_sheets
node_scheduler -->|"sends reminders and summaries"| node_discord
node_sheets -.->|"writes accounting data"| node_google

click node_bot "https://github.com/pbew/olp-noir/blob/main/bot.py"
click node_reception "https://github.com/pbew/olp-noir/blob/main/cogs/reception.py"
click node_request "https://github.com/pbew/olp-noir/blob/main/cogs/requestpanel.py"
click node_payments "https://github.com/pbew/olp-noir/blob/main/cogs/payments.py"
click node_pricing "https://github.com/pbew/olp-noir/blob/main/core/pricing.py"
click node_dmrouter "https://github.com/pbew/olp-noir/blob/main/cogs/dmrouter.py"
click node_tickets "https://github.com/pbew/olp-noir/blob/main/cogs/tickets.py"
click node_reviews "https://github.com/pbew/olp-noir/blob/main/cogs/reviews.py"
click node_vip "https://github.com/pbew/olp-noir/blob/main/cogs/vip.py"
click node_viplogic "https://github.com/pbew/olp-noir/blob/main/core/vip_logic.py"
click node_scheduler "https://github.com/pbew/olp-noir/blob/main/cogs/scheduler.py"
click node_database "https://github.com/pbew/olp-noir/blob/main/core/database.py"
click node_sheets "https://github.com/pbew/olp-noir/blob/main/core/sheets.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 toneBlue
class node_reception,node_request,node_payments,node_pricing,node_google toneAmber
class node_dmrouter,node_tickets,node_reviews toneMint
class node_vip,node_viplogic toneRose
class node_scheduler,node_database,node_sheets,node_customer,node_staff,node_admin,node_discord toneIndigo
```

## Components

### Bot runtime

- [Bot entry](https://github.com/pbew/olp-noir/blob/main/bot.py): `bot.py`

### Service billing

- [Reception bills](https://github.com/pbew/olp-noir/blob/main/cogs/reception.py): `cogs/reception.py`
- [Request panel](https://github.com/pbew/olp-noir/blob/main/cogs/requestpanel.py): `cogs/requestpanel.py`
- [Payment review](https://github.com/pbew/olp-noir/blob/main/cogs/payments.py): `cogs/payments.py`
- [Pricing and quotas](https://github.com/pbew/olp-noir/blob/main/core/pricing.py): `core/pricing.py`

### Support and reviews

- [DM routing](https://github.com/pbew/olp-noir/blob/main/cogs/dmrouter.py): `cogs/dmrouter.py`
- [Support tickets](https://github.com/pbew/olp-noir/blob/main/cogs/tickets.py): `cogs/tickets.py`
- [Review moderation](https://github.com/pbew/olp-noir/blob/main/cogs/reviews.py): `cogs/reviews.py`

### VIP membership

- [VIP self-service](https://github.com/pbew/olp-noir/blob/main/cogs/vip.py): `cogs/vip.py`
- [VIP lifecycle](https://github.com/pbew/olp-noir/blob/main/core/vip_logic.py): `core/vip_logic.py`

### State and accounting

- [Reminders and cycles](https://github.com/pbew/olp-noir/blob/main/cogs/scheduler.py): `cogs/scheduler.py`
- [SQLite state](https://github.com/pbew/olp-noir/blob/main/core/database.py): `core/database.py`
- [Sheets client](https://github.com/pbew/olp-noir/blob/main/core/sheets.py): `core/sheets.py`

### Other components

- **Customer**
- **Staff**
- **Admin**
- **Discord**
- **Google Sheets**

## Connections

- Bot entry → SQLite state: connects
- Bot entry → Sheets client: starts
- Bot entry → Discord: runs on
- Customer → Discord: uses
- Staff → Discord: uses
- Admin → Discord: uses
- Discord → Reception bills: invokes
- Discord → Request panel: invokes
- Discord → VIP self-service: invokes
- Reception bills → Pricing and quotas: quotes
- Reception bills → SQLite state: stores bills
- Reception bills → Payment review: starts payment
- Payment review → SQLite state: updates bills
- Payment review → Sheets client: records paid bills
- DM routing → Payment review: routes slips
- DM routing → Support tickets: relays messages
- Support tickets → SQLite state: stores tickets
- Review moderation → SQLite state: stores reviews
- Review moderation → Discord: posts approved reviews
- VIP self-service → VIP lifecycle: calculates lifecycle
- VIP self-service → SQLite state: stores membership
- VIP self-service → Discord: changes roles
- Reminders and cycles → SQLite state: checks scheduled state
- Reminders and cycles → Review moderation: requests review invite
- Reminders and cycles → Sheets client: starts accounting cycle
- Reminders and cycles → Discord: sends reminders and summaries
- Sheets client → Google Sheets: writes accounting data
