🎉 Launch offer: the next 5 servers get 30 days free. Claim a spot →
All topics & search

Guide/Protect your server/Anti-nuke

Discord Anti-Nuke Bot: Stop Server Nukes Instantly

Instant bans for unauthorised destructive actions, permission grants per role, thresholds and restore, what the alerts mean.

Quick answer

Strict mode with grants

!antinuke enable
!security set antinuke.strictPrivileged on
!antinuke permrole role:@Mods actions:ban,kick,timeout,purge limit:5 window:10
!antinuke permrole role:@ChannelTeam actions:channelCreate,channelUpdate,channelDelete limit:10 window:60

Ask the guide

Step by step

The first action is the one that matters

With strict mode on (!security set antinuke.strictPrivileged on, or Security → Protection → Anti-nuke), every destructive action is judged the instant Discord writes its audit entry — before the matching gateway event even arrives. The person is banned first; the incident, the alert and the restore follow. Measured end to end this takes about a third of a second, almost all of it Discord's own ban round-trip.

Who is allowed to do what is decided by one rule, used by every layer:

  1. 1The owner, the bot, and anyone on the plain whitelist (!whitelist add user @x antinuke) may do anything.
  2. 2Anyone else must hold a permission grant role that lists that specific action — and stay inside the role's shared budget.
  3. 3Everything else is a ban on the first action. If the ban cannot land (they sit above the bot), the server is locked for 15 minutes and staff are paged.
  4. 4Touching the bot itself — stripping its roles, removing a permission from a role it holds, deleting its powered role — is never covered by a grant.

Permission grants

A grant says "this role may ban, time out and purge, up to 5 actions per 10 seconds, and nothing else". Actions are specific: ban unban kick timeout prune purge · channelCreate channelUpdate channelDelete · roleCreate roleUpdate roleDelete assignRole · webhookCreate webhookUpdate webhookDelete · emojiCreate emojiUpdate emojiDelete · botAdd serverUpdate. The budget is shared across every granted action — a nuke is many actions of any kind.

!antinuke permrole role:@Mods actions:ban,kick,timeout,purge limit:5 window:10
!antinuke permrole role:@ChannelTeam actions:channelCreate,channelUpdate,channelDelete limit:10 window:60
!antinuke permrole role:@Admins actions:all limit:20 window:10
!antinuke permrole role:@Mods remove:true

Dashboard: Security → Permission grants is a per-role grid of these actions with the shared limit. Give every moderator role a grant that matches its job and keep the plain all whitelist for bots and the owner.

What the alerts tell you

  • ⚡ Non-whitelisted action stopped — who, what, and the reaction time split into detect, decide and the ban round-trip.
  • 📊 Damage report, a few seconds later — how many destructive actions the attacker logged, how fast, how many landed before the ban, and how many objects were restored. Entries stamped after the ban are labelled as possibly in-flight: Discord's audit timestamps and the ban are two different clocks.
  • Protection level: MAXIMUM — after a confirmed strike every threshold drops to 1 for 30 minutes, so a second account or a script is stopped on its first move.

The slower layer: thresholds and restore

Underneath the instant path, destructive actions are still counted per actor inside a window. Over the limit, the actor is punished and, when restore is on for that event, the change is reverted from the emergency snapshot: deleted channels and roles are recreated with their permissions. Channels the bot re-creates are never mistaken for a fresh attack.

EventCounts
ban / kick / pruneMembers removed
channelDelete / channelCreate / channelRenameChannel changes
roleDelete / roleCreate / roleRenameRole changes
dangerousPermissionA role gained a permission from the dangerous list (Administrator, Manage Server, Manage Roles, Ban, Kick, Manage Webhooks…)
dangerousRoleA member was given a role that holds a dangerous permission
botAddA bot was added
webhookCreate / webhookDelete / webhookUpdateWebhook changes
vanityChange · serverRename · serverIcon · emojiDelete · emojiRenameServer identity changes
!antinuke enable
!antinuke threshold channelDelete 3 60        3 deletions within 60 s
!antinuke protect roleDelete on restore:true
!setpunishment channelDelete ban
!antinuke dangerous Administrator,ManageGuild,ManageRoles,BanMembers
!antinuke protected @Admin #announcements      roles/channels that may never be deleted or edited
!antinuke status
  • Trust after days (default 7): members newer than this are held to the limits immediately; older members and whitelisted admins get the configured slack.
  • The server owner is never punished. Whitelisted users are exempt from counting and from restore, but still bound by moderator limits.
  • Anti-nuke needs View Audit Log to know who did something, and the bot's role must sit above every human role — Discord will not let it ban anyone at or above its own position. An Administrator above the bot cannot be stopped reactively; that is a role-hierarchy fix, not a setting.
  • Self-protection watches the bot's own standing: whoever strips its roles or permissions is banned, and staff are told to restore the role.

Copy and try

Strict mode with grants

!antinuke enable
!security set antinuke.strictPrivileged on
!antinuke permrole role:@Mods actions:ban,kick,timeout,purge limit:5 window:10
!antinuke permrole role:@ChannelTeam actions:channelCreate,channelUpdate,channelDelete limit:10 window:60

Thresholds and restore for the slower layer

!antinuke threshold channelDelete 3 60
!antinuke protect roleDelete on restore:true
!setpunishment channelDelete ban
!antinuke protected @Admin #announcements

Good to know

  • The bot cannot ban anyone whose top role is at or above its own; move its role up.
  • A user whitelisted with protection all is never restored against; prefer a grant.
  • Reaction time is ~0.3 s end to end, almost all of it Discord's ban round-trip; a scripted burst can land several actions in that window, which is why restore and backups exist.

If it does not work

  • A moderator was banned for a normal action. Their role has no grant covering that action. Add one, then unban.
  • "Ban failed — above my role". Role hierarchy. Drag the bot role above the attacker's role; the server was locked meanwhile.
  • No ⚡ alert at all. Strict mode is off, anti-nuke is off, or the bot lacks View Audit Log.

Still stuck? Ask in the support server.

Discord Anti-Nuke Bot: Stop Server Nukes Instantly · Sweet