@tuanminhhole

Zalo Group Moderation

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

Current version
v1.2.1
code-pluginCommunitysource-linked

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

OpenClaw runtime plugin for Zalo group administration. Handles moderation, slash commands, and anti-spam with zero LLM token cost. Only @mention queries are forwarded to the AI agent.

License: MIT OpenClaw Plugin

🇻🇳 Đọc bằng tiếng Việt


✨ Features

FeatureToken CostDescription
Slash Commands0/noi-quy, /menu, /huong-dan, /report, /rules
Warn System0/warn @name [reason] — track warnings per member
Anti-Spam0Auto-detect repeated messages, link spam, emoji flood
Admin Notes0/note [text] — admin-only notes
Memory Sync0/memory — save full digest to skills/memory/
Smart Q&A0Auto-answer "who's warned?" "violations?" from local data
@Mention✅ uses tokensForward to LLM only for real questions

🏗️ Architecture

Incoming Zalo message
    │
    ├─ /slash command     → Plugin handles locally (0 tokens)
    ├─ Spam detected      → Log + block silently (0 tokens)
    ├─ "Who's warned?"    → Plugin answers from store (0 tokens)
    │
    └─ @BotName question  → Forward to LLM agent (uses tokens)

📦 Installation

From ClawHub

openclaw plugins install clawhub:openclaw-zalo-mod

From npm

openclaw plugins install openclaw-zalo-mod

Manual

  1. Copy the plugin to your extensions/ directory:
# Windows
xcopy /E /I openclaw-zalo-mod %OPENCLAW_HOME%\extensions\zalo-mod

# Linux / macOS
cp -r openclaw-zalo-mod ~/.openclaw/extensions/zalo-mod
  1. Run the auto-setup script (⭐ recommended):
cd ~/.openclaw/extensions/zalo-mod
node setup.js

The script will:

  • ✅ Auto-detect your .openclaw directory
  • ✅ Ask for group name, bot name, Zalo display names, admin IDs
  • ✅ Auto-detect Docker vs Native for correct install path
  • ✅ Backup openclaw.json before modifying
  • ✅ Patch openclaw.json with the correct plugin config
  • ✅ Create the data/ directory for plugin storage

💡 Tip: If the script can't find .openclaw, specify the path:

node setup.js --openclaw-home "D:\bot\.openclaw"

💡 Non-interactive mode (uses default config):

node setup.js --non-interactive
  1. Restart the gateway:
openclaw gateway run

⚙️ Configuration (Manual)

If you don't use setup.js, add to your openclaw.json:

{
  "plugins": {
    "entries": {
      "zalo-mod": {
        "enabled": true,
        "config": {
          "groupName": "My Awesome Group",
          "botName": "GuardBot",
          "zaloDisplayNames": ["Guard Bot", "Bot Name on Zalo"],
          "adminIds": ["1234567890", "9876543210"],
          "welcomeEnabled": true,
          "spamRepeatN": 3,
          "spamWindowSeconds": 300
        }
      }
    }
  }
}

Config Options

OptionTypeDefaultDescription
groupNamestring"Nhóm"Display name used in templates and memory files
botNamestring"Bot"Bot name shown in menus
zaloDisplayNamesstring[][]Zalo display name aliases for @mention detection
adminIdsstring[][]Zalo user IDs for admin commands. Empty = all users
welcomeEnabledbooleantrueEnable welcome message for new members
spamRepeatNnumber3Repeated messages threshold for spam detection
spamWindowSecondsnumber300Time window (seconds) for spam repeat detection
memoryGroupSlugstringautoOverride memory folder name (auto-generated from groupName)

📋 Slash Commands

Everyone

CommandDescription
/noi-quyShow group rules
/menuShow all available commands
/huong-danHow to use the bot

Admin Only

CommandDescription
/warn @name [reason]Warn a member (tracked in store + memory)
/note [text]Save an admin note
/reportShow violations report
/memorySave full data digest to memory files
/rulesBot configuration panel
/rules silent-on/offToggle silent mode
/rules welcome-on/offToggle welcome messages
/rules statusShow current config

🧠 Memory Integration

zalo-mod automatically syncs moderation data to markdown files in skills/memory/zalo-groups/{group-slug}/:

skills/memory/zalo-groups/my-awesome-group/
├── members.md          ← Warn log (auto-sync on /warn)
├── violations.md       ← Spam violations (auto-sync)
├── chat-highlights.md  ← @mention conversations (auto-sync)
└── admin-notes.md      ← Admin notes (auto-sync on /note)

The /memory command writes a full digest, overwriting members.md and violations.md with clean data from the store.

🔒 Anti-Spam

Detects three types of spam automatically:

TypeDetection
Repeat SpamSame message sent N times within the time window
Link SpamMessages containing suspicious URLs (bit.ly, tinyurl, affiliate links)
Emoji FloodMessages with 5+ consecutive emojis

Violations are logged to the store and synced to violations.md.

🤖 Smart Auto-Answer

When someone @mentions the bot with common group management questions, zalo-mod answers directly from the local store — no LLM tokens used:

Question PatternSource
"Who's warned?" / "Ai bị warn?"store.getWarned()
"Violations?" / "Vi phạm?"store.getViolations()
"Who's admin?" / "Admin là ai?"Config response

All other @mention questions are forwarded to the LLM agent.

🔧 Requirements

  • OpenClaw >= 2026.3.24
  • zalouser channel configured and authenticated
  • Node.js >= 20

📄 License

MIT — see LICENSE

Source and release

Source repository

tuanminhhole/openclaw-zalo-mod

Open repo

Source commit

65c8746392334b687222ff24d72d4eeee97ef212

View commit

Install command

openclaw plugins install clawhub:openclaw-zalo-mod

Metadata

  • Package: openclaw-zalo-mod
  • Created: 2026/04/20
  • Updated: 2026/04/24
  • Executes code: Yes
  • Source tag: v1.2.1

Compatibility

  • Built with OpenClaw: 2026.3.24
  • Plugin API range: >=2026.3.24
  • Tags: latest
  • Files: 10