# eliac-d/dix-bot architecture

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

- Interactive diagram: https://gitdiagram.com/eliac-d/dix-bot
- Repository: https://github.com/eliac-d/dix-bot

## Overview

Kiriti-Bot-MD is a WhatsApp assistant. Its principal workflow is a user sending a command, the bot handling it, and a response returning through WhatsApp. The README documents broad command families, while excerpts show startup, event observation, sub-bot message handling, persistence, and utilities. Several command handlers and the main message-dispatch wiring were not sampled; those links are therefore marked unverified rather than presented as confirmed calls.

Main entry points: [`core/message.js`](https://github.com/eliac-d/dix-bot/blob/main/core/message.js) (Message handling), [`index.js`](https://github.com/eliac-d/dix-bot/blob/main/index.js) (Bot startup), [`core/s/serbot-bridge.js`](https://github.com/eliac-d/dix-bot/blob/main/core/s/serbot-bridge.js) (Linked bots), [`core/event/detect.js`](https://github.com/eliac-d/dix-bot/blob/main/core/event/detect.js) (Group events)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_main["Bot startup<br/>[index.js]"]
  node_events["Group events<br/>[detect.js]"]
  node_messages["Message handling<br/>[message.js]"]
  node_subbots["Linked bots<br/>[serbot-bridge.js]"]
  node_reactions["Event moderation<br/>[antistatus.js]"]
end

subgraph group_features["Command features"]
  node_stickers["Stickers and media"]
  node_downloads["Media downloads"]
  node_ai["AI features"]
  node_groups["Group moderation"]
  node_tools["Tools and search"]
  node_search["Search commands"]
  node_games["Games and fun"]
  node_fun["Social and gacha"]
  node_gacha["Character collection"]
  node_anime["Anime reactions"]
  node_nsfw["Adult commands"]
end

subgraph group_state["State and identity"]
  node_auth[("Session credentials<br/>[auth_lmdb.js]")]
  node_db[("Application database<br/>[db_adapter.js]")]
  node_cache["Runtime caches<br/>[cache.js]"]
  node_identity["JID resolution<br/>[identifier.js]"]
end

subgraph group_support["Bot utilities"]
  node_serializer["Message serialization<br/>[serializer.js]"]
  node_limiter["Rate and queue limits<br/>[limiter.js]"]
  node_metrics[("Usage metrics<br/>[metrics.js]")]
  node_config["Bot configuration<br/>[functions.js]"]
  node_preview["Link previews<br/>[preview-link.js]"]
  node_workers["Worker processing"]
end

node_user(("WhatsApp user"))
node_whatsapp{{"WhatsApp"}}

node_user -->|"sends commands"| node_whatsapp
node_whatsapp -->|"connects bot"| node_main
node_main -->|"loads credentials"| node_auth
node_main -->|"loads linked bots"| node_subbots
node_main -.->|"observes events"| node_events
node_whatsapp -.->|"delivers messages"| node_messages
node_messages -.->|"uses serialization"| node_serializer
node_messages -->|"resolves sender"| node_identity
node_messages -->|"limits operations"| node_limiter
node_messages -->|"records usage"| node_metrics
node_events -->|"observes status"| node_reactions
node_subbots -->|"parses messages"| node_serializer
node_subbots -->|"queues commands"| node_limiter
node_messages -.->|"dispatches commands"| node_stickers
node_messages -.->|"dispatches commands"| node_downloads
node_messages -.->|"dispatches commands"| node_ai
node_messages -.->|"dispatches commands"| node_groups
node_messages -.->|"dispatches commands"| node_tools
node_messages -.->|"dispatches commands"| node_search
node_messages -.->|"dispatches commands"| node_games
node_messages -.->|"dispatches commands"| node_fun
node_messages -.->|"dispatches commands"| node_gacha
node_messages -.->|"dispatches commands"| node_anime
node_messages -.->|"dispatches commands"| node_nsfw
node_gacha -->|"reads and writes"| node_db
node_main -->|"saves user data"| node_db
node_main -->|"flushes metrics"| node_metrics
node_main -->|"initializes previews"| node_preview
node_subbots -->|"loads configuration"| node_config
node_workers -.->|"processes work"| node_messages

click node_main "https://github.com/eliac-d/dix-bot/blob/main/index.js"
click node_events "https://github.com/eliac-d/dix-bot/blob/main/core/event/detect.js"
click node_messages "https://github.com/eliac-d/dix-bot/blob/main/core/message.js"
click node_subbots "https://github.com/eliac-d/dix-bot/blob/main/core/s/serbot-bridge.js"
click node_reactions "https://github.com/eliac-d/dix-bot/blob/main/core/event/antistatus.js"
click node_stickers "https://github.com/eliac-d/dix-bot/tree/main/modules/STICKERS"
click node_downloads "https://github.com/eliac-d/dix-bot/tree/main/modules/DOWNLOAD"
click node_ai "https://github.com/eliac-d/dix-bot/tree/main/modules/IA"
click node_groups "https://github.com/eliac-d/dix-bot/tree/main/modules/GROUP"
click node_tools "https://github.com/eliac-d/dix-bot/tree/main/modules/TOOLS"
click node_search "https://github.com/eliac-d/dix-bot/tree/main/modules/SEARCH"
click node_games "https://github.com/eliac-d/dix-bot/tree/main/modules/GAME"
click node_fun "https://github.com/eliac-d/dix-bot/tree/main/modules/SOCIAL"
click node_gacha "https://github.com/eliac-d/dix-bot/tree/main/modules/GACHA"
click node_anime "https://github.com/eliac-d/dix-bot/tree/main/modules/ANIME"
click node_nsfw "https://github.com/eliac-d/dix-bot/tree/main/modules/NSFW"
click node_auth "https://github.com/eliac-d/dix-bot/blob/main/core/s/auth_lmdb.js"
click node_db "https://github.com/eliac-d/dix-bot/blob/main/database/db_adapter.js"
click node_cache "https://github.com/eliac-d/dix-bot/blob/main/core/cache.js"
click node_identity "https://github.com/eliac-d/dix-bot/blob/main/core/identifier.js"
click node_serializer "https://github.com/eliac-d/dix-bot/blob/main/core/serializer.js"
click node_limiter "https://github.com/eliac-d/dix-bot/blob/main/core/limiter.js"
click node_metrics "https://github.com/eliac-d/dix-bot/blob/main/core/metrics.js"
click node_config "https://github.com/eliac-d/dix-bot/blob/main/src/config/functions.js"
click node_preview "https://github.com/eliac-d/dix-bot/blob/main/src/utils/preview-link.js"
click node_workers "https://github.com/eliac-d/dix-bot/tree/main/src/workers"

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_events,node_messages,node_subbots,node_reactions,node_user toneBlue
class node_stickers,node_downloads,node_ai,node_groups,node_tools,node_search,node_games,node_fun,node_gacha,node_anime,node_nsfw toneAmber
class node_auth,node_db,node_cache,node_identity toneMint
class node_serializer,node_limiter,node_metrics,node_config,node_preview,node_workers toneRose
class node_whatsapp toneIndigo
```

## Components

### Bot runtime

- [Bot startup](https://github.com/eliac-d/dix-bot/blob/main/index.js): `index.js`
- [Group events](https://github.com/eliac-d/dix-bot/blob/main/core/event/detect.js): `core/event/detect.js`
- [Message handling](https://github.com/eliac-d/dix-bot/blob/main/core/message.js): `core/message.js`
- [Linked bots](https://github.com/eliac-d/dix-bot/blob/main/core/s/serbot-bridge.js): `core/s/serbot-bridge.js`
- [Event moderation](https://github.com/eliac-d/dix-bot/blob/main/core/event/antistatus.js): `core/event/antistatus.js`

### Command features

- [Stickers and media](https://github.com/eliac-d/dix-bot/tree/main/modules/STICKERS): `modules/STICKERS`
- [Media downloads](https://github.com/eliac-d/dix-bot/tree/main/modules/DOWNLOAD): `modules/DOWNLOAD`
- [AI features](https://github.com/eliac-d/dix-bot/tree/main/modules/IA): `modules/IA`
- [Group moderation](https://github.com/eliac-d/dix-bot/tree/main/modules/GROUP): `modules/GROUP`
- [Tools and search](https://github.com/eliac-d/dix-bot/tree/main/modules/TOOLS): `modules/TOOLS`
- [Search commands](https://github.com/eliac-d/dix-bot/tree/main/modules/SEARCH): `modules/SEARCH`
- [Games and fun](https://github.com/eliac-d/dix-bot/tree/main/modules/GAME): `modules/GAME`
- [Social and gacha](https://github.com/eliac-d/dix-bot/tree/main/modules/SOCIAL): `modules/SOCIAL`
- [Character collection](https://github.com/eliac-d/dix-bot/tree/main/modules/GACHA): `modules/GACHA`
- [Anime reactions](https://github.com/eliac-d/dix-bot/tree/main/modules/ANIME): `modules/ANIME`
- [Adult commands](https://github.com/eliac-d/dix-bot/tree/main/modules/NSFW): `modules/NSFW`

### State and identity

- [Session credentials](https://github.com/eliac-d/dix-bot/blob/main/core/s/auth_lmdb.js): `core/s/auth_lmdb.js`
- [Application database](https://github.com/eliac-d/dix-bot/blob/main/database/db_adapter.js): `database/db_adapter.js`
- [Runtime caches](https://github.com/eliac-d/dix-bot/blob/main/core/cache.js): `core/cache.js`
- [JID resolution](https://github.com/eliac-d/dix-bot/blob/main/core/identifier.js): `core/identifier.js`

### Bot utilities

- [Message serialization](https://github.com/eliac-d/dix-bot/blob/main/core/serializer.js): `core/serializer.js`
- [Rate and queue limits](https://github.com/eliac-d/dix-bot/blob/main/core/limiter.js): `core/limiter.js`
- [Usage metrics](https://github.com/eliac-d/dix-bot/blob/main/core/metrics.js): `core/metrics.js`
- [Bot configuration](https://github.com/eliac-d/dix-bot/blob/main/src/config/functions.js): `src/config/functions.js`
- [Link previews](https://github.com/eliac-d/dix-bot/blob/main/src/utils/preview-link.js): `src/utils/preview-link.js`
- [Worker processing](https://github.com/eliac-d/dix-bot/tree/main/src/workers): `src/workers`

### Other components

- **WhatsApp user**
- **WhatsApp**

## Connections

- WhatsApp user → WhatsApp: sends commands (evidence: `README.md`)
- WhatsApp → Bot startup: connects bot (evidence: `index.js`)
- Bot startup → Session credentials: loads credentials (evidence: `index.js`)
- Bot startup → Linked bots: loads linked bots (evidence: `index.js`)
- Bot startup → Group events: observes events (evidence: `index.js`)
- WhatsApp → Message handling: delivers messages
- Message handling → Message serialization: uses serialization
- Message handling → JID resolution: resolves sender (evidence: `core/message.js`)
- Message handling → Rate and queue limits: limits operations (evidence: `core/message.js`)
- Message handling → Usage metrics: records usage (evidence: `core/message.js`)
- Group events → Event moderation: observes status (evidence: `core/event/detect.js`)
- Linked bots → Message serialization: parses messages (evidence: `core/s/serbot-bridge.js`)
- Linked bots → Rate and queue limits: queues commands (evidence: `core/s/serbot-bridge.js`)
- Message handling → Stickers and media: dispatches commands
- Message handling → Media downloads: dispatches commands
- Message handling → AI features: dispatches commands
- Message handling → Group moderation: dispatches commands
- Message handling → Tools and search: dispatches commands
- Message handling → Search commands: dispatches commands
- Message handling → Games and fun: dispatches commands
- Message handling → Social and gacha: dispatches commands
- Message handling → Character collection: dispatches commands
- Message handling → Anime reactions: dispatches commands
- Message handling → Adult commands: dispatches commands
- Character collection → Application database: reads and writes (evidence: `modules/GACHA/claim.js`)
- Bot startup → Application database: saves user data (evidence: `index.js`)
- Bot startup → Usage metrics: flushes metrics (evidence: `index.js`)
- Bot startup → Link previews: initializes previews (evidence: `index.js`)
- Linked bots → Bot configuration: loads configuration (evidence: `core/s/serbot-bridge.js`)
- Worker processing → Message handling: processes work
