Openclaw Zalo Mod Build

Zero-token Zalo group moderation plugin for OpenClaw — slash commands, anti-spam, warn system, and memory integration.

Install

openclaw plugins install clawhub:openclaw-zalo-mod

🛡️ openclaw-zalo-mod — Zero-Token Zalo Group Moderation

OpenClaw runtime plugin dành cho quản trị nhóm Zalo. Xử lý kiểm duyệt, slash commands, anti-spam với 0 token LLM. Chỉ có tin nhắn @mention mới được chuyển lên AI agent.

License: MIT OpenClaw Plugin Version

🇺🇸 English


✨ Tính năng

Tính năngTokenMô tả
Zalo Owner Dashboard0Stunning graphical UI Dashboard (Premium Glassmorphism), manage groups, approve pending members, and compose direct messages via real ZCA API!
Slash Commands0/noi-quy, /menu, /huong-dan, /groupid, /ownerid, /report, /rules
Warn System0/warn @name [reason] — member violation tracker
Anti-Spam0Detect repeated messages, suspicious links, emoji floods
Admin Notes0/note [text] — quick admin annotations
Memory Sync0/memory — saves context digest in skills/memory/
Smart Q&A0Native retrieval: "who is warned?", "spam log?" via local data
ZCA Admin Sync0Synchronizes creatorId & adminIds from Zalo API
Owner DM0Administrative command control panel over private DM

🖥️ Zalo Owner Dashboard (UI)

The plugin features a built-in administrative graphical user interface Zalo Owner Dashboard crafted under Premium Glassmorphism & High-Density Studio v1.5 design guidelines.

  • Access URL: http://127.0.0.1:19790 (default) or your server IP on port 19790.
  • Configuration inside openclaw.json:
    "dashboardEnabled": true,
    "dashboardHost": "127.0.0.1",
    "dashboardPort": 19790
    

Key Modules:

  1. 📊 Operations Overview: Live monitoring of group statistics, pending member requests, and operational audit logs.
  2. 👥 Group Management: Configure Silent Mode, Welcome messages, view invite links, and track group administrators.
  3. ⏳ Member Approvals: Quickly accept pending group membership requests and watch flagged members.
  4. ✍️ Message Composer: Write and dispatch raw text or image announcements directly to chosen groups with immediate preview.
  5. 🔌 API Directory: Inspect fully documented ZCA JavaScript APIs with real integration examples.

🏗️ Kiến trúc

Tin nhắn Zalo đến
    │
    ├─ /slash command     → Plugin xử lý local (0 token)
    ├─ Spam phát hiện     → Log + block im lặng (0 token)
    ├─ Sticker/media      → Chuyển thành [Sticker] (0 token)
    ├─ "Ai bị warn?"      → Plugin trả lời từ store (0 token)
    │
    └─ @BotName câu hỏi  → Chuyển lên LLM agent (dùng token)

📦 Cài đặt

1. Docker (khuyến nghị — dùng với openclaw-setup)

# Chạy bên trong container
docker exec openclaw-bot openclaw plugins install clawhub:openclaw-zalo-mod --force
docker restart openclaw-bot

2. Native (không Docker)

openclaw plugins install openclaw-zalo-mod
openclaw gateway restart

3. Cài thủ công từ source

# Copy source vào thư mục extensions
xcopy /E /I openclaw-zalo-mod "%OPENCLAW_HOME%\extensions\zalo-mod"

# Hoặc trên Linux
cp -r openclaw-zalo-mod ~/.openclaw/extensions/zalo-mod

# Restart gateway
openclaw gateway restart

4. Patch nhanh khi phát triển (Docker)

# Copy file đã sửa vào container
Copy-Item -Path "D:\openclaw-zalo-mod\index.js" -Destination "E:\final\.openclaw\extensions\zalo-mod\index.js" -Force

# Fix quyền (Windows bind mount tạo quyền 777)
docker exec openclaw-bot chmod 644 /root/project/.openclaw/extensions/zalo-mod/index.js

