# aarukami/hentaiwatch architecture

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

- Interactive diagram: https://gitdiagram.com/aarukami/hentaiwatch
- Repository: https://github.com/aarukami/hentaiwatch

## Overview

HentaiWatch is a Telegram bot. Users send commands or inline queries; Pyrogram dispatches them to handlers that localize responses, retrieve doujinshi metadata and covers, and return messages or inline results. Other flows let users request Telegraph pages, submit a title to the configured channel, and let configured sudoers run shell or Python commands. The graph reflects sampled handler calls and the README’s documented help flow; unsampled behavior is not inferred.

Main entry points: [`plugins/utils.py`](https://github.com/aarukami/hentaiwatch/blob/main/plugins/utils.py) (Doujinshi utilities), [`plugins/nhentai.py`](https://github.com/aarukami/hentaiwatch/blob/main/plugins/nhentai.py) (Command handlers), [`plugins/inline.py`](https://github.com/aarukami/hentaiwatch/blob/main/plugins/inline.py) (Inline queries), [`plugins/sudoers.py`](https://github.com/aarukami/hentaiwatch/blob/main/plugins/sudoers.py) (Sudo commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_bot["Pyrogram bot<br/>[bot.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
end

subgraph group_features["User features"]
  node_commands["Command handlers<br/>[nhentai.py]"]
  node_inline["Inline queries<br/>[inline.py]"]
  node_locale["Localization<br/>[locale.py]"]
  node_locale_files["Locale strings"]
end

subgraph group_services["Content services"]
  node_content["Doujinshi utilities<br/>[utils.py]"]
  node_hentai_service["Hentai metadata service"]
  node_image_source["Image page source"]
  node_telegraph["Telegraph"]
end

subgraph group_admin["Administration"]
  node_sudo["Sudo commands<br/>[sudoers.py]"]
end

node_users(("Telegram users"))
node_telegram["Telegram API"]

node_users -->|"send requests"| node_telegram
node_telegram -->|"delivers updates"| node_bot
node_bot -->|"loads settings"| node_config
node_bot -->|"loads plugins"| node_commands
node_commands -->|"replies and publishes"| node_telegram
node_commands -->|"gets title data"| node_content
node_commands -->|"loads strings"| node_locale
node_inline -->|"answers queries"| node_telegram
node_inline -->|"gets title data"| node_content
node_inline -->|"requests page"| node_telegraph
node_inline -->|"gets title details"| node_hentai_service
node_commands -->|"chooses random ID"| node_hentai_service
node_content -->|"formats localized caption"| node_locale
node_locale -->|"loads JSON strings"| node_locale_files
node_content -->|"fetches doujinshi"| node_hentai_service
node_content -->|"fetches page images"| node_image_source
node_content -->|"creates published page"| node_telegraph
node_commands -->|"uses channel settings"| node_config
node_inline -->|"uses menu setting"| node_config
node_sudo -->|"replies to admins"| node_telegram
node_sudo -->|"gets title data"| node_content
node_sudo -->|"requests page"| node_telegraph
node_sudo -->|"uses admin settings"| node_config

click node_bot "https://github.com/aarukami/hentaiwatch/blob/main/bot.py"
click node_config "https://github.com/aarukami/hentaiwatch/blob/main/config.py"
click node_commands "https://github.com/aarukami/hentaiwatch/blob/main/plugins/nhentai.py"
click node_inline "https://github.com/aarukami/hentaiwatch/blob/main/plugins/inline.py"
click node_locale "https://github.com/aarukami/hentaiwatch/blob/main/plugins/locale.py"
click node_locale_files "https://github.com/aarukami/hentaiwatch/tree/main/plugins/locale"
click node_content "https://github.com/aarukami/hentaiwatch/blob/main/plugins/utils.py"
click node_sudo "https://github.com/aarukami/hentaiwatch/blob/main/plugins/sudoers.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_config,node_users toneBlue
class node_commands,node_inline,node_locale,node_locale_files toneAmber
class node_content,node_hentai_service,node_image_source,node_telegraph,node_telegram toneMint
class node_sudo toneRose
```

## Components

### Bot runtime

- [Pyrogram bot](https://github.com/aarukami/hentaiwatch/blob/main/bot.py): `bot.py`
- [Runtime configuration](https://github.com/aarukami/hentaiwatch/blob/main/config.py): `config.py`

### User features

- [Command handlers](https://github.com/aarukami/hentaiwatch/blob/main/plugins/nhentai.py): `plugins/nhentai.py`
- [Inline queries](https://github.com/aarukami/hentaiwatch/blob/main/plugins/inline.py): `plugins/inline.py`
- [Localization](https://github.com/aarukami/hentaiwatch/blob/main/plugins/locale.py): `plugins/locale.py`
- [Locale strings](https://github.com/aarukami/hentaiwatch/tree/main/plugins/locale): `plugins/locale`

### Content services

- [Doujinshi utilities](https://github.com/aarukami/hentaiwatch/blob/main/plugins/utils.py): `plugins/utils.py`
- **Hentai metadata service**
- **Image page source**
- **Telegraph**

### Administration

- [Sudo commands](https://github.com/aarukami/hentaiwatch/blob/main/plugins/sudoers.py): `plugins/sudoers.py`

### Other components

- **Telegram users**
- **Telegram API**

## Connections

- Telegram users → Telegram API: send requests (evidence: `README.md`)
- Telegram API → Pyrogram bot: delivers updates (evidence: `bot.py`)
- Pyrogram bot → Runtime configuration: loads settings (evidence: `bot.py`)
- Pyrogram bot → Command handlers: loads plugins (evidence: `bot.py`)
- Command handlers → Telegram API: replies and publishes (evidence: `plugins/nhentai.py`)
- Command handlers → Doujinshi utilities: gets title data (evidence: `plugins/nhentai.py`)
- Command handlers → Localization: loads strings (evidence: `plugins/nhentai.py`)
- Inline queries → Telegram API: answers queries (evidence: `plugins/inline.py`)
- Inline queries → Doujinshi utilities: gets title data (evidence: `plugins/inline.py`)
- Inline queries → Telegraph: requests page (evidence: `plugins/inline.py`)
- Inline queries → Hentai metadata service: gets title details (evidence: `plugins/inline.py`)
- Command handlers → Hentai metadata service: chooses random ID (evidence: `plugins/nhentai.py`)
- Doujinshi utilities → Localization: formats localized caption (evidence: `plugins/utils.py`)
- Localization → Locale strings: loads JSON strings (evidence: `plugins/locale.py`)
- Doujinshi utilities → Hentai metadata service: fetches doujinshi (evidence: `plugins/utils.py`)
- Doujinshi utilities → Image page source: fetches page images (evidence: `plugins/utils.py`)
- Doujinshi utilities → Telegraph: creates published page (evidence: `plugins/utils.py`)
- Command handlers → Runtime configuration: uses channel settings (evidence: `plugins/nhentai.py`)
- Inline queries → Runtime configuration: uses menu setting (evidence: `plugins/inline.py`)
- Sudo commands → Telegram API: replies to admins (evidence: `plugins/sudoers.py`)
- Sudo commands → Doujinshi utilities: gets title data (evidence: `plugins/sudoers.py`)
- Sudo commands → Telegraph: requests page (evidence: `plugins/sudoers.py`)
- Sudo commands → Runtime configuration: uses admin settings (evidence: `plugins/sudoers.py`)
