# wbndmqaq/astrbot_plugin_dagongren architecture

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

- Interactive diagram: https://gitdiagram.com/wbndmqaq/astrbot_plugin_dagongren
- Repository: https://github.com/wbndmqaq/astrbot_plugin_dagongren

## Overview

This is an AstrBot group-chat workplace-life simulation: users issue commands, domain services update player state and produce a result, then the plugin renders and sends it. The graph also preserves the documented management panel, backups, scheduled lottery/push behavior, and major gameplay branches. Some domain handlers and services were not sampled; their placement and links are based on the README’s architecture and capability descriptions, not inspection of their implementations.

Main entry points: [`core/db/_core.py`](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/db/_core.py) (SQLite storage), [`main.py`](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/main.py) (Plugin runtime), [`core/review.py`](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/review.py) (Annual review), [`core/logic.py`](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/logic.py) (Shared rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Command interaction"]
  node_main["Plugin runtime<br/>[main.py]"]
  node_routes["Route installer<br/>[base.py]"]
  node_career_cmds["Career commands<br/>[career_cmds.py]"]
  node_life_cmds["Life commands<br/>[life_cmds.py]"]
  node_finance_cmds["Finance commands<br/>[finance_cmds.py]"]
  node_stock_cmds["Stock commands<br/>[stock_cmds.py]"]
end

subgraph group_simulation["Career and life"]
  node_career["Career services<br/>[career.py]"]
  node_life["Life services<br/>[life.py]"]
  node_life_extra["Office and travel<br/>[life2.py]"]
  node_review["Annual review<br/>[review.py]"]
end

subgraph group_activities["Social and finance"]
  node_social["Duel and ranking<br/>[social.py]"]
  node_finance["Bank and funds<br/>[finance.py]"]
  node_stocks["Stock market<br/>[stocks.py]"]
  node_lottery["Lottery<br/>[lottery.py]"]
end

subgraph group_runtime["Shared runtime"]
  node_db[("SQLite storage<br/>[_core.py]")]
  node_db_schema[("Storage schema<br/>[_const.py]")]
  node_gamedata["Game data<br/>[gamedata.py]"]
  node_logic["Shared rules<br/>[logic.py]"]
  node_results["Command result<br/>[result.py]"]
  node_renderer["Output renderer<br/>[renderer.py]"]
  node_backup["Online backups<br/>[backup.py]"]
end

subgraph group_management["Management panel"]
  node_webui["WebUI server<br/>[_serve.py]"]
  node_admin["Admin APIs<br/>[_admin.py]"]
  node_webdeps["Core adapters<br/>[_deps.py]"]
  node_webclient["Panel client<br/>[app.js]"]
  node_auth["Web authentication<br/>[web_auth.py]"]
end

node_players(("Players"))

node_players -->|"issues commands"| node_routes
node_main -->|"installs routes"| node_routes
node_routes -->|"dispatches"| node_career_cmds
node_routes -->|"dispatches"| node_life_cmds
node_career_cmds -.->|"calls"| node_career
node_life_cmds -->|"calls"| node_life
node_career_cmds -->|"routes review"| node_review
node_finance_cmds -.->|"calls"| node_finance
node_stock_cmds -->|"calls"| node_stocks
node_main -->|"renders output"| node_renderer
node_main -->|"initializes"| node_db
node_main -->|"creates manager"| node_backup
node_main -->|"starts panel"| node_webui
node_main -->|"runs lottery"| node_lottery
node_career -.->|"reads and writes"| node_db
node_life -.->|"reads and writes"| node_db
node_life_extra -.->|"reads and writes"| node_db
node_finance -.->|"reads and writes"| node_db
node_stocks -->|"trades through"| node_db
node_lottery -->|"reads and writes"| node_db
node_social -->|"reads and writes"| node_db
node_review -->|"saves results"| node_db
node_db -->|"uses schema"| node_db_schema
node_career -->|"uses rules"| node_logic
node_career -->|"loads content"| node_gamedata
node_review -->|"calculates with"| node_logic
node_review -->|"loads grades"| node_gamedata
node_review -->|"returns"| node_results
node_social -->|"uses rules"| node_logic
node_social -->|"loads content"| node_gamedata
node_stocks -->|"uses rules"| node_logic
node_lottery -->|"loads rules"| node_gamedata
node_lottery -->|"uses rules"| node_logic
node_webui -->|"serves panel"| node_webclient
node_webui -->|"registers APIs"| node_admin
node_admin -->|"uses adapters"| node_webdeps
node_webdeps -->|"imports storage"| node_db
node_webdeps -->|"imports auth"| node_auth

click node_main "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/main.py"
click node_routes "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/handlers/base.py"
click node_career_cmds "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/handlers/career_cmds.py"
click node_life_cmds "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/handlers/life_cmds.py"
click node_finance_cmds "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/handlers/finance_cmds.py"
click node_stock_cmds "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/handlers/stock_cmds.py"
click node_career "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/career.py"
click node_life "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/life.py"
click node_life_extra "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/life2.py"
click node_review "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/review.py"
click node_social "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/social.py"
click node_finance "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/finance.py"
click node_stocks "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/stocks.py"
click node_lottery "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/lottery.py"
click node_db "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/db/_core.py"
click node_db_schema "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/db/_const.py"
click node_gamedata "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/gamedata.py"
click node_logic "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/logic.py"
click node_results "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/result.py"
click node_renderer "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/renderer.py"
click node_backup "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/backup.py"
click node_webui "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/webui/server/_serve.py"
click node_admin "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/webui/server/_admin.py"
click node_webdeps "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/webui/server/_deps.py"
click node_webclient "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/webui/app.js"
click node_auth "https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/web_auth.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_main,node_routes,node_career_cmds,node_life_cmds,node_finance_cmds,node_stock_cmds toneBlue
class node_career,node_life,node_life_extra,node_review toneAmber
class node_social,node_finance,node_stocks,node_lottery toneMint
class node_db,node_db_schema,node_gamedata,node_logic,node_results,node_renderer,node_backup toneRose
class node_webui,node_admin,node_webdeps,node_webclient,node_auth,node_players toneIndigo
```

## Components

### Command interaction

- [Plugin runtime](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/main.py): `main.py`
- [Route installer](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/handlers/base.py): `handlers/base.py`
- [Career commands](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/handlers/career_cmds.py): `handlers/career_cmds.py`
- [Life commands](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/handlers/life_cmds.py): `handlers/life_cmds.py`
- [Finance commands](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/handlers/finance_cmds.py): `handlers/finance_cmds.py`
- [Stock commands](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/handlers/stock_cmds.py): `handlers/stock_cmds.py`

### Career and life

- [Career services](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/career.py): `core/career.py`
- [Life services](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/life.py): `core/life.py`
- [Office and travel](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/life2.py): `core/life2.py`
- [Annual review](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/review.py): `core/review.py`

### Social and finance

- [Duel and ranking](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/social.py): `core/social.py`
- [Bank and funds](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/finance.py): `core/finance.py`
- [Stock market](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/stocks.py): `core/stocks.py`
- [Lottery](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/lottery.py): `core/lottery.py`

### Shared runtime

- [SQLite storage](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/db/_core.py): `core/db/_core.py`
- [Storage schema](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/db/_const.py): `core/db/_const.py`
- [Game data](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/gamedata.py): `core/gamedata.py`
- [Shared rules](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/logic.py): `core/logic.py`
- [Command result](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/result.py): `core/result.py`
- [Output renderer](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/renderer.py): `core/renderer.py`
- [Online backups](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/backup.py): `core/backup.py`

### Management panel

- [WebUI server](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/webui/server/_serve.py): `webui/server/_serve.py`
- [Admin APIs](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/webui/server/_admin.py): `webui/server/_admin.py`
- [Core adapters](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/webui/server/_deps.py): `webui/server/_deps.py`
- [Panel client](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/webui/app.js): `webui/app.js`
- [Web authentication](https://github.com/wbndmqaq/astrbot_plugin_dagongren/blob/main/core/web_auth.py): `core/web_auth.py`

### Other components

- **Players**

## Connections

- Players → Route installer: issues commands (evidence: `README.md`)
- Plugin runtime → Route installer: installs routes (evidence: `main.py`)
- Route installer → Career commands: dispatches (evidence: `README.md`)
- Route installer → Life commands: dispatches (evidence: `README.md`)
- Career commands → Career services: calls
- Life commands → Life services: calls (evidence: `README.md`)
- Career commands → Annual review: routes review (evidence: `README.md`)
- Finance commands → Bank and funds: calls
- Stock commands → Stock market: calls (evidence: `handlers/stock_cmds.py`)
- Plugin runtime → Output renderer: renders output (evidence: `main.py`)
- Plugin runtime → SQLite storage: initializes (evidence: `main.py`)
- Plugin runtime → Online backups: creates manager (evidence: `main.py`)
- Plugin runtime → WebUI server: starts panel (evidence: `main.py`)
- Plugin runtime → Lottery: runs lottery (evidence: `main.py`)
- Career services → SQLite storage: reads and writes
- Life services → SQLite storage: reads and writes
- Office and travel → SQLite storage: reads and writes
- Bank and funds → SQLite storage: reads and writes
- Stock market → SQLite storage: trades through (evidence: `core/stocks.py`)
- Lottery → SQLite storage: reads and writes (evidence: `core/lottery.py`)
- Duel and ranking → SQLite storage: reads and writes (evidence: `core/social.py`)
- Annual review → SQLite storage: saves results (evidence: `core/review.py`)
- SQLite storage → Storage schema: uses schema (evidence: `core/db/__init__.py`)
- Career services → Shared rules: uses rules
- Career services → Game data: loads content
- Annual review → Shared rules: calculates with (evidence: `core/review.py`)
- Annual review → Game data: loads grades (evidence: `core/review.py`)
- Annual review → Command result: returns (evidence: `core/review.py`)
- Duel and ranking → Shared rules: uses rules (evidence: `core/social.py`)
- Duel and ranking → Game data: loads content (evidence: `core/social.py`)
- Stock market → Shared rules: uses rules (evidence: `core/stocks.py`)
- Lottery → Game data: loads rules (evidence: `core/lottery.py`)
- Lottery → Shared rules: uses rules (evidence: `core/lottery.py`)
- WebUI server → Panel client: serves panel (evidence: `README.md`)
- WebUI server → Admin APIs: registers APIs (evidence: `webui/server/__init__.py`)
- Admin APIs → Core adapters: uses adapters (evidence: `webui/server/_admin.py`)
- Core adapters → SQLite storage: imports storage (evidence: `webui/server/_deps.py`)
- Core adapters → Web authentication: imports auth (evidence: `webui/server/_deps.py`)