# Restart
docker restart openclaw-bot

⚠️ Lưu ý quyền file: Windows bind mounts tạo file với quyền 0777. OpenClaw sẽ từ chối load plugin có quyền world-writable. Luôn chạy chmod 644 sau khi copy.


⚙️ Cấu hình ban đầu

Bước 1: Xác nhận bot đã load plugin

Kiểm tra log sau khi restart:

[gateway] http server listening (5 plugins: browser, memory-core, openclaw-n8n-facebook-poster, zalo-mod, zalouser; ...)

Plugin phải xuất hiện trong danh sách. Nếu thiếu, kiểm tra quyền file.

Bước 2: Nhận quyền Owner

Gửi tin nhắn DM riêng cho bot:

i'm admin

Bot sẽ tự động ghi ownerId vào config và xác nhận.

Bước 3: Đăng ký Group

Vào group cần quản lý, gửi lệnh:

/bot-rules groupid

Bot sẽ quét session, lấy creatorId + adminIds từ Zalo API, rồi tự ghi vào config.


📋 Danh sách lệnh đầy đủ

👤 Mọi người (trong group)

LệnhMô tả
/{botname}-noi-quyXem nội quy nhóm
/{botname}-menuDanh sách lệnh
/{botname}-huong-danHướng dẫn sử dụng bot
/{botname}-reportBáo cáo vi phạm

🔧 Admin (trong group)

LệnhMô tả
/{botname}-muteTắt bot hoàn toàn
/{botname}-unmuteBật lại bot
/{botname}-warn @name [lý do]Cảnh cáo member
/{botname}-note [text]Ghi chú admin
/{botname}-memory [note]Lưu memory digest

👑 Owner — trong group

LệnhMô tả
/bot-rulesXem panel sub-lệnh
/bot-rules statusCấu hình group hiện tại
/bot-rules groupidThêm group + lấy adminIds/creatorId từ ZCA
/bot-rules silent-on/offBật/tắt silent mode
/bot-rules welcome-on/offBật/tắt chào member mới
/bot-rules tracking-on/offBật/tắt ghi lịch sử

🔐 Owner — qua DM riêng

LệnhMô tả
/bot-rules mute <groupId> on/offMute/unmute group cụ thể
/bot-rules mute all on/offMute/unmute tất cả
/bot-rules silent <groupId> on/offSilent group cụ thể
/bot-rules welcome <groupId> on/offWelcome group cụ thể
/bot-rules tracking <groupId> on/offTracking group cụ thể
/bot-rules dm-add <userId>Thêm vào DM whitelist
/bot-rules groupid-listDanh sách tất cả groups
/bot-owneridXem owner ID hiện tại

🛑 Anti-Spam

LoạiPhát hiện
Repeat SpamCùng tin nhắn gửi N lần trong khoảng thời gian
Link SpamURL rút gọn hoặc link affiliate đáng ngờ
Emoji Flood5+ emoji liên tiếp

Cấu hình trong openclaw.json:

"spamRepeatN": 3,
"spamWindowSeconds": 300

🔧 Yêu cầu

  • OpenClaw >= 2026.3.24
  • Channel zalouser đã được cấu hình và xác thực
  • Node.js >= 20

🔄 Release Workflow (Automated Obfuscation & Publishing)

To protect commercial PRO features, the Javascript source code distributed via ClawHub is automatically obfuscated using an enterprise-grade build workflow:

# 1. Develop/modify code inside D:\openclaw-zalo-mod\index.js
# 2. Update CHANGELOG.md with new changes
# 3. Synchronize package and config versions (e.g. 2.5.4)
node bump-version.js
# 4. Stage & Commit cleanly (docs/ folder and sensitive configs are ignored automatically)
git add .
git commit -m "chore: release vX.X.X"
git push
# 5. Run the Premium Build & Publish script to obfuscate and publish to ClawHub
node build-and-publish.js

📄 License

MIT — see LICENSE