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

# Anti-Raid

> Threshold-based join flood detection with automated mitigation — blocks raids before they cause damage

## Overview

Anti-Raid is a real-time protection system that monitors your server for abnormal join activity. When the join rate crosses the configured threshold within a rolling time window, Anti-Raid automatically triggers your configured mitigation actions — such as locking the server, kicking or banning joiners, deleting invites, or quarantining new members.

Unlike Verdict Mode which targets internal threats, Anti-Raid is focused entirely on external attacks: coordinated bot raids, mass-join floods, and invite abuse. It is designed to act instantly and automatically without requiring manual intervention.

<Warning>
  Actions like **Auto-Ban** and **Lockdown** affect all users who joined during the raid window — including potentially legitimate users. Configure your threshold carefully to avoid false positives.
</Warning>

***

## How It Works

Every member join is tracked within a rolling time window. Once the number of joins reaches or exceeds the threshold within that window, Anti-Raid enters **raid mode** and executes all enabled actions against the detected joiners.

**Example:** If the threshold is set to `5` with a `10s` window, 5 members joining within 10 seconds will trigger raid mode immediately.

After a raid is resolved, the server can be unlocked manually or automatically after a configurable delay. Raid tracking data is cleared on every bot restart to prevent stale data from causing false positives.

***

## Access Control

The same access rules as Antinuke apply:

* **Server Owner** — Full access to all Anti-Raid features
* **Extra Owner** — Extra owners added by server owner
* **Antinuke Admins** — Users designated by the server owner

<Tip>
  Use `antinukeadmin` to manage who can configure Anti-Raid.
</Tip>

***

## Commands

<AccordionGroup>
  <Accordion title="antiraid" icon="shield-halved">
    Opens the Anti-Raid interactive control panel to toggle actions and view current configuration. Requires the module to be enabled first.

    <CodeGroup>
      ```bash Syntax theme={null}
      ,antiraid
      ```

      ```bash Example theme={null}
      ,antiraid
      ,antiraid config
      ```
    </CodeGroup>

    **Aliases:** `raidprotect`\
    **Permissions:** Server Owner or Antinuke Admin
  </Accordion>

  <Accordion title="antiraid on" icon="toggle-on">
    Enables the Anti-Raid module, unlocking the control panel and all subcommands. Does not automatically enable any mitigation actions — you must toggle them manually after enabling.

    <CodeGroup>
      ```bash Syntax theme={null}
      ,antiraid on
      ```

      ```bash Example theme={null}
      ,antiraid on
      ```
    </CodeGroup>

    **Aliases:** `antiraid enable`\
    **Permissions:** Server Owner or Antinuke Admin
  </Accordion>

  <Accordion title="antiraid off" icon="toggle-off">
    Disables the Anti-Raid module entirely. All active protections and actions become inactive immediately.

    <CodeGroup>
      ```bash Syntax theme={null}
      ,antiraid off
      ```

      ```bash Example theme={null}
      ,antiraid off
      ```
    </CodeGroup>

    **Aliases:** `antiraid disable`\
    **Permissions:** Server Owner or Antinuke Admin
  </Accordion>

  <Accordion title="antiraid threshold" icon="sliders">
    Set the join rate that triggers raid detection. Both the join count and time window must be provided. Cannot be used unless the module is enabled.

    <Warning>
      Both joins and seconds must be at least **5**.
    </Warning>

    <CodeGroup>
      ```bash Syntax theme={null}
      ,antiraid threshold <joins> <seconds>
      ```

      ```bash Example theme={null}
      ,antiraid threshold 5 10
      ,antiraid threshold 10 15
      ```
    </CodeGroup>

    **Permissions:** Server Owner or Antinuke Admin
  </Accordion>

  <Accordion title="antiraid accountage" icon="calendar">
    Set the minimum account age in days. Accounts younger than this value will be flagged and subject to configured actions during a raid.

    <CodeGroup>
      ```bash Syntax theme={null}
      ,antiraid accountage <days>
      ```

      ```bash Example theme={null}
      ,antiraid accountage 7
      ,antiraid accountage 30
      ```
    </CodeGroup>

    **Aliases:** `antiraid minage`\
    **Permissions:** Server Owner or Antinuke Admin
  </Accordion>

  <Accordion title="antiraid unlock" icon="lock-open">
    Manually unlocks the server after a raid if auto-unlock has not yet triggered or is disabled.

    <CodeGroup>
      ```bash Syntax theme={null}
      ,antiraid unlock
      ```

      ```bash Example theme={null}
      ,antiraid unlock
      ```
    </CodeGroup>

    **Permissions:** Server Owner or Antinuke Admin
  </Accordion>

  <Accordion title="antiraid config" icon="list-check">
    View the current Anti-Raid configuration including module status, threshold, account age filter, auto-unlock delay, and all enabled actions.

    <CodeGroup>
      ```bash Syntax theme={null}
      ,antiraid config
      ```

      ```bash Example theme={null}
      ,antiraid config
      ```
    </CodeGroup>

    **Aliases:** `antiraid settings`\
    **Permissions:** Server Owner or Antinuke Admin
  </Accordion>

  <Accordion title="antiraid status" icon="chart-line">
    View the current raid status and recent raid history, including join counts, kicks, bans, and whether lockdown is active.

    <CodeGroup>
      ```bash Syntax theme={null}
      ,antiraid status
      ```

      ```bash Example theme={null}
      ,antiraid status
      ```
    </CodeGroup>

    **Permissions:** Server Owner or Antinuke Admin
  </Accordion>
