# nekoimeiov/astrbot_plugin_reneban architecture

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

- Interactive diagram: https://gitdiagram.com/nekoimeiov/astrbot_plugin_reneban
- Repository: https://github.com/nekoimeiov/astrbot_plugin_reneban

## Overview

ReNeBan is an AstrBot blacklist plugin. Administrators issue commands to create, adjust, remove, reset, or inspect temporary/permanent user and session records; the plugin persists those records, and event checks apply session-first, pass-before-ban decisions. Main command handling and the enforcement checker are distinct runtime responsibilities, supported by a model/expiry layer and file-backed storage. The excerpts show command-to-storage and enforcement-to-storage behavior; event-hook wiring and some command handlers are not visible, so those links are omitted or marked unverified.

Main entry points: [`main.py`](https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/main.py) (Command Handlers), [`datafile_manager.py`](https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/datafile_manager.py) (Data Manager), [`user_manager.py`](https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/user_manager.py) (Timed Records), [`event_utils.py`](https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/event_utils.py) (Ban Decision)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_commands["Admin Commands"]
  node_commands_main["Command Handlers<br/>[main.py]"]
  node_command_text["Help And Replies<br/>[strings.py]"]
end

subgraph group_checks["Enforcement"]
  node_event_check["Ban Decision<br/>[event_utils.py]"]
end

subgraph group_records["Record Management"]
  node_models["Timed Records<br/>[user_manager.py]"]
  node_time_parse["Time Parsing<br/>[time_utils.py]"]
  node_record_errors["Domain Errors<br/>[exceptions.py]"]
end

subgraph group_storage["Persistence"]
  node_file_manager["Data Manager"]
  node_record_files[("Blacklist Files")]
end

node_admin(("Administrator"))
node_astrbot["AstrBot Runtime"]

node_admin -->|"issues commands"| node_commands_main
node_commands_main -->|"reads and writes"| node_file_manager
node_commands_main -->|"parses durations"| node_time_parse
node_commands_main -->|"formats replies"| node_command_text
node_astrbot -.->|"dispatches events"| node_event_check
node_event_check -->|"checks records"| node_file_manager
node_file_manager -->|"reads and commits"| node_record_files
node_file_manager -->|"uses record models"| node_models
node_models -->|"normalizes reasons"| node_command_text
node_models -->|"raises time errors"| node_record_errors
node_time_parse -->|"raises parse errors"| node_record_errors

click node_commands_main "https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/main.py"
click node_command_text "https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/strings.py"
click node_event_check "https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/event_utils.py"
click node_models "https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/user_manager.py"
click node_time_parse "https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/time_utils.py"
click node_record_errors "https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/exceptions.py"
click node_file_manager "https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/datafile_manager.py"
click node_record_files "https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/datafile_manager.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_commands_main,node_command_text toneBlue
class node_event_check toneAmber
class node_models,node_time_parse,node_record_errors toneMint
class node_file_manager,node_record_files toneRose
class node_admin,node_astrbot toneIndigo
```

## Components

### Admin Commands

- [Command Handlers](https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/main.py): `main.py`
- [Help And Replies](https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/strings.py): `strings.py`

### Enforcement

- [Ban Decision](https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/event_utils.py): `event_utils.py`

### Record Management

- [Timed Records](https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/user_manager.py): `user_manager.py`
- [Time Parsing](https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/time_utils.py): `time_utils.py`
- [Domain Errors](https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/exceptions.py): `exceptions.py`

### Persistence

- [Data Manager](https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/datafile_manager.py): `datafile_manager.py`
- [Blacklist Files](https://github.com/nekoimeiov/astrbot_plugin_reneban/blob/main/datafile_manager.py): `datafile_manager.py`

### Other components

- **Administrator**
- **AstrBot Runtime**

## Connections

- Administrator → Command Handlers: issues commands (evidence: `README.md`)
- Command Handlers → Data Manager: reads and writes (evidence: `main.py`)
- Command Handlers → Time Parsing: parses durations (evidence: `main.py`)
- Command Handlers → Help And Replies: formats replies (evidence: `main.py`)
- AstrBot Runtime → Ban Decision: dispatches events
- Ban Decision → Data Manager: checks records (evidence: `event_utils.py`)
- Data Manager → Blacklist Files: reads and commits (evidence: `datafile_manager.py`)
- Data Manager → Timed Records: uses record models (evidence: `datafile_manager.py`)
- Timed Records → Help And Replies: normalizes reasons (evidence: `user_manager.py`)
- Timed Records → Domain Errors: raises time errors (evidence: `user_manager.py`)
- Time Parsing → Domain Errors: raises parse errors (evidence: `time_utils.py`)
