# zaxerion/kinda-wabot architecture

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

- Interactive diagram: https://gitdiagram.com/zaxerion/kinda-wabot
- Repository: https://github.com/zaxerion/kinda-wabot

## Overview

kinda-wabot is a Node.js WhatsApp bot with Toram game-information and general chat/group utilities. Its principal workflow is: WhatsApp delivers a message through the Baileys connection, the handler normalizes and dispatches it to loaded plugins, and the selected command responds through the connection. Startup also loads persistent data and Toram data; the README documents pairing and dev modes. The excerpts establish the main dispatch and storage wiring, but not the internals of most plugin commands, so those are grouped by domain rather than given speculative call chains.

Main entry points: [`lib/connection.js`](https://github.com/zaxerion/kinda-wabot/blob/main/lib/connection.js) (WhatsApp connection), [`lib/database.js`](https://github.com/zaxerion/kinda-wabot/blob/main/lib/database.js) (Application database), [`main.js`](https://github.com/zaxerion/kinda-wabot/blob/main/main.js) (Startup), [`handler.js`](https://github.com/zaxerion/kinda-wabot/blob/main/handler.js) (Message handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_startup["Startup<br/>[main.js]"]
  node_connection["WhatsApp connection<br/>[connection.js]"]
  node_handler["Message handler<br/>[handler.js]"]
  node_pluginloader["Plugin loader<br/>[plugins.js]"]
end

subgraph group_features["Bot capabilities"]
  node_plugins["Chat and group commands"]
  node_toramguide["Toram guides<br/>[guide.js]"]
  node_torambuffs["Toram buffs<br/>[shortbuff.js]"]
  node_toramcommands["Toram commands"]
  node_menugenerator["Command menu<br/>[main.js]"]
end

subgraph group_state["Persistence"]
  node_database[("Application database<br/>[database.js]")]
  node_mongo[("MongoDB adapter<br/>[mongoDB.js]")]
  node_cloudadapter[("Cloud DB adapter<br/>[cloudDBAdapter.js]")]
end

subgraph group_shared["Shared services"]
  node_messageutils["Message serialization<br/>[simple.js]"]
  node_toramdata["Toram data refresh<br/>[toramfetch.js]"]
  node_media["Media conversion<br/>[converter.js]"]
  node_stickers["Sticker processing<br/>[sticker.js]"]
  node_imageupload["Image upload<br/>[uploadImage.js]"]
  node_utilities["Runtime utilities<br/>[func.js]"]
end

node_user(("WhatsApp user"))
node_wa(("WhatsApp"))

node_user -->|"sends messages"| node_wa
node_wa -.->|"delivers events"| node_connection
node_connection -->|"loads handler"| node_handler
node_handler -->|"reads plugins"| node_pluginloader
node_pluginloader -->|"loads modules"| node_plugins
node_handler -->|"loads state"| node_database
node_handler -->|"uses connection"| node_connection
node_connection -->|"connects via Baileys"| node_wa
node_startup -->|"starts connection"| node_connection
node_startup -->|"loads plugins"| node_pluginloader
node_startup -->|"writes state"| node_database
node_startup -->|"refreshes data"| node_toramdata
node_database -->|"selects adapter"| node_mongo
node_database -->|"selects adapter"| node_cloudadapter
node_menugenerator -->|"lists commands"| node_pluginloader
node_menugenerator -->|"reads state"| node_database
node_messageutils -->|"converts audio"| node_media
node_plugins -.->|"uses utilities"| node_utilities
node_plugins -->|"uses sticker tools"| node_stickers
node_stickers -->|"uses conversion"| node_media
node_plugins -->|"uploads media"| node_imageupload
node_toramcommands -.->|"provides guide"| node_toramguide
node_toramcommands -.->|"provides buffs"| node_torambuffs

click node_startup "https://github.com/zaxerion/kinda-wabot/blob/main/main.js"
click node_connection "https://github.com/zaxerion/kinda-wabot/blob/main/lib/connection.js"
click node_handler "https://github.com/zaxerion/kinda-wabot/blob/main/handler.js"
click node_pluginloader "https://github.com/zaxerion/kinda-wabot/blob/main/lib/plugins.js"
click node_plugins "https://github.com/zaxerion/kinda-wabot/tree/main/plugins"
click node_toramguide "https://github.com/zaxerion/kinda-wabot/blob/main/plugins/toram/guide.js"
click node_torambuffs "https://github.com/zaxerion/kinda-wabot/blob/main/plugins/toram/shortbuff.js"
click node_toramcommands "https://github.com/zaxerion/kinda-wabot/tree/main/plugins/toram"
click node_menugenerator "https://github.com/zaxerion/kinda-wabot/blob/main/plugins/menu/main.js"
click node_database "https://github.com/zaxerion/kinda-wabot/blob/main/lib/database.js"
click node_mongo "https://github.com/zaxerion/kinda-wabot/blob/main/lib/DB_Adapters/mongoDB.js"
click node_cloudadapter "https://github.com/zaxerion/kinda-wabot/blob/main/lib/DB_Adapters/cloudDBAdapter.js"
click node_messageutils "https://github.com/zaxerion/kinda-wabot/blob/main/lib/simple.js"
click node_toramdata "https://github.com/zaxerion/kinda-wabot/blob/main/lib/toramfetch.js"
click node_media "https://github.com/zaxerion/kinda-wabot/blob/main/lib/converter.js"
click node_stickers "https://github.com/zaxerion/kinda-wabot/blob/main/lib/sticker.js"
click node_imageupload "https://github.com/zaxerion/kinda-wabot/blob/main/lib/uploadImage.js"
click node_utilities "https://github.com/zaxerion/kinda-wabot/blob/main/lib/func.js"

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_startup,node_connection,node_handler,node_pluginloader,node_user toneBlue
class node_plugins,node_toramguide,node_torambuffs,node_toramcommands,node_menugenerator toneAmber
class node_database,node_mongo,node_cloudadapter toneMint
class node_messageutils,node_toramdata,node_media,node_stickers,node_imageupload,node_utilities toneRose
class node_wa toneIndigo
```

## Components

### Bot runtime

- [Startup](https://github.com/zaxerion/kinda-wabot/blob/main/main.js): `main.js`
- [WhatsApp connection](https://github.com/zaxerion/kinda-wabot/blob/main/lib/connection.js): `lib/connection.js`
- [Message handler](https://github.com/zaxerion/kinda-wabot/blob/main/handler.js): `handler.js`
- [Plugin loader](https://github.com/zaxerion/kinda-wabot/blob/main/lib/plugins.js): `lib/plugins.js`

### Bot capabilities

- [Chat and group commands](https://github.com/zaxerion/kinda-wabot/tree/main/plugins): `plugins`
- [Toram guides](https://github.com/zaxerion/kinda-wabot/blob/main/plugins/toram/guide.js): `plugins/toram/guide.js`
- [Toram buffs](https://github.com/zaxerion/kinda-wabot/blob/main/plugins/toram/shortbuff.js): `plugins/toram/shortbuff.js`
- [Toram commands](https://github.com/zaxerion/kinda-wabot/tree/main/plugins/toram): `plugins/toram`
- [Command menu](https://github.com/zaxerion/kinda-wabot/blob/main/plugins/menu/main.js): `plugins/menu/main.js`

### Persistence

- [Application database](https://github.com/zaxerion/kinda-wabot/blob/main/lib/database.js): `lib/database.js`
- [MongoDB adapter](https://github.com/zaxerion/kinda-wabot/blob/main/lib/DB_Adapters/mongoDB.js): `lib/DB_Adapters/mongoDB.js`
- [Cloud DB adapter](https://github.com/zaxerion/kinda-wabot/blob/main/lib/DB_Adapters/cloudDBAdapter.js): `lib/DB_Adapters/cloudDBAdapter.js`

### Shared services

- [Message serialization](https://github.com/zaxerion/kinda-wabot/blob/main/lib/simple.js): `lib/simple.js`
- [Toram data refresh](https://github.com/zaxerion/kinda-wabot/blob/main/lib/toramfetch.js): `lib/toramfetch.js`
- [Media conversion](https://github.com/zaxerion/kinda-wabot/blob/main/lib/converter.js): `lib/converter.js`
- [Sticker processing](https://github.com/zaxerion/kinda-wabot/blob/main/lib/sticker.js): `lib/sticker.js`
- [Image upload](https://github.com/zaxerion/kinda-wabot/blob/main/lib/uploadImage.js): `lib/uploadImage.js`
- [Runtime utilities](https://github.com/zaxerion/kinda-wabot/blob/main/lib/func.js): `lib/func.js`

### Other components

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

## Connections

- WhatsApp user → WhatsApp: sends messages
- WhatsApp → WhatsApp connection: delivers events
- WhatsApp connection → Message handler: loads handler (evidence: `lib/connection.js`)
- Message handler → Plugin loader: reads plugins (evidence: `handler.js`)
- Plugin loader → Chat and group commands: loads modules (evidence: `lib/plugins.js`)
- Message handler → Application database: loads state (evidence: `handler.js`)
- Message handler → WhatsApp connection: uses connection (evidence: `handler.js`)
- WhatsApp connection → WhatsApp: connects via Baileys (evidence: `lib/connection.js`)
- Startup → WhatsApp connection: starts connection (evidence: `main.js`)
- Startup → Plugin loader: loads plugins (evidence: `main.js`)
- Startup → Application database: writes state (evidence: `main.js`)
- Startup → Toram data refresh: refreshes data (evidence: `main.js`)
- Application database → MongoDB adapter: selects adapter (evidence: `lib/database.js`)
- Application database → Cloud DB adapter: selects adapter (evidence: `lib/database.js`)
- Command menu → Plugin loader: lists commands (evidence: `plugins/menu/main.js`)
- Command menu → Application database: reads state (evidence: `plugins/menu/main.js`)
- Message serialization → Media conversion: converts audio (evidence: `lib/simple.js`)
- Chat and group commands → Runtime utilities: uses utilities (evidence: `plugins/menu/main.js`)
- Chat and group commands → Sticker processing: uses sticker tools (evidence: `plugins/sticker/sticker.js`)
- Sticker processing → Media conversion: uses conversion (evidence: `lib/sticker.js`)
- Chat and group commands → Image upload: uploads media (evidence: `plugins/tools/tomp4.js`)
- Toram commands → Toram guides: provides guide (evidence: `plugins/toram/guide.js`)
- Toram commands → Toram buffs: provides buffs (evidence: `plugins/toram/shortbuff.js`)
