Anti-Nuke Bot for Discord: How to Protect Your Server
A "nuke" is when someone with too much power in your Discord server uses it to wreck the place in a few seconds: channels deleted, roles wiped, members banned, and @everyone spam from new webhooks. Discord's own settings prevent most nukes before they start, and they're free. This guide covers those first, then what an anti-nuke bot adds and how the BotDrop Kit's anti-nuke works, including what we haven't tested yet.
What a Discord nuke is
A nuke isn't a hack of Discord itself. It's someone using permissions your server already gave out. The usual ways in:
- A moderator or admin account gets taken over, often through a fake login page or a "try my game" file. The attacker now has that person's permissions.
- A bot's token leaks, for example in a public code repo or a screenshot. Whoever has the token controls the bot, along with every permission you gave it.
- Someone you trusted turns on you, like a moderator who leaves on bad terms with their roles still in place.
What they do next is predictable: they delete channels and roles, ban or kick members in bulk, create webhooks to spam scam links or @everyone pings, or rename the server. Every one of those actions needs a specific permission, so the best defense is to give those permissions to as few people as possible.
Step 1: Get the role order right
Discord's roles work top-down. In Discord's words, members can only affect users with roles lower than their highest role, and that applies to bots too. A moderator can't ban, kick or edit anyone whose highest role is equal to or above theirs. Only the server owner is above the whole list.
- Open Server Settings → Roles. Roles higher in the list outrank roles lower down.
- Put your most trusted admin role at the top. Moderator roles go below it, and roles for ordinary members go below those.
- Put each bot's role below your mod roles unless the bot really has to manage them. Then a hijacked bot can't strip your moderators.
- Remember that Administrator grants every permission and skips every channel restriction. Discord itself says to give it out with extreme caution. It still doesn't let anyone act on roles above their own.
Step 2: Require 2FA for moderator actions
Server-wide two-factor authentication means moderators and admins can't take moderation actions, like deleting messages or banning, unless their own account has 2FA turned on. That makes a stolen password much less useful.
- Turn on 2FA for your own account first, under User Settings → My Account. Discord won't let you require it for others until you have it.
- As the server owner, open Server Settings → Safety Setup and turn on the 2FA requirement for moderation.
- Tell your mod team before you flip it, so nobody is surprised when their ban button stops working.
Step 3: Do a permissions audit
Set aside 15 minutes and go through every role and every bot. These are the permissions a nuke uses:
| Permission | What it lets someone do in a nuke |
|---|---|
| Administrator | Everything below, plus skip channel restrictions |
| Manage Channels | Delete or rename channels |
| Manage Roles | Delete roles or hand out powerful ones |
| Ban / Kick Members | Remove your community in bulk |
| Manage Webhooks | Create webhooks that spam any channel |
| Mention @everyone | Ping the whole server with a scam link |
| Manage Server | Rename the server, change invites and settings |
- People: remove roles from anyone who's inactive or no longer on the team. Fewer admins means fewer accounts that can be taken over.
- Bots: kick bots you no longer use. For the rest, give each one only the permissions its own docs ask for, rather than Administrator.
- Webhooks: open Server Settings → Integrations → Webhooks and delete any you don't recognize.
- @everyone: check that the base role can't mention @everyone or manage anything.
Step 4: Turn on AutoMod and raid alerts
A nuke from the inside is often followed by spam. Discord's built-in tools catch a lot of it:
- AutoMod: turn on Block Mention Spam and the spam filters. Our guide to stopping scam links with Discord AutoMod walks through every rule.
- Activity Alerts: Discord can warn admins and moderators about unusual activity, such as a sudden wave of joins or DMs. Pick the alert channel under Server Settings → Safety Setup → Raid Protection and CAPTCHA.
- Security Actions: from the server's drop-down menu, you can pause invites and pause DMs between non-friends for a set time, on desktop or mobile, while you deal with the problem.
Step 5: Keep a backup of your layout
If the worst happens, you'll want a record of how the server was set up. Discord's Server Templates save your categories, channels, roles and permissions, but not messages or members. Create one under Server Settings → Server Templates, and click Sync Template after big changes. A template creates a new server rather than restoring the old one, but it saves you hours of rebuilding. Keep the link private, since anyone with it can copy your layout.
The Audit Log under Server Settings shows who did what. Discord keeps entries for 45 days, so check it soon after anything strange happens.
If you're being nuked right now
- Stop the account. Remove its roles or ban it. If it's a bot, kick it, then reset its token in the Developer Portal.
- Pause invites and DMs with Security Actions.
- Delete rogue webhooks under Integrations.
- Read the Audit Log to see everything that was changed, then rebuild from your template or notes.
- Tell your members what happened and not to click any links that were posted.
What an anti-nuke bot adds
Discord's settings decide who can do damage. They don't step in when a trusted account suddenly deletes ten channels in a row. An anti-nuke bot watches the audit log for that kind of burst and reacts automatically, usually by taking away the account's powerful roles.
Before you add one, know its limits:
- It reacts after the first few actions. It can stop a nuke in progress, but it can't undo deletions.
- It can only act on accounts whose roles are below its own, and never on the server owner. If the owner account is compromised, no bot can help, which is why 2FA matters most for you.
- It needs powerful permissions itself, so its token needs the same care as an admin password.
How the BotDrop Kit's anti-nuke works (BETA)
The Gaming Community Kit for Discord includes anti-nuke lite. It's a bot you run and own: the code runs on your computer or your host, not ours. It's off by default. Turn it on with /setup antinuke:True or from the Kit's local dashboard.
It watches Discord's audit log for one account doing too much within 30 seconds. These are the default limits, and you can change them in the dashboard or config.yaml:
| Action by one account | Default limit (30 s) |
|---|---|
| Channels deleted | 3 |
| Roles deleted | 3 |
| Members banned | 3 |
| Members kicked | 4 |
| Webhooks created | 3 |
| Messages sent by one webhook | 15 |
When an account goes over a limit, the Kit removes that account's dangerous roles (Administrator, Manage Server, Channels, Roles, Webhooks or Messages, Ban, Kick, Moderate Members and Mention Everyone), as long as those roles sit below the bot's role. A spamming webhook is deleted. The Kit posts an alert with a case number in #mod-log and DMs the server owner. It never acts on the server owner, on itself, or on IDs you add to its whitelist, so add your trusted admins and other bots there. If you'd rather it only warns you, set action: alert.
Watch-only first week. On a new install, anti-nuke spends its first 7 days only posting in #mod-log which roles it would have removed, and changes nothing. That way an admin's busy clean-up day doesn't cost them their roles while you tune the limits. Click Turn on enforcement in the dashboard, or run /setup enforcement:True, to end the week early.
Why it's labelled BETA: anti-nuke receives real audit-log events on a live Discord test server, and its alert posts to #mod-log. It's covered by unit tests, and we tested the watch-only mode with simulated raid events. It has not been tested against a real raid by another account. Try it on a test server first. It needs the View Audit Log, Manage Roles and Manage Webhooks permissions, and its role has to be above the roles it should remove.
The Kit also includes auto-moderation, free games, Steam deals, patch notes and more, for a one-time $25. Anti-nuke is one extra layer. It works best on top of Steps 1 to 5, not instead of them.
Sources
- Discord: Discord Roles and Permissions (role hierarchy, Administrator)
- Discord Developer Docs: Permissions (permission hierarchy for bots)
- Discord Safety Center: Four steps to a safer server (2FA for moderators)
- Discord: Activity Alerts + Security Actions
- Discord: Pause Invites FAQ
- Discord: AutoMod FAQ
- Discord: Server Templates
- Discord Developer Docs: Audit Logs (45-day retention)