How znanx/moon-bot works
MOON BOT is a WhatsApp automation bot built on Baileys and @znan/wabot. Its main workflow is: WhatsApp messages reach the connection initialized in main.js, listeners route them through handler.js, and command or event plugins perform the requested action and reply through the connection. Plugin capabilities span moderation, downloads, AI, media conversion, games, utilities, and group administration. main.js also initializes and periodically saves database state. The README documents optional scheduled owner backups and an HTTP health endpoint; detailed wiring for unsampled plugin families is not shown here.
Main entry points: plugins Command plugins · handler.js Command and event router · main.js Connection and jobs · _events Event plugins
Components 21
Bot runtime
- Connection and jobs
main.js - Message listeners
lib/system/listeners.js - Command and event router
handler.js
Plugin features
- Command plugins
plugins - Event plugins
plugins/_events - Moderation
plugins/_events/protector - Download features
plugins/downloader - Media and conversion
plugins/converter - AI features
plugins/ai - Games
plugins/game - Group and admin
plugins/admin - Search and tools
plugins/tools - User features
plugins/users - Group product store
plugins/store/product.js
State and helpers
- Bot database
lib/system/localdb.js - Data schema
lib/system/schema.js - Spam checks
lib/system/antispam.js - Shared functions
lib/system/function.js
Operations
- HTTP health endpoint
server.js
Other components
- WhatsApp user
- WhatsApp service
Connections 24
- WhatsApp user → WhatsApp service: sends message
- WhatsApp service → Message listeners: delivers events
- Message listeners → Command and event router: dispatches messages
- Command and event router → Command plugins: runs commands
- Command and event router → Event plugins: runs events
- Command and event router → Spam checks: checks spam
- Command plugins → WhatsApp service: sends replies
- Event plugins → WhatsApp service: sends replies
- Connection and jobs → Message listeners: sets up listeners
- Connection and jobs → Bot database: loads and saves
- Connection and jobs → Data schema: initializes data
- Command and event router → Bot database: uses global state
- Command plugins → Shared functions: uses helpers
- Event plugins → Shared functions: uses helpers
- Command plugins → Moderation: includes moderation
- Command plugins → Download features: includes downloads
- Command plugins → Media and conversion: includes conversion
- Command plugins → AI features: includes AI
- Command plugins → Games: includes games
- Command plugins → Group and admin: includes controls
- Command plugins → Search and tools: includes tools
- Command plugins → User features: includes accounts
- Command plugins → Group product store: includes products
- Connection and jobs → HTTP health endpoint: optional status mode