# ulilabror/rajin-nulis-bot architecture

> Architecture diagram of the GitHub repository ulilabror/rajin-nulis-bot, 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/ulilabror/rajin-nulis-bot
- Repository: https://github.com/ulilabror/rajin-nulis-bot

## Overview

Rajin Nulis BOT is a WhatsApp bot that handles incoming commands, especially turning text into a handwritten-style page, and also provides informational and group/owner commands. The documented command list is broader than the sampled implementation; the graph covers the documented menu and the command-handler subsystem without inventing unsampled behavior. The handler references image files under `mager/`, but the tree lists only `mager/MFS.txt`; those assets are not represented as confirmed files.

Main entry points: [`msgHndlr.js`](https://github.com/ulilabror/rajin-nulis-bot/blob/master/msgHndlr.js) (Command context), [`index.js`](https://github.com/ulilabror/rajin-nulis-bot/blob/master/index.js) (Session startup), [`options.js`](https://github.com/ulilabror/rajin-nulis-bot/blob/master/options.js) (Client options), [`lib/help.js`](https://github.com/ulilabror/rajin-nulis-bot/blob/master/lib/help.js) (Bot information)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_startup["Session startup<br/>[index.js]"]
  node_options["Client options<br/>[options.js]"]
  node_events["Event registration<br/>[index.js]"]
end

subgraph group_commands["Commands"]
  node_handler["Message handler<br/>[msgHndlr.js]"]
  node_command_context["Command context<br/>[msgHndlr.js]"]
  node_admin_commands["Group and owner<br/>[msgHndlr.js]"]
  node_info_commands["Help and info<br/>[msgHndlr.js]"]
  node_help_content["Bot information<br/>[help.js]"]
end

subgraph group_writing["Handwriting"]
  node_writer["Page rendering<br/>[msgHndlr.js]"]
  node_templates["Paper assets"]
end

node_user(("WhatsApp user"))
node_wa{{"WhatsApp service"}}
node_imagemagick{{"ImageMagick"}}

node_user -->|"sends message"| node_wa
node_wa -->|"delivers events"| node_events
node_startup -->|"gets options"| node_options
node_startup -->|"creates client"| node_wa
node_events -->|"dispatches message"| node_handler
node_handler -->|"parses command"| node_command_context
node_command_context -->|"routes commands"| node_admin_commands
node_command_context -->|"routes commands"| node_info_commands
node_command_context -->|"routes command"| node_writer
node_info_commands -->|"uses text"| node_help_content
node_admin_commands -->|"manages chats"| node_wa
node_info_commands -->|"sends replies"| node_wa
node_writer -->|"reads paper"| node_templates
node_writer -->|"renders page"| node_imagemagick
node_writer -->|"sends image"| node_wa

click node_startup "https://github.com/ulilabror/rajin-nulis-bot/blob/master/index.js"
click node_options "https://github.com/ulilabror/rajin-nulis-bot/blob/master/options.js"
click node_events "https://github.com/ulilabror/rajin-nulis-bot/blob/master/index.js"
click node_handler "https://github.com/ulilabror/rajin-nulis-bot/blob/master/msgHndlr.js"
click node_command_context "https://github.com/ulilabror/rajin-nulis-bot/blob/master/msgHndlr.js"
click node_admin_commands "https://github.com/ulilabror/rajin-nulis-bot/blob/master/msgHndlr.js"
click node_info_commands "https://github.com/ulilabror/rajin-nulis-bot/blob/master/msgHndlr.js"
click node_help_content "https://github.com/ulilabror/rajin-nulis-bot/blob/master/lib/help.js"
click node_writer "https://github.com/ulilabror/rajin-nulis-bot/blob/master/msgHndlr.js"
click node_templates "https://github.com/ulilabror/rajin-nulis-bot/tree/master/mager"

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_options,node_events,node_user toneBlue
class node_handler,node_command_context,node_admin_commands,node_info_commands,node_help_content toneAmber
class node_writer,node_templates toneMint
class node_wa,node_imagemagick toneIndigo
```

## Components

### Bot runtime

- [Session startup](https://github.com/ulilabror/rajin-nulis-bot/blob/master/index.js): `index.js`
- [Client options](https://github.com/ulilabror/rajin-nulis-bot/blob/master/options.js): `options.js`
- [Event registration](https://github.com/ulilabror/rajin-nulis-bot/blob/master/index.js): `index.js`

### Commands

- [Message handler](https://github.com/ulilabror/rajin-nulis-bot/blob/master/msgHndlr.js): `msgHndlr.js`
- [Command context](https://github.com/ulilabror/rajin-nulis-bot/blob/master/msgHndlr.js): `msgHndlr.js`
- [Group and owner](https://github.com/ulilabror/rajin-nulis-bot/blob/master/msgHndlr.js): `msgHndlr.js`
- [Help and info](https://github.com/ulilabror/rajin-nulis-bot/blob/master/msgHndlr.js): `msgHndlr.js`
- [Bot information](https://github.com/ulilabror/rajin-nulis-bot/blob/master/lib/help.js): `lib/help.js`

### Handwriting

- [Page rendering](https://github.com/ulilabror/rajin-nulis-bot/blob/master/msgHndlr.js): `msgHndlr.js`
- [Paper assets](https://github.com/ulilabror/rajin-nulis-bot/tree/master/mager): `mager`

### Other components

- **WhatsApp user**
- **WhatsApp service**
- **ImageMagick**

## Connections

- WhatsApp user → WhatsApp service: sends message
- WhatsApp service → Event registration: delivers events
- Session startup → Client options: gets options
- Session startup → WhatsApp service: creates client
- Event registration → Message handler: dispatches message
- Message handler → Command context: parses command
- Command context → Group and owner: routes commands
- Command context → Help and info: routes commands
- Command context → Page rendering: routes command
- Help and info → Bot information: uses text
- Group and owner → WhatsApp service: manages chats
- Help and info → WhatsApp service: sends replies
- Page rendering → Paper assets: reads paper
- Page rendering → ImageMagick: renders page
- Page rendering → WhatsApp service: sends image
