# gianllucaleme/bot_inaters architecture

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

- Interactive diagram: https://gitdiagram.com/gianllucaleme/bot_inaters
- Repository: https://github.com/gianllucaleme/bot_inaters

## Overview

Bot iNaters automates commands in private WhatsApp groups. Members send a command; `main.js` normalizes and filters the message, applies group and cooldown checks, then dispatches it to command-family routers. Those routers resolve aliases and command data, invoke handlers, and send mentions, media, or help replies through WhatsApp. Administration and pause state are separate runtime concerns. The README also documents a watchdog that restarts the bot; its implementation is present, but source details are not excerpted.

Main entry points: [`main.js`](https://github.com/gianllucaleme/bot_inaters/blob/main/main.js) (Message listener), [`lib/utils.js`](https://github.com/gianllucaleme/bot_inaters/blob/main/lib/utils.js) (Shared utilities), [`commands/handlers/agaSender.js`](https://github.com/gianllucaleme/bot_inaters/blob/main/commands/handlers/agaSender.js) (AGA sender), [`commands/handlers/helpSender.js`](https://github.com/gianllucaleme/bot_inaters/blob/main/commands/handlers/helpSender.js) (Help replies)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Message runtime"]
  node_main["Message listener<br/>[main.js]"]
  node_watchdog["Restart watchdog<br/>[watchdog.js]"]
  node_internet["Connectivity check<br/>[internet.js]"]
end

subgraph group_routing["Command routing"]
  node_core["Mention router<br/>[core.js]"]
  node_easter["Easter router<br/>[easter.js]"]
  node_aga["AGA router<br/>[aga.js]"]
  node_admin["Admin router<br/>[admin.js]"]
  node_help["Help router<br/>[help.js]"]
end

subgraph group_features["Command features"]
  node_mentiondata["Mention definitions<br/>[mentionCommands.js]"]
  node_mentionaliases["Mention aliases<br/>[mentionAliases.js]"]
  node_mentionsender["Mention sender<br/>[mentionSender.js]"]
  node_easterdata["Easter definitions<br/>[easterCommands.js]"]
  node_easteraliases["Easter aliases<br/>[easterAliases.js]"]
  node_eastersender["Easter sender<br/>[easterSender.js]"]
  node_agadata["AGA audio map<br/>[agaCommands.js]"]
  node_agaaliases["AGA aliases<br/>[agaAliases.js]"]
  node_agasender["AGA sender<br/>[agaSender.js]"]
  node_adminsender["Admin actions<br/>[adminSender.js]"]
  node_helpsender["Help replies<br/>[helpSender.js]"]
end

subgraph group_state["Configuration and state"]
  node_commandlist["Command registry<br/>[commandList.js]"]
  node_groups["Allowed groups<br/>[groups.js]"]
  node_contacts["Contact data<br/>[contacts_load.js]"]
  node_pause["Group pause state<br/>[pauseManager.js]"]
  node_utils["Shared utilities<br/>[utils.js]"]
  node_paths["Runtime paths<br/>[paths.js]"]
end

node_members(("Group members"))
node_whatsapp["WhatsApp service"]

node_members -->|"send commands"| node_main
node_main -->|"dispatches"| node_core
node_main -->|"dispatches"| node_easter
node_main -->|"dispatches"| node_aga
node_main -->|"dispatches"| node_admin
node_main -->|"dispatches"| node_help
node_main -->|"checks commands"| node_commandlist
node_main -->|"checks groups"| node_groups
node_main -->|"checks pause"| node_pause
node_main -->|"normalizes text"| node_utils
node_main -->|"loads contacts"| node_contacts
node_core -->|"resolves aliases"| node_mentionaliases
node_core -->|"reads definitions"| node_mentiondata
node_core -->|"calls sender"| node_mentionsender
node_easter -->|"resolves aliases"| node_easteraliases
node_easter -->|"reads definitions"| node_easterdata
node_easter -->|"calls sender"| node_eastersender
node_aga -->|"resolves aliases"| node_agaaliases
node_aga -->|"reads registry"| node_commandlist
node_aga -->|"calls sender"| node_agasender
node_admin -->|"uses admin checks"| node_adminsender
node_admin -->|"pauses group"| node_pause
node_admin -->|"shuffles contacts"| node_utils
node_helpsender -->|"lists commands"| node_commandlist
node_helpsender -->|"describes commands"| node_mentiondata
node_helpsender -->|"describes aliases"| node_mentionaliases
node_help -->|"calls sender"| node_helpsender
node_mentionsender -->|"builds mentions"| node_utils
node_agasender -->|"reads audio map"| node_agadata
node_agasender -->|"builds mentions"| node_utils
node_agasender -->|"reads contacts"| node_contacts
node_adminsender -->|"reads contacts"| node_contacts
node_pause -->|"loads and saves"| node_utils
node_utils -->|"uses pause path"| node_paths
node_watchdog -->|"restarts process"| node_main
node_watchdog -.->|"checks connectivity"| node_internet
node_main -->|"sends replies"| node_whatsapp
node_mentionsender -.->|"sends mentions"| node_whatsapp
node_eastersender -.->|"sends media"| node_whatsapp
node_agasender -.->|"sends audio"| node_whatsapp
node_helpsender -.->|"sends help"| node_whatsapp

click node_main "https://github.com/gianllucaleme/bot_inaters/blob/main/main.js"
click node_watchdog "https://github.com/gianllucaleme/bot_inaters/blob/main/watchdog.js"
click node_internet "https://github.com/gianllucaleme/bot_inaters/blob/main/lib/internet.js"
click node_core "https://github.com/gianllucaleme/bot_inaters/blob/main/commands/core.js"
click node_easter "https://github.com/gianllucaleme/bot_inaters/blob/main/commands/easter.js"
click node_aga "https://github.com/gianllucaleme/bot_inaters/blob/main/commands/aga.js"
click node_admin "https://github.com/gianllucaleme/bot_inaters/blob/main/commands/admin.js"
click node_help "https://github.com/gianllucaleme/bot_inaters/blob/main/commands/help.js"
click node_mentiondata "https://github.com/gianllucaleme/bot_inaters/blob/main/commands/helpers/mentionCommands.js"
click node_mentionaliases "https://github.com/gianllucaleme/bot_inaters/blob/main/commands/maps/mentionAliases.js"
click node_mentionsender "https://github.com/gianllucaleme/bot_inaters/blob/main/commands/handlers/mentionSender.js"
click node_easterdata "https://github.com/gianllucaleme/bot_inaters/blob/main/commands/helpers/easterCommands.js"
click node_easteraliases "https://github.com/gianllucaleme/bot_inaters/blob/main/commands/maps/easterAliases.js"
click node_eastersender "https://github.com/gianllucaleme/bot_inaters/blob/main/commands/handlers/easterSender.js"
click node_agadata "https://github.com/gianllucaleme/bot_inaters/blob/main/commands/helpers/agaCommands.js"
click node_agaaliases "https://github.com/gianllucaleme/bot_inaters/blob/main/commands/maps/agaAliases.js"
click node_agasender "https://github.com/gianllucaleme/bot_inaters/blob/main/commands/handlers/agaSender.js"
click node_adminsender "https://github.com/gianllucaleme/bot_inaters/blob/main/commands/handlers/adminSender.js"
click node_helpsender "https://github.com/gianllucaleme/bot_inaters/blob/main/commands/handlers/helpSender.js"
click node_commandlist "https://github.com/gianllucaleme/bot_inaters/blob/main/config/commandList.js"
click node_groups "https://github.com/gianllucaleme/bot_inaters/blob/main/config/groups.js"
click node_contacts "https://github.com/gianllucaleme/bot_inaters/blob/main/config/contacts_load.js"
click node_pause "https://github.com/gianllucaleme/bot_inaters/blob/main/lib/pauseManager.js"
click node_utils "https://github.com/gianllucaleme/bot_inaters/blob/main/lib/utils.js"
click node_paths "https://github.com/gianllucaleme/bot_inaters/blob/main/config/paths.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_main,node_watchdog,node_internet toneBlue
class node_core,node_easter,node_aga,node_admin,node_help toneAmber
class node_mentiondata,node_mentionaliases,node_mentionsender,node_easterdata,node_easteraliases,node_eastersender,node_agadata,node_agaaliases,node_agasender,node_adminsender,node_helpsender toneMint
class node_commandlist,node_groups,node_contacts,node_pause,node_utils,node_paths toneRose
class node_members,node_whatsapp toneIndigo
```

## Components

### Message runtime

- [Message listener](https://github.com/gianllucaleme/bot_inaters/blob/main/main.js): `main.js`
- [Restart watchdog](https://github.com/gianllucaleme/bot_inaters/blob/main/watchdog.js): `watchdog.js`
- [Connectivity check](https://github.com/gianllucaleme/bot_inaters/blob/main/lib/internet.js): `lib/internet.js`

### Command routing

- [Mention router](https://github.com/gianllucaleme/bot_inaters/blob/main/commands/core.js): `commands/core.js`
- [Easter router](https://github.com/gianllucaleme/bot_inaters/blob/main/commands/easter.js): `commands/easter.js`
- [AGA router](https://github.com/gianllucaleme/bot_inaters/blob/main/commands/aga.js): `commands/aga.js`
- [Admin router](https://github.com/gianllucaleme/bot_inaters/blob/main/commands/admin.js): `commands/admin.js`
- [Help router](https://github.com/gianllucaleme/bot_inaters/blob/main/commands/help.js): `commands/help.js`

### Command features

- [Mention definitions](https://github.com/gianllucaleme/bot_inaters/blob/main/commands/helpers/mentionCommands.js): `commands/helpers/mentionCommands.js`
- [Mention aliases](https://github.com/gianllucaleme/bot_inaters/blob/main/commands/maps/mentionAliases.js): `commands/maps/mentionAliases.js`
- [Mention sender](https://github.com/gianllucaleme/bot_inaters/blob/main/commands/handlers/mentionSender.js): `commands/handlers/mentionSender.js`
- [Easter definitions](https://github.com/gianllucaleme/bot_inaters/blob/main/commands/helpers/easterCommands.js): `commands/helpers/easterCommands.js`
- [Easter aliases](https://github.com/gianllucaleme/bot_inaters/blob/main/commands/maps/easterAliases.js): `commands/maps/easterAliases.js`
- [Easter sender](https://github.com/gianllucaleme/bot_inaters/blob/main/commands/handlers/easterSender.js): `commands/handlers/easterSender.js`
- [AGA audio map](https://github.com/gianllucaleme/bot_inaters/blob/main/commands/helpers/agaCommands.js): `commands/helpers/agaCommands.js`
- [AGA aliases](https://github.com/gianllucaleme/bot_inaters/blob/main/commands/maps/agaAliases.js): `commands/maps/agaAliases.js`
- [AGA sender](https://github.com/gianllucaleme/bot_inaters/blob/main/commands/handlers/agaSender.js): `commands/handlers/agaSender.js`
- [Admin actions](https://github.com/gianllucaleme/bot_inaters/blob/main/commands/handlers/adminSender.js): `commands/handlers/adminSender.js`
- [Help replies](https://github.com/gianllucaleme/bot_inaters/blob/main/commands/handlers/helpSender.js): `commands/handlers/helpSender.js`

### Configuration and state

- [Command registry](https://github.com/gianllucaleme/bot_inaters/blob/main/config/commandList.js): `config/commandList.js`
- [Allowed groups](https://github.com/gianllucaleme/bot_inaters/blob/main/config/groups.js): `config/groups.js`
- [Contact data](https://github.com/gianllucaleme/bot_inaters/blob/main/config/contacts_load.js): `config/contacts_load.js`
- [Group pause state](https://github.com/gianllucaleme/bot_inaters/blob/main/lib/pauseManager.js): `lib/pauseManager.js`
- [Shared utilities](https://github.com/gianllucaleme/bot_inaters/blob/main/lib/utils.js): `lib/utils.js`
- [Runtime paths](https://github.com/gianllucaleme/bot_inaters/blob/main/config/paths.js): `config/paths.js`

### Other components

- **Group members**
- **WhatsApp service**

## Connections

- Group members → Message listener: send commands (evidence: `README.md`)
- Message listener → Mention router: dispatches (evidence: `main.js`)
- Message listener → Easter router: dispatches (evidence: `main.js`)
- Message listener → AGA router: dispatches (evidence: `main.js`)
- Message listener → Admin router: dispatches (evidence: `main.js`)
- Message listener → Help router: dispatches (evidence: `main.js`)
- Message listener → Command registry: checks commands (evidence: `main.js`)
- Message listener → Allowed groups: checks groups (evidence: `main.js`)
- Message listener → Group pause state: checks pause (evidence: `main.js`)
- Message listener → Shared utilities: normalizes text (evidence: `main.js`)
- Message listener → Contact data: loads contacts (evidence: `main.js`)
- Mention router → Mention aliases: resolves aliases (evidence: `commands/core.js`)
- Mention router → Mention definitions: reads definitions (evidence: `commands/core.js`)
- Mention router → Mention sender: calls sender (evidence: `commands/core.js`)
- Easter router → Easter aliases: resolves aliases (evidence: `commands/easter.js`)
- Easter router → Easter definitions: reads definitions (evidence: `commands/easter.js`)
- Easter router → Easter sender: calls sender (evidence: `commands/easter.js`)
- AGA router → AGA aliases: resolves aliases (evidence: `commands/aga.js`)
- AGA router → Command registry: reads registry (evidence: `commands/aga.js`)
- AGA router → AGA sender: calls sender (evidence: `commands/aga.js`)
- Admin router → Admin actions: uses admin checks (evidence: `commands/admin.js`)
- Admin router → Group pause state: pauses group (evidence: `commands/admin.js`)
- Admin router → Shared utilities: shuffles contacts (evidence: `commands/admin.js`)
- Help replies → Command registry: lists commands (evidence: `commands/handlers/helpSender.js`)
- Help replies → Mention definitions: describes commands (evidence: `commands/handlers/helpSender.js`)
- Help replies → Mention aliases: describes aliases (evidence: `commands/handlers/helpSender.js`)
- Help router → Help replies: calls sender (evidence: `commands/help.js`)
- Mention sender → Shared utilities: builds mentions (evidence: `commands/handlers/mentionSender.js`)
- AGA sender → AGA audio map: reads audio map (evidence: `commands/handlers/agaSender.js`)
- AGA sender → Shared utilities: builds mentions (evidence: `commands/handlers/agaSender.js`)
- AGA sender → Contact data: reads contacts (evidence: `commands/handlers/agaSender.js`)
- Admin actions → Contact data: reads contacts (evidence: `commands/handlers/adminSender.js`)
- Group pause state → Shared utilities: loads and saves (evidence: `lib/pauseManager.js`)
- Shared utilities → Runtime paths: uses pause path (evidence: `lib/utils.js`)
- Restart watchdog → Message listener: restarts process (evidence: `README.md`)
- Restart watchdog → Connectivity check: checks connectivity
- Message listener → WhatsApp service: sends replies (evidence: `main.js`)
- Mention sender → WhatsApp service: sends mentions
- Easter sender → WhatsApp service: sends media
- AGA sender → WhatsApp service: sends audio
- Help replies → WhatsApp service: sends help
