| Feature | Description | |
|---|---|---|
| 🔐 | QR Login | Scan in the terminal or in your browser at /qr |
| 🔑 | Pairing Code | Link with a phone number, no scanning needed |
| 🧩 | Plugin System | Every .js file in plugins/ is auto-loaded |
| ☁️ | MEGA Session | Optional SESSION_ID restore |
| 🛡️ | Work Modes | public, private, groups, inbox |
| 👀 | Auto Status | Optional auto read + react to statuses |
| 🔁 | Auto Reconnect | Reconnects safely without duplicating plugins |
WhatsApp-PluginBot-Script/
├── index.js # connection, login (QR/pair), message handler
├── config.js # reads config.env / environment variables
├── command.js # cmd() registry used by plugins
├── config.env.example # copy to config.env
├── lib/
│ ├── functions.js # helpers (getBuffer, fetchJson, runtime ...)
│ └── msg.js # message serializer (sms, downloadMediaMessage)
└── plugins/
└── ping.js # example plugin
git clone https://github.com/dnuzi/WhatsApp-PluginBot-Script
cd WhatsApp-PluginBot-Script
npm install
cp config.env.example config.env
nano config.env # set OWNER_NUMBER, CONNECT_MODE ...
npm startCONNECT_MODE=qr- Run
npm start - Scan the QR shown in the terminal, or open
http://localhost:8000/qr - WhatsApp → Linked Devices → Link a Device
CONNECT_MODE=pair
PAIR_NUMBER=94712345678- Run
npm start - An 8 character code appears, for example
ABCD-1234 - WhatsApp → Linked Devices → Link with phone number instead → enter the code
If
PAIR_NUMBERis empty, the terminal asks for the number. The session is saved inauth_info_baileys/, so you only log in once.
| Variable | Default | Description |
|---|---|---|
BOT_NAME |
FREE BASE DANUZZ |
Bot display name |
PREFIX |
. |
Command prefix |
OWNER_NUMBER |
– | Owner number(s), comma separated |
CONNECT_MODE |
qr |
qr or pair |
PAIR_NUMBER |
– | Number used for pairing code |
SESSION_ID |
– | Optional MEGA session |
MODE |
public |
public / private / groups / inbox |
AUTO_READ_STATUS |
false |
Auto view + react to statuses |
ALWAYS_OFFLINE |
false |
Hide online presence |
PORT |
8000 |
Web server port |
Create plugins/hello.js:
const { cmd } = require('../command');
cmd({
pattern: "hello", // .hello
alias: ["hi"], // .hi
desc: "Say hello",
react: "👋",
category: "main",
filename: __filename
}, async (conn, mek, m, { from, pushname, q, isOwner, isGroup, reply }) => {
reply(`Hello ${pushname}! 👋`);
});Restart the bot and .hello works.
from · quoted · body · command · args · q · isGroup · sender · senderNumber · botNumber · pushname · isOwner · isMe · groupMetadata · groupName · participants · groupAdmins · isBotAdmins · isAdmins · reply
cmd({ on: "body" }, async (conn, mek, m, { body, reply }) => {
if (body === "hi") reply("Hello!");
});Supported: body, text, image, sticker.
npm run pm2 # start
npm run restart # restart
npm run stop # stop- Never commit
config.envorauth_info_baileys/(already in.gitignore). - Never hardcode session IDs, tokens or database passwords in code.
- If a secret was ever public, rotate it.
| Problem | Fix |
|---|---|
| Pairing code not shown | Check PAIR_NUMBER has country code, no + |
| QR keeps changing | Normal, scan quickly or use /qr |
| Logged out | Session is deleted automatically, restart and link again |
| Plugin not loading | Check the terminal for Plugin failed: errors |
