> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bloombot.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Anti-nuke

> Stop a compromised staff account from wrecking your server, and put back what it managed to break.

Anti-nuke watches for the damage a hijacked staff account does: mass bans, channels and roles being deleted, webhooks appearing, the server being renamed. When someone crosses a limit you set, Bloom acts on them and, where it can, undoes what they did.

<Info>
  Only the **server owner** and **anti-nuke admins** can use these commands. Administrators cannot, which is deliberate, since an administrator account is exactly what an attacker takes over first.
</Info>

## Quick start

<Steps>
  <Step title="Turn on protection">
    The server owner runs `!antinuke setup`. Every module is enabled, threshold modules are set to 3 actions per minute with roles removed as the punishment, instant modules ban, and recovery is turned on.
  </Step>

  <Step title="Name your staff roles">
    Run `!staffroles add @Moderator @Admin`. This is what Bloom takes away when it acts. Without it Bloom falls back to removing anything with a dangerous permission, which is much broader.
  </Step>

  <Step title="Whitelist trusted bots">
    Run `!antinuke whitelist add @YourBot` for bots that legitimately create channels or roles in bulk, so they do not trip a module.
  </Step>

  <Step title="Send the logs somewhere">
    Run `!antinuke logchannel #antinuke-logs`, and `!antinuke logdm on` if the owner should be messaged the moment something triggers.
  </Step>

  <Step title="Check your work">
    Run `!antinuke config` to see every module, threshold, and punishment in one place.
  </Step>
</Steps>

## What it watches

Threshold modules count how many times someone does something in a minute and act when the count reaches your limit. Instant modules act the first time.

| Threshold module                 | Watches for                       |
| -------------------------------- | --------------------------------- |
| `ban`                            | Members being banned              |
| `kick`                           | Members being kicked              |
| `rolecreate`, `roledelete`       | Roles being made or deleted       |
| `channelcreate`, `channeldelete` | Channels being made or deleted    |
| `emojidelete`                    | Emojis and stickers being deleted |
| `webhookcreate`, `webhookdelete` | Webhooks being made or deleted    |

| Instant module | Watches for                     |
| -------------- | ------------------------------- |
| `bot`          | A bot being added to the server |
| `vanity`       | The vanity URL being changed    |
| `memberprune`  | Members being pruned            |
| `servername`   | The server being renamed        |
| `servericon`   | The server icon being changed   |

## Who is never acted on

Bloom skips five kinds of actor, in every module:

* Itself.
* The server owner.
* Anti-nuke admins.
* Anyone on the whitelist.
* Every bot, if you have turned on `!antinuke bots on`.

<Warning>
  Anti-nuke admins are exempt from anti-nuke. Adding someone to that list makes them immune to the protection, so keep it to accounts you trust with the server itself.
</Warning>

## Setting a module

<ParamField path="antinuke setup" type="Server owner">
  Enables everything at recommended settings in one step. Only the server owner can run it, not anti-nuke admins.
</ParamField>

<ParamField path="antinuke enable <module> <threshold> <punishment>" type="Owner or anti-nuke admin">
  Turns on a threshold module.

  * **Threshold:** 1 to 10 actions per minute.
  * **Punishment:** `ban`, `kick`, or `removeroles`.
  * `!antinuke enable channeldelete 2 ban` bans anyone who deletes two channels within a minute.
</ParamField>

<ParamField path="antinuke enable <instant-module> <punishment>" type="Owner or anti-nuke admin">
  Turns on an instant module. There is no threshold to set.

  * `!antinuke enable vanity ban` bans whoever changes the vanity URL.
</ParamField>

<ParamField path="antinuke enable all [punishment]" type="Owner or anti-nuke admin">
  Turns on every module at once, optionally with a punishment applied across all of them.
</ParamField>

<ParamField path="antinuke disable <module|all>" type="Owner or anti-nuke admin">
  Turns a module off, or all of them.
</ParamField>

<ParamField path="antinuke config" type="Owner or anti-nuke admin">
  Shows every module with its state, threshold, and punishment, plus the log and recovery settings. Aliases: `settings`, `status`.
</ParamField>

## What happens when a module trips

The punishment you chose is applied to the person who did it:

| Punishment    | Effect                                                         |
| ------------- | -------------------------------------------------------------- |
| `ban`         | They are banned from the server                                |
| `kick`        | They are removed, and can be re-invited                        |
| `removeroles` | Their staff roles are taken away, leaving the account in place |

`removeroles` is the default because it stops the damage without losing the person, which matters when the account was stolen rather than turned.

<Warning>
  What `removeroles` actually removes depends entirely on whether you have run `staffroles`.

  With staff roles configured, Bloom removes **only those roles**. Without them, Bloom removes **every role carrying** Administrator, Manage Server, Manage Roles, Manage Channels, Ban Members, or Kick Members, which can strip far more than you intended.
</Warning>

Bloom never removes the `@everyone` role, roles managed by another bot or integration, or roles positioned above its own.

### Naming your staff roles

