# igimonsan/botnode3 architecture

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

- Interactive diagram: https://gitdiagram.com/igimonsan/botnode3
- Repository: https://github.com/igimonsan/botnode3

## Overview

This is a WhatsApp multi-feature bot. A user sends commands or media through WhatsApp; the bot routes requests to conversational AI, sticker and quote generation, or download capabilities, then replies in chat. Startup initializes the WhatsApp client and manages local download, temporary, and session directories. The excerpts show AI API calls, sticker processing, and Facebook/Instagram download logic, but not the full command dispatcher. YouTube and help/info features are documented but their implementations are not sampled, so their internal wiring is left unspecified.

Main entry points: [`wa/whatsappClient.js`](https://github.com/igimonsan/botnode3/blob/main/wa/whatsappClient.js) (WhatsApp client), [`index.js`](https://github.com/igimonsan/botnode3/blob/main/index.js) (Startup and cleanup), [`handlers/aihandler.js`](https://github.com/igimonsan/botnode3/blob/main/handlers/aihandler.js) (AI chat handler), [`config/config.js`](https://github.com/igimonsan/botnode3/blob/main/config/config.js) (Bot configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_index["Startup and cleanup<br/>[index.js]"]
  node_client["WhatsApp client<br/>[whatsappClient.js]"]
  node_config["Bot configuration<br/>[config.js]"]
  node_sessions[("WhatsApp session files")]
  node_downloads[("Downloaded files")]
end

subgraph group_conversation["Conversation"]
  node_ai["AI chat handler<br/>[aihandler.js]"]
  node_ai_service{{"Ferdev AI API"}}
end

subgraph group_media["Media features"]
  node_sticker["Sticker maker<br/>[stickermaker.js]"]
  node_brat["Brat sticker handler<br/>[bratsticker.js]"]
  node_ferdev{{"Ferdev services"}}
  node_tiktok["TikTok downloader"]
  node_whatsappservice["TikTok category flow<br/>[whatsappservice.js]"]
  node_downloads_capability["Facebook and Instagram downloads<br/>[whatsappClient.js]"]
  node_youtube_capability["YouTube downloads<br/>[whatsappClient.js]"]
end

subgraph group_content["Content features"]
  node_quote["Quote generator<br/>[quote.js]"]
  node_quote_data["Quote collection<br/>[daftarquote.js]"]
  node_help_capability["Help and bot info<br/>[whatsappClient.js]"]
end

node_user(("WhatsApp user"))

node_user -->|"sends messages"| node_client
node_client -->|"sends replies"| node_user
node_index -->|"initializes"| node_client
node_index -->|"reads settings"| node_config
node_client -->|"reads settings"| node_config
node_client -->|"uses auth state"| node_sessions
node_index -->|"manages files"| node_downloads
node_client -->|"creates handler"| node_ai
node_client -->|"creates and calls"| node_sticker
node_client -->|"creates handler"| node_quote
node_client -->|"handles requests"| node_downloads_capability
node_client -.->|"offers downloads"| node_youtube_capability
node_client -.->|"offers help"| node_help_capability
node_ai -->|"calls API"| node_ai_service
node_ai -->|"reads settings"| node_config
node_client -->|"requests downloads"| node_ferdev
node_brat -->|"requests sticker"| node_ferdev
node_client -.->|"uses handler"| node_brat
node_tiktok -->|"writes videos"| node_downloads
node_whatsappservice -.->|"downloads video"| node_tiktok
node_quote -->|"reads quotes"| node_quote_data

click node_index "https://github.com/igimonsan/botnode3/blob/main/index.js"
click node_client "https://github.com/igimonsan/botnode3/blob/main/wa/whatsappClient.js"
click node_config "https://github.com/igimonsan/botnode3/blob/main/config/config.js"
click node_sessions "https://github.com/igimonsan/botnode3/tree/main/sessions"
click node_downloads "https://github.com/igimonsan/botnode3/tree/main/downloads"
click node_ai "https://github.com/igimonsan/botnode3/blob/main/handlers/aihandler.js"
click node_sticker "https://github.com/igimonsan/botnode3/blob/main/handlers/stickermaker.js"
click node_brat "https://github.com/igimonsan/botnode3/blob/main/handlers/bratsticker.js"
click node_tiktok "https://github.com/igimonsan/botnode3/blob/main/tiktok/tiktokDownloader.js"
click node_whatsappservice "https://github.com/igimonsan/botnode3/blob/main/service/whatsappservice.js"
click node_quote "https://github.com/igimonsan/botnode3/blob/main/handlers/quote.js"
click node_quote_data "https://github.com/igimonsan/botnode3/blob/main/handlers/daftarquote.js"
click node_downloads_capability "https://github.com/igimonsan/botnode3/blob/main/wa/whatsappClient.js"
click node_youtube_capability "https://github.com/igimonsan/botnode3/blob/main/wa/whatsappClient.js"
click node_help_capability "https://github.com/igimonsan/botnode3/blob/main/wa/whatsappClient.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_index,node_client,node_config,node_sessions,node_downloads,node_user toneBlue
class node_ai,node_ai_service toneAmber
class node_sticker,node_brat,node_ferdev,node_tiktok,node_whatsappservice,node_downloads_capability,node_youtube_capability toneMint
class node_quote,node_quote_data,node_help_capability toneRose
```

## Components

### Bot runtime

- [Startup and cleanup](https://github.com/igimonsan/botnode3/blob/main/index.js): `index.js`
- [WhatsApp client](https://github.com/igimonsan/botnode3/blob/main/wa/whatsappClient.js): `wa/whatsappClient.js`
- [Bot configuration](https://github.com/igimonsan/botnode3/blob/main/config/config.js): `config/config.js`
- [WhatsApp session files](https://github.com/igimonsan/botnode3/tree/main/sessions): `sessions`
- [Downloaded files](https://github.com/igimonsan/botnode3/tree/main/downloads): `downloads`

### Conversation

- [AI chat handler](https://github.com/igimonsan/botnode3/blob/main/handlers/aihandler.js): `handlers/aihandler.js`
- **Ferdev AI API**

### Media features

- [Sticker maker](https://github.com/igimonsan/botnode3/blob/main/handlers/stickermaker.js): `handlers/stickermaker.js`
- [Brat sticker handler](https://github.com/igimonsan/botnode3/blob/main/handlers/bratsticker.js): `handlers/bratsticker.js`
- **Ferdev services**
- [TikTok downloader](https://github.com/igimonsan/botnode3/blob/main/tiktok/tiktokDownloader.js): `tiktok/tiktokDownloader.js`
- [TikTok category flow](https://github.com/igimonsan/botnode3/blob/main/service/whatsappservice.js): `service/whatsappservice.js`
- [Facebook and Instagram downloads](https://github.com/igimonsan/botnode3/blob/main/wa/whatsappClient.js): `wa/whatsappClient.js`
- [YouTube downloads](https://github.com/igimonsan/botnode3/blob/main/wa/whatsappClient.js): `wa/whatsappClient.js`

### Content features

- [Quote generator](https://github.com/igimonsan/botnode3/blob/main/handlers/quote.js): `handlers/quote.js`
- [Quote collection](https://github.com/igimonsan/botnode3/blob/main/handlers/daftarquote.js): `handlers/daftarquote.js`
- [Help and bot info](https://github.com/igimonsan/botnode3/blob/main/wa/whatsappClient.js): `wa/whatsappClient.js`

### Other components

- **WhatsApp user**

## Connections

- WhatsApp user → WhatsApp client: sends messages
- WhatsApp client → WhatsApp user: sends replies
- Startup and cleanup → WhatsApp client: initializes
- Startup and cleanup → Bot configuration: reads settings
- WhatsApp client → Bot configuration: reads settings
- WhatsApp client → WhatsApp session files: uses auth state
- Startup and cleanup → Downloaded files: manages files
- WhatsApp client → AI chat handler: creates handler
- WhatsApp client → Sticker maker: creates and calls
- WhatsApp client → Quote generator: creates handler
- WhatsApp client → Facebook and Instagram downloads: handles requests
- WhatsApp client → YouTube downloads: offers downloads
- WhatsApp client → Help and bot info: offers help
- AI chat handler → Ferdev AI API: calls API
- AI chat handler → Bot configuration: reads settings
- WhatsApp client → Ferdev services: requests downloads
- Brat sticker handler → Ferdev services: requests sticker
- WhatsApp client → Brat sticker handler: uses handler
- TikTok downloader → Downloaded files: writes videos
- TikTok category flow → TikTok downloader: downloads video
- Quote generator → Quote collection: reads quotes
