Anti-Raid
Ban joining members who match a known raid profile, and give roles and a welcome message to members who finish Discord's membership screening.
Why Use This Feature?
- Bans joins that match avatar hashes or usernames from past raids, before they can post or message your members.
- Reports each ban with the signals that matched, so moderators can see why the bot acted.
- Hands out entry roles once a member accepts your rules, so new members get access without waiting for a moderator.
How It Works
The feature has two parts, and you can use either one or both.
Raid Bans
- What it checks — When a member joins, the bot compares their avatar hash with your avatar list, and their username and display name with your username list.
- How names match — Names match when they are equal after the bot turns styled and fullwidth letters into plain ones, trims outer spaces, and lowercases them. Accents, extra inner spaces, and partial names still don't match.
- What it does — Any match bans the member, with the matched signals as the ban reason in the server's audit log, such as
Anti-raid: configured username. - What it posts — After each ban, the bot posts one plain-text report to the alert channelWhere a feature posts its reports for moderators, naming the member and the signals that matched.
- When Discord refuses the ban — The report says the bot couldn't ban the member and adds Discord's error, so a moderator can step in.
The avatar check uses the member's main avatar, not a server-specific avatar, and a member without an avatar never matches.
These reports post only in your Discord alert channelWhere a feature posts its reports for moderators, while Notifications sends alerts about the bot itself to your phone or inbox.
New Member Access
- When it runs — When Discord marks a member as having completed membership screening.
- What it does — The bot adds the gate roles the member doesn't have yet, then posts the gate message in the gate channel.
- All or nothing — If any gate role is missing, managed by an integration, or at or above the bot's highest role, the bot adds no roles and posts nothing.
The gate message posts even when the member already had every gate role.
Requirements
- Server Members intentLets the bot see members join, leave, and change — Switch on this privileged intentAn intent you must switch on in the Developer Portal first for your application in the Discord Developer Portal.
- Membership screening — New member access runs only when a member finishes Discord's membership screening, so the server needs screening turned on.
- Ban permission — The bot needs Ban Members to ban matching members.
- Channel permissions — The bot needs View Channel and Send Messages in the alert channelWhere a feature posts its reports for moderators and the gate channel.
- Role permissions — The bot needs Manage Roles, and its highest role has to sit above every gate role.
Settings
| Field | Description |
|---|---|
Raid bans → Channel (auto-ban.channel) | The alert channelWhere a feature posts its reports for moderators for ban reports, required for raid bans. |
Raid bans → Avatars (auto-ban.avatars) | 1 to 100 avatar hashes to match exactly. |
Raid bans → Usernames (auto-ban.usernames) | 1 to 100 names to compare with each joining member's username and display name. |
New member access → Channel (membership-gate.channel) | The channel where the gate message posts. |
New member access → Roles (membership-gate.roles) | 1 to 25 roles to give members who finish screening. |
New member access → Message (membership-gate.payload) | Optional Text of up to 2,000 characters and Footer → Footer text of up to 1,000, posted as two lines of plain text. |
Raid bans need at least one avatar or username. Without a message, the gate posts "You have successfully passed the membership gateRoles and a welcome once a member passes screening."
Mentions in the gate message don't notify anyone, so the new member gets no ping.
Example
{
"auto-ban": {
"channel": { "channel-id": "123456789012345678" },
"usernames": [{ "username": "Discord Support" }]
},
"membership-gate": {
"channel": { "channel-id": "123456789012345679" },
"roles": [{ "role-id": "223456789012345678" }],
"payload": { "content": "Welcome to %GUILD_NAME%, %MEMBER_MENTION%!" }
}
}
Message Variables
The gate message supports these message variablesA %PLACEHOLDER% the bot fills in when it sends. The ban report text is fixed and has none.
| Variable | Becomes |
|---|---|
%GUILD_NAME% | The server's name |
%MEMBER_MENTION% | A mention of the member |
%YEAR% | The current year in UTC |
Limits
- Lists — 100 avatars, 100 usernames, and 25 gate roles.
- Message length — The ban report and the gate message are cut at 2,000 characters, and the ban reason at 512.
Troubleshooting
- A raid account wasn't banned — Check the exact name, because matching ignores only letter case, outer spaces, and styled or fullwidth letters. Avatar matching uses the member's main avatar hash.
- "Couldn't ban a joining member who matched anti-raid signals." — The report's Error line has Discord's reason. Usually the bot is missing Ban Members, or the member has a role at or above the bot's highest role.
- The gate didn't run for a member — The bot sees screening only for members it has seen since its last reconnect, so a member who joined before a reconnect and finishes screening after it is missed.
- "Membership-gate role … is unavailable or not manageable." — This log entry means a gate role was deleted, is managed by an integration, or sits above the bot's highest role.
- "Fix this feature's settings before turning it on." — Imported settings may have no alert channelWhere a feature posts its reports for moderators, so choose one under Raid bans → Channel and save.
- Example role
000000000000000000— Replace the placeholder role, the placeholder avatar hash, and both example channels from the example settingsSample values to start a feature you haven't set up before you turn the feature on.
Changes from the legacy bot
The legacy botThe old v3.4.3 bot that ran from a config.json file banned members whose avatar or exact username matched, without posting anything in Discord. The rewrite also checks display names, ignores letter case and styled letters, and reports each ban in an alert channelWhere a feature posts its reports for moderators set in auto-ban.channel, so an imported legacy feature without one stays off until you choose a channel.
The gate message is now plain text with the footer on a second line, and %YEAR% uses UTC instead of the legacy time zoneThe zone a schedule's times are read in; UTC by default setting.