</AccordionGroup>

***

## Mitigation Actions

When raid mode triggers, Anti-Raid executes all enabled actions simultaneously against users who joined during the detection window. Each action can be toggled independently from the control panel.

<CardGroup cols={2}>
  <Card title="Delete Invites" icon="link-slash">
    Deletes all active server invites immediately when a raid is detected to cut off the attack vector
  </Card>

  <Card title="Lockdown" icon="lock">
    Revokes send message permissions across all channels, preventing raid members and the broader server from interacting
  </Card>

  <Card title="Auto-Kick" icon="boot">
    Automatically kicks all users who joined during the raid detection window
  </Card>

  <Card title="Auto-Ban" icon="gavel">
    Permanently bans all users who joined during the raid detection window
  </Card>

  <Card title="Quarantine" icon="shield">
    Isolates joining users by stripping all roles and restricting permissions without kicking or banning
  </Card>
</CardGroup>

***

## Threshold Configuration

| Setting               | Description                                                  | Minimum | Default      |
| --------------------- | ------------------------------------------------------------ | ------- | ------------ |
| **Joins**             | Number of joins required to trigger raid mode                | 5       | 5            |
| **Window**            | Time in seconds joins are tracked within                     | 5s      | 10s          |
| **Min Account Age**   | Minimum account age in days for joining members              | 0       | 0            |
| **Auto-Unlock Delay** | Minutes before the server automatically unlocks after a raid | —       | Configurable |

<Tip>
  For large, active servers with frequent legitimate join spikes (giveaways, announcements), raise both the join count and window to prevent accidental lockdowns.
</Tip>

***

## Control Panel Interface

Running `,antiraid` opens an interactive control panel built with Discord Components V2. The interface includes:

* **Real-time status display** showing module state, configured threshold, and minimum account age
* **Individual toggle buttons** for each mitigation action with live enabled/disabled indicators
* **Global controls:**
  * Enable Module
  * Disable Module
  * Configure (threshold, account age, auto-unlock delay)

<Note>
  Only the user who ran the command can interact with the control panel. The panel becomes inactive after 2 minutes but remains visible.
</Note>

***

## Raid Status

The `,antiraid status` command provides a live snapshot of raid activity:

**During an active raid:**

* Duration of the ongoing raid
* Number of joins detected in the window
* Running kick and ban counts
* Whether lockdown is currently active

**When no raid is active:**

* Confirmation the server is currently safe
* Summary of the most recent raid (time elapsed, joins, kicks, bans)

***

## Auto-Unlock

After a lockdown is triggered, the server can be unlocked in two ways:

* **Automatic** — After the configured auto-unlock delay elapses, the bot restores channel permissions automatically
* **Manual** — Run `,antiraid unlock` at any time to immediately restore the server

<Warning>
  If no auto-unlock delay is configured, the server will remain locked until you manually run `,antiraid unlock`.
</Warning>

***

## Difference from Verdict Mode

| Feature                | Anti-Raid                | Verdict Mode                         |
| ---------------------- | ------------------------ | ------------------------------------ |
| Threat type            | External (raids, floods) | Internal (trusted users going rogue) |
| Trigger                | Join rate threshold      | Destructive action threshold         |
| Whitelist bypass       | N/A                      | Yes — no exceptions                  |
| Configurable actions   | Yes                      | Always ban                           |
| Per-action time window | No                       | Yes                                  |
| Lockdown support       | Yes                      | No                                   |
| Auto-unlock            | Yes                      | No                                   |

***

## Logging Integration

Every Anti-Raid action is automatically recorded in the Antinuke punishment log, including the trigger event, affected users, and actions taken.

<Info>
  All Anti-Raid actions are logged to your configured logging channel if enabled.
</Info>

***

## Best Practices

* Enable Anti-Raid **alongside** Verdict Mode for layered protection — Anti-Raid handles external floods, Verdict Mode handles internal threats.
* Start with the default threshold (`5 joins in 10s`) and raise it if your server regularly sees fast legitimate join spikes.
* Enable **Delete Invites** as a baseline — it cuts off the raid source even if you don't want auto-kick or auto-ban.
* Set a **minimum account age** of at least 7 days to filter throwaway raid accounts.
* Configure an **auto-unlock delay** so your server doesn't stay locked indefinitely if you miss the notification.
* Regularly review your config with `,antiraid config`.

<Warning>
  If you use Auto-Ban, any legitimate users who happened to join during the raid window will be permanently banned. Consider using Quarantine as a safer first action if false positives are a concern.
</Warning>
