# yusufusta/whatsasena architecture

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

- Interactive diagram: https://gitdiagram.com/yusufusta/whatsasena
- Repository: https://github.com/yusufusta/whatsasena

## Overview

WhatsAsena is a WhatsApp Web userbot. Its principal workflow is to receive WhatsApp messages, dispatch registered commands, and send replies or perform chat actions through the client. Feature modules also provide administration, group utilities, media tools, scraping, and configurable greetings/filters; selected features persist data through Sequelize-backed storage. The source index establishes several module references, but unsampled plugin internals limit confidence about their detailed behavior and external integrations.

Main entry points: [`events.js`](https://github.com/yusufusta/whatsasena/blob/master/events.js) (Command registry), [`bot.js`](https://github.com/yusufusta/whatsasena/blob/master/bot.js) (Bot startup), [`whatsasena/ReplyMessage.js`](https://github.com/yusufusta/whatsasena/blob/master/whatsasena/ReplyMessage.js) (Quoted replies), [`plugins/admin.js`](https://github.com/yusufusta/whatsasena/blob/master/plugins/admin.js) (Admin commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_bot["Bot startup<br/>[bot.js]"]
  node_registry["Command registry<br/>[events.js]"]
end

subgraph group_features["Bot features"]
  node_admin["Admin commands<br/>[admin.js]"]
  node_afk["AFK status<br/>[afk.js]"]
  node_filters["Message filters<br/>[filters.js]"]
  node_greetings["Group greetings<br/>[greetings.js]"]
  node_lydia["Lydia assistant<br/>[lydia.js]"]
  node_media["Media tools<br/>[memes.js]"]
  node_scrapers["Scrapers<br/>[scrapers.js]"]
  node_profile["Profile tools<br/>[profile.js]"]
  node_utilities["Chat utilities<br/>[tagall.js]"]
end

subgraph group_state["Configuration and state"]
  node_language["Language strings<br/>[language.js]"]
  node_config["Runtime configuration<br/>[config.js]"]
  node_filterdb[("Filter records<br/>[filters.js]")]
  node_greetingdb[("Greeting records<br/>[greetings.js]")]
  node_plugindb[("Plugin records<br/>[plugin.js]")]
end

subgraph group_client["WhatsApp client layer"]
  node_clientapi["WhatsApp client API<br/>[Base.js]"]
  node_messages["Message wrappers<br/>[Message.js]"]
  node_reply["Quoted replies<br/>[ReplyMessage.js]"]
  node_image["Image messages<br/>[Image.js]"]
  node_video["Video messages<br/>[Video.js]"]
  node_session["Session encoding<br/>[StringSession.js]"]
end

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

node_user -->|"sends messages"| node_whatsapp
node_whatsapp -.->|"delivers messages"| node_bot
node_bot -->|"loads commands"| node_registry
node_bot -->|"loads settings"| node_config
node_bot -->|"loads client layer"| node_clientapi
node_bot -->|"loads storage"| node_greetingdb
node_bot -->|"loads storage"| node_plugindb
node_registry -->|"reads handlers"| node_config
node_admin -->|"registers commands"| node_registry
node_afk -->|"registers commands"| node_registry
node_filters -->|"registers commands"| node_registry
node_filters -->|"reads and writes"| node_filterdb
node_greetings -->|"registers commands"| node_registry
node_greetings -->|"reads and writes"| node_greetingdb
node_lydia -->|"registers commands"| node_registry
node_media -->|"registers commands"| node_registry
node_scrapers -->|"registers commands"| node_registry
node_profile -->|"registers commands"| node_registry
node_utilities -->|"registers commands"| node_registry
node_admin -->|"reads strings"| node_language
node_bot -.->|"connects client"| node_whatsapp
node_clientapi -.->|"supports wrappers"| node_messages
node_messages -->|"wraps quoted message"| node_reply
node_image -->|"wraps quoted message"| node_reply
node_video -->|"wraps quoted message"| node_reply
node_bot -.->|"loads session support"| node_session

click node_bot "https://github.com/yusufusta/whatsasena/blob/master/bot.js"
click node_registry "https://github.com/yusufusta/whatsasena/blob/master/events.js"
click node_admin "https://github.com/yusufusta/whatsasena/blob/master/plugins/admin.js"
click node_afk "https://github.com/yusufusta/whatsasena/blob/master/plugins/afk.js"
click node_filters "https://github.com/yusufusta/whatsasena/blob/master/plugins/filters.js"
click node_greetings "https://github.com/yusufusta/whatsasena/blob/master/plugins/greetings.js"
click node_lydia "https://github.com/yusufusta/whatsasena/blob/master/plugins/lydia.js"
click node_media "https://github.com/yusufusta/whatsasena/blob/master/plugins/memes.js"
click node_scrapers "https://github.com/yusufusta/whatsasena/blob/master/plugins/scrapers.js"
click node_profile "https://github.com/yusufusta/whatsasena/blob/master/plugins/profile.js"
click node_utilities "https://github.com/yusufusta/whatsasena/blob/master/plugins/tagall.js"
click node_language "https://github.com/yusufusta/whatsasena/blob/master/language.js"
click node_config "https://github.com/yusufusta/whatsasena/blob/master/config.js"
click node_filterdb "https://github.com/yusufusta/whatsasena/blob/master/plugins/sql/filters.js"
click node_greetingdb "https://github.com/yusufusta/whatsasena/blob/master/plugins/sql/greetings.js"
click node_plugindb "https://github.com/yusufusta/whatsasena/blob/master/plugins/sql/plugin.js"
click node_clientapi "https://github.com/yusufusta/whatsasena/blob/master/whatsasena/Base.js"
click node_messages "https://github.com/yusufusta/whatsasena/blob/master/whatsasena/Message.js"
click node_reply "https://github.com/yusufusta/whatsasena/blob/master/whatsasena/ReplyMessage.js"
click node_image "https://github.com/yusufusta/whatsasena/blob/master/whatsasena/Image.js"
click node_video "https://github.com/yusufusta/whatsasena/blob/master/whatsasena/Video.js"
click node_session "https://github.com/yusufusta/whatsasena/blob/master/whatsasena/StringSession.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_bot,node_registry,node_user toneBlue
class node_admin,node_afk,node_filters,node_greetings,node_lydia,node_media,node_scrapers,node_profile,node_utilities toneAmber
class node_language,node_config,node_filterdb,node_greetingdb,node_plugindb toneMint
class node_clientapi,node_messages,node_reply,node_image,node_video,node_session toneRose
class node_whatsapp toneIndigo
```

## Components

### Bot runtime

- [Bot startup](https://github.com/yusufusta/whatsasena/blob/master/bot.js): `bot.js`
- [Command registry](https://github.com/yusufusta/whatsasena/blob/master/events.js): `events.js`

### Bot features

- [Admin commands](https://github.com/yusufusta/whatsasena/blob/master/plugins/admin.js): `plugins/admin.js`
- [AFK status](https://github.com/yusufusta/whatsasena/blob/master/plugins/afk.js): `plugins/afk.js`
- [Message filters](https://github.com/yusufusta/whatsasena/blob/master/plugins/filters.js): `plugins/filters.js`
- [Group greetings](https://github.com/yusufusta/whatsasena/blob/master/plugins/greetings.js): `plugins/greetings.js`
- [Lydia assistant](https://github.com/yusufusta/whatsasena/blob/master/plugins/lydia.js): `plugins/lydia.js`
- [Media tools](https://github.com/yusufusta/whatsasena/blob/master/plugins/memes.js): `plugins/memes.js`
- [Scrapers](https://github.com/yusufusta/whatsasena/blob/master/plugins/scrapers.js): `plugins/scrapers.js`
- [Profile tools](https://github.com/yusufusta/whatsasena/blob/master/plugins/profile.js): `plugins/profile.js`
- [Chat utilities](https://github.com/yusufusta/whatsasena/blob/master/plugins/tagall.js): `plugins/tagall.js`

### Configuration and state

- [Language strings](https://github.com/yusufusta/whatsasena/blob/master/language.js): `language.js`
- [Runtime configuration](https://github.com/yusufusta/whatsasena/blob/master/config.js): `config.js`
- [Filter records](https://github.com/yusufusta/whatsasena/blob/master/plugins/sql/filters.js): `plugins/sql/filters.js`
- [Greeting records](https://github.com/yusufusta/whatsasena/blob/master/plugins/sql/greetings.js): `plugins/sql/greetings.js`
- [Plugin records](https://github.com/yusufusta/whatsasena/blob/master/plugins/sql/plugin.js): `plugins/sql/plugin.js`

### WhatsApp client layer

- [WhatsApp client API](https://github.com/yusufusta/whatsasena/blob/master/whatsasena/Base.js): `whatsasena/Base.js`
- [Message wrappers](https://github.com/yusufusta/whatsasena/blob/master/whatsasena/Message.js): `whatsasena/Message.js`
- [Quoted replies](https://github.com/yusufusta/whatsasena/blob/master/whatsasena/ReplyMessage.js): `whatsasena/ReplyMessage.js`
- [Image messages](https://github.com/yusufusta/whatsasena/blob/master/whatsasena/Image.js): `whatsasena/Image.js`
- [Video messages](https://github.com/yusufusta/whatsasena/blob/master/whatsasena/Video.js): `whatsasena/Video.js`
- [Session encoding](https://github.com/yusufusta/whatsasena/blob/master/whatsasena/StringSession.js): `whatsasena/StringSession.js`

### Other components

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

## Connections

- WhatsApp user → WhatsApp Web: sends messages (evidence: `README.md`)
- WhatsApp Web → Bot startup: delivers messages
- Bot startup → Command registry: loads commands (evidence: `bot.js`)
- Bot startup → Runtime configuration: loads settings (evidence: `bot.js`)
- Bot startup → WhatsApp client API: loads client layer (evidence: `bot.js`)
- Bot startup → Greeting records: loads storage (evidence: `bot.js`)
- Bot startup → Plugin records: loads storage (evidence: `bot.js`)
- Command registry → Runtime configuration: reads handlers (evidence: `events.js`)
- Admin commands → Command registry: registers commands (evidence: `plugins/admin.js`)
- AFK status → Command registry: registers commands (evidence: `plugins/afk.js`)
- Message filters → Command registry: registers commands (evidence: `plugins/filters.js`)
- Message filters → Filter records: reads and writes (evidence: `plugins/filters.js`)
- Group greetings → Command registry: registers commands (evidence: `plugins/greetings.js`)
- Group greetings → Greeting records: reads and writes (evidence: `plugins/greetings.js`)
- Lydia assistant → Command registry: registers commands (evidence: `plugins/lydia.js`)
- Media tools → Command registry: registers commands (evidence: `plugins/memes.js`)
- Scrapers → Command registry: registers commands (evidence: `plugins/scrapers.js`)
- Profile tools → Command registry: registers commands (evidence: `plugins/profile.js`)
- Chat utilities → Command registry: registers commands (evidence: `plugins/tagall.js`)
- Admin commands → Language strings: reads strings (evidence: `plugins/admin.js`)
- Bot startup → WhatsApp Web: connects client
- WhatsApp client API → Message wrappers: supports wrappers (evidence: `whatsasena/Message.js`)
- Message wrappers → Quoted replies: wraps quoted message (evidence: `whatsasena/Message.js`)
- Image messages → Quoted replies: wraps quoted message (evidence: `whatsasena/Image.js`)
- Video messages → Quoted replies: wraps quoted message (evidence: `whatsasena/Video.js`)
- Bot startup → Session encoding: loads session support
