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

# Anti-Raid / Join Gate

> Join Gate evaluates each join with independent rules for mass joins, accounts without a custom avatar, and account age. Its configuration is server-scoped and independent from the Anti-Nuke switch.

## Access and configuration

Commands require the server owner, Headless owner, or an authorized Anti-Nuke Admin. `.antiraid config` summarizes rules and state. All three rules start disabled; configure and test one at a time before enabling sanctions.

```headless-command Syntax theme={null}
.antiraid config
```

```headless-command Example theme={null}
.antiraid config
```

## Mass joins

`massjoin` starts raid state when its configured threshold is reached within the fixed 30-second technical window. The threshold must be 1–50 and the punishment is `kick` or `ban`. `--lock true` temporarily denies `@everyone` the ability to send messages and connect in channels where those permissions were allowed; `--punish true` allows the mass-join rule to punish new accounts while raid state is active.

```headless-command Syntax theme={null}
.antiraid massjoin [on|off|status] [--threshold <1-50>] [--do <kick|ban>] [--lock <true|false>] [--punish <true|false>]
```

```headless-command Example theme={null}
.antiraid massjoin on --threshold 5 --do kick --lock true --punish true
```

## Avatar and account age

The `avatar` rule detects accounts without a custom avatar or server avatar. The `age` rule compares account age with a threshold of 1–3,650 days. Each rule can use `kick` or `ban`; thresholds and actions are saved per server.

```headless-command Syntax theme={null}
.antiraid avatar [on|off|status] [--do <kick|ban>]
```

```headless-command Example theme={null}
.antiraid avatar on --do kick
```

```headless-command Syntax theme={null}
.antiraid age [on|off|status] [--threshold <1-3650>] [--do <kick|ban>]
```

```headless-command Example theme={null}
.antiraid age on --threshold 7 --do kick
```

## Join exemptions

`.antiraid whitelist @Member` grants an exception for the next join and consumes it on that entry. `.antiraid whitelist view` lists pending one-time exemptions and legacy permanent exemptions; repeating the command for an existing entry removes it. This list is separate from the Anti-Nuke whitelist.

```headless-command Syntax theme={null}
.antiraid whitelist [<@member|user_id|view>]
```

```headless-command Example theme={null}
.antiraid whitelist @Member
```

Also works: `.antiraid whitelist view`

## End a raid and restore channels

`.antiraid state` ends an active raid state. Headless records the overwrites it changed while locking channels and restores only values that still reflect its lock; if someone changed a channel afterward, it skips that channel so it does not overwrite the newer change.

```headless-command Syntax theme={null}
.antiraid state
```

```headless-command Example theme={null}
.antiraid state
```

## Post-raid cleanup

`.recentban <1-200> [reason]` (alias `.recent-ban`) selects up to 200 of the most recently joined accounts and always prepares a `ban`. `.raid <duration> kick|ban [reason]` (alias `.raidcleanup`) selects accounts that joined within a period of up to 30 days. Durations accept `s`, `m`, `h`, `d`, and `w` units, including combinations such as `1w2d`. If omitted, the audit reason is `Post-raid cleanup`. A complete member list requires the privileged Members intent; without it, no action runs. The person who starts the preview needs `Ban Members` or `Kick Members` for the selected action; Headless also needs the matching permission and rechecks permissions and hierarchy before acting.

Confirmation expires after 120 seconds, and only the person who started it can confirm or cancel. Before each punishment, Headless rechecks the server, target member, and join timestamp so it does not apply a stale preview.

```headless-command Syntax theme={null}
.recentban <1-200> [reason]
```

```headless-command Example theme={null}
.recentban 10 raid accounts
```

```headless-command Syntax theme={null}
.raid <duration> <kick|ban> [reason]
```

```headless-command Example theme={null}
.raid 2h ban raid accounts
```

## Initial values

When Join Gate is installed, `massjoin`, `avatar`, and `age` are disabled. The initial mass-join threshold is 5 in a fixed 30-second technical window; `kick` is the initial punishment. Channel locking and punishment of new accounts start disabled. The account-age rule starts at 7 days with `kick`; the avatar rule also starts with `kick`. Existing permanent exemptions and one-time join exemptions are stored separately.

> **Thresholds and punishments**
>
> `massjoin` accepts a threshold of 1–50; `age` accepts 1–3,650 days. Rules allow only `kick` or `ban`. If multiple rules match but request different punishments, Join Gate does not punish that join.

> **Post-raid cleanup**
>
> `.recentban` and `.raid` need the complete member list and are capped at 200 targets per operation. `.raid` accepts durations up to 30 days. If the preview exceeds the cap or the Members intent is unavailable, no action is applied.

## Overlapping rules

If a join triggers multiple rules that request different punishments, Headless applies no punishment for that event and records the result. Keep punishments compatible across rules that can overlap.

## Steps

**1. Review state and permissions**

Run `.antiraid config`; confirm the server, staff access, and that Headless can perform the selected punishment.

**2. Configure one rule**

Set the module, threshold, punishment, lock behavior, and treatment of new accounts. Use `status` to inspect without changing values.

**3. Validate an exemption**

If a legitimate account needs to bypass Join Gate, add it to this whitelist and verify it is consumed on the next join.

**4. Close the incident carefully**

Run `.antiraid state` to end the raid. For cleanup, review the preview and confirm only when you recognize the period, targets, and reason.

![Headless confirms that the Anti-Raid avatar rule was enabled with kick punishment; the user's mention is redacted.](https://mintcdn.com/headless-labs/ZF85v3KoGVX7saRn/images/headless-replies/anti-raid-avatar-reply-redacted.png?fit=max\&auto=format\&n=ZF85v3KoGVX7saRn\&q=85\&s=21f4ade3b9eedcb2cadace7f0f287ad6)

Actual Headless reply (in English) to `.antiraid avatar on --do kick`; the user's mention is redacted.

> [!WARNING]
>
> Bans, kicks, and channel locks affect real members. A temporary lock changes `@everyone` overwrites; Headless restores only values that still match the lock it applied. `.recentban` and `.raid` do not punish anyone until their preview is confirmed.

**Note:**

Anti-Raid and Join Gate are names for the same command group: `.antiraid` is canonical, and `.anti-raid` and `.join-gate` are also accepted. They are not separate modules. Configuration is server-scoped; it does not require Anti-Nuke to be enabled, and its exemptions do not affect the Anti-Nuke whitelist. Join Gate status, configuration, whitelist, and cleanup replies are displayed in English; registered command names and permission values are unchanged.

## Related pages

* [Anti-Nuke](/docs/en/security/anti-nuke.md)
* [Moderation setup](/docs/en/security/moderation.md)
* [Permissions](/docs/en/permissions.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.