ZMN Bot Documentation
Setup guides and configuration reference for every ZMN module — security, moderation, roles, leveling, and access control.
Quick Navigation
Security Module
Advanced anti-nuke protection and real-time threat detection
Overview
The Security Module protects your server against nukes, raids and unauthorized actions. It watches high-risk actions as they happen, counts them with Redis, and responds automatically.
Protection Against:
- • Mass bans, kicks, and role deletions
- • Unauthorized bot additions
- • Admin role grants and dangerous permissions
- • Server vandalism (name, icon, vanity changes)
- • Channel and role spam/deletion
- • Mass mention spam
Key Features
Real-Time Detection
Watches 20 high-risk server actions the moment they happen
Rate Limiting
Redis-based counters track actions within 60-second windows
Instant Punishment
Automatically ban, kick, time out or strip dangerous roles when a threat is detected — or only send an alert
Whitelist
The server owner is always exempt; whitelist trusted users or roles to skip every check
Alert Notifications
DM chosen users and members of chosen roles when a security event fires
Detailed Logging
Comprehensive logs with executor info, actions taken, and timestamps
How It Works
1Event Detection
The bot monitors Discord audit logs and events in real-time, detecting administrative actions like bans, kicks, role changes, and server modifications.
2Whitelist Check
Before taking action, the bot checks the whitelist. The server owner and ZMN are always exempt, and trusted users or roles can be whitelisted. Other bots are not exempt unless you whitelist them.
3Rate Limit Check
For limit-based protections, the bot increments a Redis counter and fires once the count reaches the configured limit within the fixed 1-minute window.
4Punishment & Logging
If a threat is detected, the configured action is applied (ban, kick, timeout, clear roles, or alert only). A detailed log is posted to the protection's log channel (or the module log channel), and alert users and alert-role members are DMed.
Protection Types
Anti-Nuke Limits (Rate-Based)
These protections trigger when a user performs too many actions within 60 seconds. Each has a configurable limit and action.
Mass Bans
Detects excessive member bans
Mass Kicks
Detects excessive member kicks
Role Creation
Detects rapid role creation
Role Deletion
Detects mass role deletions
Channel Creation
Detects rapid channel creation
Channel Deletion
Detects mass channel deletions
Mass Mentions
Counts messages that mention members or roles (@everyone and @here are not counted)
Anti-Nuke Instant (Immediate Response)
These protections trigger immediately on the first occurrence. No rate limiting - instant punishment.
Bot Addition
Triggers when a bot is added by anyone but the owner or a whitelisted member. The new bot is kicked too.
External Bots
Triggers when a member uses an app installed on their own account. Deletes every message the app posts. Public replies only — Discord never shows ephemeral replies to bots.
Admin Role Grant
Triggers when a role with Administrator is given to a member. The role is always taken back, whatever the action.
Dangerous Permissions
Triggers when dangerous permissions are granted
Member Prune
Triggers when a member prune is run on the server
Vanity URL Change
Triggers when the server's vanity URL is changed
Server Rename
Triggers when the server name is changed
Server Icon Change
Triggers when the server icon is changed
Role Rename
Triggers when a role is renamed
Channel Rename
Triggers when a channel is renamed
Emoji Deletion
Triggers when server emojis are deleted
Emoji Rename
Triggers when server emojis are renamed
Invite Deletion
Triggers when server invites are deleted
Punishment Actions
When a threat is detected, you can choose one of five actions:
Ban
Permanently bans the offending user from the server. This is the most severe action.
Kick
Removes the user from the server. They can rejoin with a new invite.
Clear Roles
Removes every role carrying Administrator, a Manage permission, or Ban/Kick/Timeout Members. They remain in the server but lose those privileges. Premium only: a server without premium runs a Kick instead (never a ban).
Timeout
Times the user out for the duration you choose (1 minute to 1 week).
Do nothing (send message)
No punishment — only the alert and the log are sent.
Configuration
General Settings
Log Channel
channelThe module's main log channel, used by every protection that has no channel of its own
Alert Roles
rolesMembers of these roles are DMed every security alert (free: 1 role)
Alert Users
usersUsers DMed every security alert (premium)
Whitelisted Users
usersUsers exempt from every security check (free: up to 3)
Whitelisted Roles
rolesMembers with these roles are exempt from every check (premium). Use carefully!
Warning Messages
toggleWhile on (the default), every action under a limit posts an orange warning log and alert DM without punishing
DM on Punishment
togglePremium. DMs the punished member. Default message: "You were {action} in {server}. Reason: {reason}" — {action} is a single word such as banned, kicked, timed out or warned. "Do nothing" sends no DM.
Per-Protection Settings
Each protection type can be configured individually:
Enabled
toggleTurn this specific protection on or off
Limit (Limits Only)
numberHow many of this action within 1 minute trigger the punishment (the action that reaches the limit is punished)
Action
selectWhat to do: ban, kick, timeout (with a duration), clear roles (premium), or do nothing (send message)
Log Channel
channelChannel for this protection's logs; if empty, the module's main log channel is used
Whitelist
The whitelist lets trusted administrators act without triggering security protections.
How the Whitelist Works:
- • The server owner, ZMN, and whitelisted users or roles are completely exempt from all checks. Other bots are not exempt unless whitelisted
- • No logs are generated for their actions
- • No rate limiting counters are incremented
- • No punishments are applied
Logging & Notifications
Log Embeds Include:
- • Executor: Who performed the action (with avatar)
- • Target: Who was affected (for role grants, bans, etc.)
- • Action Type: What punishment was applied
- • Event Counter: Current count vs. limit (for rate-based)
- • Revert result: for Admin Role Grant, the roles added and removed; for renames, icon and permission changes, whether the change was undone
- • Punishment Time: How long the punishment took to execute
- • Timestamp: When the event occurred
Alert Notifications
Alert users and members of alert roles receive the same embed by DM — for punishments and, while Warning Messages is on, for warnings too.
Rate Limiting Details
The security module uses Redis for distributed rate limiting with the following characteristics:
Fixed 1-Minute Windows
The first action starts a 1-minute counter; it expires 60 seconds later and the next action starts a new one. The window is fixed at 1 minute for every server.
Per-User Tracking
Counters are tracked per guild, per user, per event type. Each user has independent limits.
Counter Reset
After a punishment succeeds, the counter is cleared (except Mass Mentions, which keeps counting until the minute ends).
Warning Mode
While Warning Messages is on (the default), each action under the limit posts an orange warning log and alert DM without punishing. Turn it off to log only punishments.
Best Practices
✓ Recommended Setup
- • Start with conservative limits (5-10 per minute) and adjust based on your server's needs
- • Use "Do nothing (send message)" at first to see what would trigger without punishing anyone
- • Set up separate log channels for limits and instant protections
- • Whitelist your admin team (users, or roles on premium) to prevent false positives
- • Set alert users or roles so staff are DMed the moment any protection fires
- • Test protections in a test server before enabling in production
✗ Common Mistakes
- • Setting limits too low (can trigger on legitimate bulk actions)
- • Not whitelisting trusted admins
- • Using "ban" action without testing first
- • Forgetting to configure log channels (no visibility into events)
- • Enabling all protections at once without gradual rollout
Example Scenarios
Scenario 1: Mass Ban Attack
Situation: A compromised admin account starts banning members rapidly.
Detection: The 5th ban within the minute reaches the limit.
Action: Bot immediately bans the compromised account and logs the event.
Result: Attack stopped after 5 bans instead of potentially hundreds.
Scenario 2: Unauthorized Bot Addition
Situation: Someone adds a malicious bot to the server.
Detection: Bot-add instant protection triggers immediately.
Action: The bot kicks the new bot and applies the configured action (Ban by default) to the person who added it.
Result: The malicious bot is removed and the attacker is stopped before doing further damage.
Scenario 3: Admin Role Self-Grant
Situation: A member gives themselves an admin role through an exploit.
Detection: Admin-grant instant protection detects the role change.
Action: The bot takes the admin role back, then applies the configured action — with Clear Roles, both the executor and the target lose their dangerous roles. (Admin Role Grant is a premium protection.)
Result: The grant is undone and the member loses the elevated access.
Technical Details
System Architecture:
- • Event Listeners: Individual event handlers for each protection type
- • Redis Storage: Distributed counters with automatic expiration
- • Audit Log Parsing: Extracts executor information from Discord audit logs
- • Permission Checking: Validates bot permissions before applying punishments
- • Failure Reporting: If the bot cannot punish (permissions or role order), the alert says so; only Admin Role Grant falls back to clearing roles
- • Response Time: Each alert shows how long the punishment took

