Overview
A WhatsApp moderation bot built with Baileys. It detects profanity, warns users, and provides admin tools for group management.
git clone https://github.com/martinsuii/wa-bot.git
cd wa-bot
npm install
npm start
On first run, scan the QR code in your terminal via WhatsApp → Linked Devices → Link a Device. Credentials are saved to ./auth/ and reused on subsequent starts.
Core Features
| Profanity detection | 20+ languages, leet-speak normalization, suffix/prefix evasion handling |
| Warning system | Tracked per user, auto-punishes after reaching the limit |
| Anti-spam | 5 messages in 5 seconds triggers auto-mute |
| Ban enforcement | Auto-kicks banned users if re-added, rejects join requests |
| Multi-language | 8 languages, per-group setting |
| Custom badwords | Group-specific word lists |
| Welcome & goodbye | Configurable messages for joining/leaving members |
| Persistence | All data survives restarts via JSON files in ./data/ |
| Config sharing | Export/import group settings as a portable code |
How It Works
- The bot connects to WhatsApp Web via Baileys
- It listens for messages in all groups it's a member of
- With admin privileges, it scans messages for profanity
- Offending messages are deleted and the sender receives a DM warning
- Admin commands (
?prefix) allow moderators to warn, kick, ban, mute, and configure the bot
Requirements
- Node.js 18+
- A WhatsApp account (used as the bot's number)
Commands
Public Commands
These work for anyone, in both groups and DMs.
| Command | Description |
|---|---|
!ping | Bot responds with "Pong!" |
!status | Shows connection status and uptime |
!coinflip | Flip a coin (heads/tails) |
!help | Shows public command list |
Admin Commands
These require the bot to have admin privileges in the group. They use the ? prefix and require @mentioning the target user.
| Command | Description |
|---|---|
?warn @user [reason] | Warn user via DM, increments warning count |
?warnings @user | Show warning history for the user |
?kick @user | Remove user from the group |
?ban @user | Ban user (auto-reject rejoin) |
?unban @user | Remove ban, allowing rejoin |
?mute @user <time> [s|m|d] | Auto-delete user's messages for duration |
?unmute @user | Remove mute |
?addword <word> | Add a group-specific banned word |
?removeword <word> | Remove a group-specific banned word |
?purge <n> | Delete the last n messages tracked by the bot |
?ignore @user | Ignore a user (skip moderation & profanity checks) |
?unignore @user | Stop ignoring a user |
?stats | Show moderation statistics |
?settings | Show current group configuration |
?help | Show admin command list with available languages |
Configuration Commands
| Command | Description |
|---|---|
?set-lang <code> | Set bot language for this group |
?set-warnlimit <n> | Warnings before auto-punish (default: 3) |
?set-warnpunish ban|kick|mute [dur] | Punishment for reaching warn limit |
?set-antispam on|off | Toggle anti-spam feature |
?set-welcome <msg> | Set welcome message for new members |
?set-goodbye <msg> | Set goodbye message for leaving members |
Use {user} as a placeholder for the member's name in welcome/goodbye messages.
Export & Import
| Command | Description |
|---|---|
?export | Generate a code with the group's full configuration |
?import <code> | Apply a configuration code to this group |
Generate a code in the Config Maker tab, then send it in any group with ?import.
Auto-Moderation
When the bot detects profanity in a message, it automatically:
- Deletes the message
- DMs the sender a warning
- Records the warning
If a user reaches the warn limit (default 3), they are auto-punished (ban/kick/mute) according to the group's warnPunish setting.
Languages
The bot supports 8 languages. Language is set per-group and persists across restarts.
| Code | Language |
|---|---|
en | English (default) |
cs | Čeština (Czech) |
es | Español (Spanish) |
de | Deutsch (German) |
fr | Français (French) |
pt | Português (Portuguese) |
ru | Русский (Russian) |
id | Bahasa Indonesia |
Setting a language
?set-lang cs
All bot messages in that group will use the selected language: profanity warnings, admin command responses, auto-moderation messages, status and help output.
If an unsupported code is used, the bot responds with the list of valid codes. If no language is set, or a translation key is missing, English is used as the fallback.
Config Maker
Import an existing code
Configure your group
Custom Commands
Commands you define here run a list of steps when triggered. Placeholders: {user} sender number, {args} text after the command, {result} last web fetch result.
Send the ?import <code> command in your group to apply this configuration.