# ngeff/gl-bot architecture

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

- Interactive diagram: https://gitdiagram.com/ngeff/gl-bot
- Repository: https://github.com/ngeff/gl-bot

## Overview

GL BOT is a Baileys-based WhatsApp automation bot. The main workflow receives WhatsApp events, processes incoming messages through filtering and command dispatch, and sends command results back through the socket; group membership events separately produce welcome and farewell messages. Its documented capabilities also include administration, media conversion, translation, speech, and weather. Edges are limited to relationships shown by excerpts, the source index, or the README; some advertised integrations and commands were not sampled.

Main entry points: [`src/handlers/message.js`](https://github.com/ngeff/gl-bot/blob/main/src/handlers/message.js) (Message handler), [`src/bot.js`](https://github.com/ngeff/gl-bot/blob/main/src/bot.js) (Bot socket runtime), [`src/commands/utility`](https://github.com/ngeff/gl-bot/tree/main/src/commands/utility) (Utility commands), [`src/handlers/group.js`](https://github.com/ngeff/gl-bot/blob/main/src/handlers/group.js) (Membership handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot Runtime"]
  node_entry["Startup and config<br/>[index.js]"]
  node_bot["Bot socket runtime<br/>[bot.js]"]
  node_connection["Connection handling<br/>[connection.js]"]
end

subgraph group_handling["Message Handling"]
  node_messages["Message handler<br/>[message.js]"]
  node_loader["Command loader<br/>[loader.js]"]
  node_message_utils["Message utilities<br/>[message.js]"]
  node_antispam["Anti-spam<br/>[antispam.js]"]
  node_antilink["Anti-link<br/>[antillink.js]"]
end

subgraph group_groups["Group Features"]
  node_group_handler["Membership handler<br/>[group.js]"]
end

subgraph group_commands["Command Capabilities"]
  node_admin["Group administration"]
  node_general["Help and ping"]
  node_media["Media conversion"]
  node_sticker["Sticker creation<br/>[sticker.js]"]
  node_utility["Utility commands"]
end

node_user(("WhatsApp users"))
node_whatsapp["WhatsApp / Baileys"]
node_weather_api["Weather API"]
node_translation_api["Translation API"]
node_tts_service["Text-to-speech service"]
node_ai_service["AI chat service"]

node_user -->|"sends events"| node_whatsapp
node_whatsapp -->|"delivers events"| node_bot
node_entry -->|"starts"| node_bot
node_bot -->|"connects and sends"| node_whatsapp
node_bot -->|"dispatches messages"| node_messages
node_bot -->|"dispatches membership"| node_group_handler
node_bot -.->|"handles connection"| node_connection
node_messages -->|"loads commands"| node_loader
node_messages -->|"extracts content"| node_message_utils
node_messages -->|"checks spam"| node_antispam
node_messages -->|"checks links"| node_antilink
node_messages -.->|"dispatches commands"| node_admin
node_messages -.->|"dispatches commands"| node_general
node_messages -.->|"dispatches commands"| node_media
node_messages -.->|"dispatches commands"| node_utility
node_sticker -->|"downloads media"| node_message_utils
node_group_handler -->|"reads metadata and sends"| node_whatsapp
node_user -->|"requests group controls"| node_admin
node_user -->|"requests conversions"| node_media
node_user -->|"requests utilities"| node_utility
node_utility -->|"fetches weather"| node_weather_api
node_utility -.->|"translates text"| node_translation_api
node_utility -.->|"generates speech"| node_tts_service
node_utility -.->|"queries AI"| node_ai_service

click node_entry "https://github.com/ngeff/gl-bot/blob/main/index.js"
click node_bot "https://github.com/ngeff/gl-bot/blob/main/src/bot.js"
click node_connection "https://github.com/ngeff/gl-bot/blob/main/src/handlers/connection.js"
click node_messages "https://github.com/ngeff/gl-bot/blob/main/src/handlers/message.js"
click node_group_handler "https://github.com/ngeff/gl-bot/blob/main/src/handlers/group.js"
click node_loader "https://github.com/ngeff/gl-bot/blob/main/src/utils/loader.js"
click node_message_utils "https://github.com/ngeff/gl-bot/blob/main/src/utils/message.js"
click node_antispam "https://github.com/ngeff/gl-bot/blob/main/src/middleware/antispam.js"
click node_antilink "https://github.com/ngeff/gl-bot/blob/main/src/middleware/antillink.js"
click node_admin "https://github.com/ngeff/gl-bot/tree/main/src/commands/admin"
click node_general "https://github.com/ngeff/gl-bot/tree/main/src/commands/general"
click node_media "https://github.com/ngeff/gl-bot/tree/main/src/commands/media"
click node_sticker "https://github.com/ngeff/gl-bot/blob/main/src/commands/media/sticker.js"
click node_utility "https://github.com/ngeff/gl-bot/tree/main/src/commands/utility"

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_entry,node_bot,node_connection,node_user toneBlue
class node_messages,node_loader,node_message_utils,node_antispam,node_antilink toneAmber
class node_group_handler,node_weather_api,node_translation_api toneMint
class node_admin,node_general,node_media,node_sticker,node_utility toneRose
class node_whatsapp,node_tts_service,node_ai_service toneIndigo
```

## Components

### Bot Runtime

- [Startup and config](https://github.com/ngeff/gl-bot/blob/main/index.js): `index.js`
- [Bot socket runtime](https://github.com/ngeff/gl-bot/blob/main/src/bot.js): `src/bot.js`
- [Connection handling](https://github.com/ngeff/gl-bot/blob/main/src/handlers/connection.js): `src/handlers/connection.js`

### Message Handling

- [Message handler](https://github.com/ngeff/gl-bot/blob/main/src/handlers/message.js): `src/handlers/message.js`
- [Command loader](https://github.com/ngeff/gl-bot/blob/main/src/utils/loader.js): `src/utils/loader.js`
- [Message utilities](https://github.com/ngeff/gl-bot/blob/main/src/utils/message.js): `src/utils/message.js`
- [Anti-spam](https://github.com/ngeff/gl-bot/blob/main/src/middleware/antispam.js): `src/middleware/antispam.js`
- [Anti-link](https://github.com/ngeff/gl-bot/blob/main/src/middleware/antillink.js): `src/middleware/antillink.js`

### Group Features

- [Membership handler](https://github.com/ngeff/gl-bot/blob/main/src/handlers/group.js): `src/handlers/group.js`

### Command Capabilities

- [Group administration](https://github.com/ngeff/gl-bot/tree/main/src/commands/admin): `src/commands/admin`
- [Help and ping](https://github.com/ngeff/gl-bot/tree/main/src/commands/general): `src/commands/general`
- [Media conversion](https://github.com/ngeff/gl-bot/tree/main/src/commands/media): `src/commands/media`
- [Sticker creation](https://github.com/ngeff/gl-bot/blob/main/src/commands/media/sticker.js): `src/commands/media/sticker.js`
- [Utility commands](https://github.com/ngeff/gl-bot/tree/main/src/commands/utility): `src/commands/utility`

### Other components

- **WhatsApp users**
- **WhatsApp / Baileys**
- **Weather API**
- **Translation API**
- **Text-to-speech service**
- **AI chat service**

## Connections

- WhatsApp users → WhatsApp / Baileys: sends events (evidence: `README.md`)
- WhatsApp / Baileys → Bot socket runtime: delivers events (evidence: `src/bot.js`)
- Startup and config → Bot socket runtime: starts (evidence: `index.js`)
- Bot socket runtime → WhatsApp / Baileys: connects and sends (evidence: `src/bot.js`)
- Bot socket runtime → Message handler: dispatches messages (evidence: `src/bot.js`)
- Bot socket runtime → Membership handler: dispatches membership (evidence: `src/bot.js`)
- Bot socket runtime → Connection handling: handles connection (evidence: `src/bot.js`)
- Message handler → Command loader: loads commands (evidence: `src/handlers/message.js`)
- Message handler → Message utilities: extracts content (evidence: `src/handlers/message.js`)
- Message handler → Anti-spam: checks spam (evidence: `src/handlers/message.js`)
- Message handler → Anti-link: checks links (evidence: `src/handlers/message.js`)
- Message handler → Group administration: dispatches commands
- Message handler → Help and ping: dispatches commands
- Message handler → Media conversion: dispatches commands
- Message handler → Utility commands: dispatches commands
- Sticker creation → Message utilities: downloads media (evidence: `src/commands/media/sticker.js`)
- Membership handler → WhatsApp / Baileys: reads metadata and sends (evidence: `src/handlers/group.js`)
- WhatsApp users → Group administration: requests group controls (evidence: `README.md`)
- WhatsApp users → Media conversion: requests conversions (evidence: `README.md`)
- WhatsApp users → Utility commands: requests utilities (evidence: `README.md`)
- Utility commands → Weather API: fetches weather (evidence: `src/commands/utility/weather.js`)
- Utility commands → Translation API: translates text (evidence: `README.md`)
- Utility commands → Text-to-speech service: generates speech (evidence: `README.md`)
- Utility commands → AI chat service: queries AI (evidence: `README.md`)