<ParamField path="staffroles <list|add|remove|set|clear> [roles]" type="Owner or anti-nuke admin">
  Chooses which roles `removeroles` takes away. Aliases: `staffrole`, `anroles`, `antinukeroles`.

  * Up to **50 roles**.
  * `set` replaces the whole list, `clear` empties it and returns Bloom to the broad fallback.
  * `!staffroles add @Moderator @Trial Mod` adds both.
</ParamField>

## Putting things back

With recovery on, Bloom tries to reverse the damage as well as stop it:

| What happened       | What Bloom does        |
| ------------------- | ---------------------- |
| Members banned      | Unbans them            |
| Channels deleted    | Recreates them         |
| Channels created    | Deletes them           |
| Webhooks created    | Deletes them           |
| Server renamed      | Sets the old name back |
| Server icon changed | Sets the old icon back |

<ParamField path="antinuke recovery <on|off>" type="Owner or anti-nuke admin">
  Turns recovery on or off. Alias: `undo`. It is on after `antinuke setup`.
</ParamField>

<Info>
  A recreated channel is a new, empty channel with the same name and position. Its messages are gone, because Discord does not keep them once a channel is deleted.
</Info>

## Admins and the whitelist

<ParamField path="antinuke admin <add|remove|list> [user]" type="Server owner">
  Manages who can configure anti-nuke besides you. Only the server owner can change this list.
</ParamField>

<ParamField path="antinuke whitelist <add|remove|list> [user]" type="Owner or anti-nuke admin">
  Exempts an account from every module. Alias: `wl`. Use it for bots that create or delete things in bulk as part of their normal job.
</ParamField>

<ParamField path="antinuke bots <on|off>" type="Owner or anti-nuke admin">
  When on, no bot is ever acted on. Alias: `ignorebots`. Whitelisting individual bots is safer than exempting all of them.
</ParamField>

## Logging

<ParamField path="antinuke logchannel <channel|reset>" type="Owner or anti-nuke admin">
  Sends anti-nuke reports to a specific channel. Alias: `log`. Without one they go to your [moderation log channel](/configuration/logging). `reset` returns to that default.
</ParamField>

<ParamField path="antinuke logdm <on|off>" type="Owner or anti-nuke admin">
  Direct messages the server owner whenever a module triggers. Alias: `dm`.
</ParamField>

Each report names the account, the action that tripped the module, the count against the threshold, what Bloom did about it, and what recovery it managed.

## Removing someone's access by hand

<ParamField path="stripstaff <user>" type="Administrator">
  Takes every role with a dangerous permission off a member at once, without waiting for a module to trip. Aliases: `destaff`, `stripperms`.

  * **Bloom needs:** a role above the roles being removed.
  * Removes any role carrying Administrator, Manage Server, Manage Roles, Manage Channels, Ban Members, Kick Members, Manage Messages, Manage Nicknames, Manage Webhooks, Manage Threads, Mute Members, Deafen Members, Move Members, Moderate Members, or View Audit Log.
  * The server owner cannot be stripped.
  * Everyone except the server owner must outrank the target to use it.
</ParamField>

<Tip>
  This is the command to reach for the moment you suspect an account is compromised. It is faster than editing roles by hand and it does not wait for the account to hit a threshold.
</Tip>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Only the server owner and anti-nuke admins can use this command">
    Being an Administrator is not enough here. Ask the server owner to run it, or to add you with `!antinuke admin add @You`.
  </Accordion>

  <Accordion title="A trusted bot keeps getting banned by anti-nuke">
    It is creating or deleting enough in a minute to cross a threshold. Run `!antinuke whitelist add @Bot` rather than raising the threshold for everyone.
  </Accordion>

  <Accordion title="A moderator lost far more roles than expected">
    No staff roles are configured, so `removeroles` fell back to removing everything with a dangerous permission. Run `!staffroles add` with the roles you actually want removed.
  </Accordion>

  <Accordion title="Anti-nuke did nothing when someone deleted channels">
    Check `!antinuke config` for the module's state. Then check whether the account is exempt: the server owner, an anti-nuke admin, a whitelisted account, or any bot while `antinuke bots` is on.
  </Accordion>

  <Accordion title="Anti-nuke blocked one of my own moderators">
    They crossed a threshold doing legitimate work. Raise that module's threshold, or add them to the whitelist if their role involves bulk changes. Their roles can be given straight back.
  </Accordion>

  <Accordion title="Recovery recreated a channel but it is empty">
    Discord does not keep the messages in a deleted channel, so nothing can restore them. Only the channel itself comes back.
  </Accordion>
</AccordionGroup>

## Related pages

<CardGroup cols={2}>
  <Card title="Permissions and hierarchy" icon="user-lock" href="/getting-started/permissions">
    How server owner, anti-nuke admin, and Administrator differ.
  </Card>

  <Card title="Join gate" icon="door-closed" href="/security/join-gate">
    Screening accounts as they arrive, before they get anywhere near a role.
  </Card>

  <Card title="Event logging" icon="rectangle-list" href="/configuration/logging">
    Where anti-nuke reports go by default.
  </Card>

  <Card title="Fake permissions" icon="user-shield" href="/security/fake-permissions">
    Give helpers Bloom commands without real Discord permissions to steal.
  </Card>
</CardGroup>
