How to set up a Discord anti-raid bot
A raid response should be planned before a join surge makes decisions harder. Build Discord Bots includes an Anti-Raid module with join-rate detection, an account-age filter, a username filter, verification roles, an alert channel, and a choice of lockdown, kick, or ban when a configured threshold is reached. This guide uses the dashboard for the long-lived settings and a small, reversible Discord test for the emergency control. Anti-Raid is a Pro module.
Start freeStart free. Pro is $9.99/month.
Before you start
- Have a bot online in the server you manage, with Pro. Keep a private staff channel ready for alerts, and make sure the bot can view it and send messages there.
- Review your server roles before enabling verification. The bot can only assign a role below its highest Discord role. Tell moderators which staff members may change anti-raid settings, because its commands require Manage Server or Manage Roles permissions.
Enable the module for the right server
Open the bot in the dashboard, select Modules, turn on Anti-Raid, and use the card gear button to open Settings. Select the server in the Server selector before changing any control. Anti-Raid settings are saved per server, so a setting for a test community does not protect another community where the same bot is present. Wait for the bot to be online if enabling the module causes it to restart. The Enable Anti-Raid switch turns the checks on or off for that selected server; leave it off while you are still deciding thresholds.
This module is not a substitute for Discord permissions, moderator judgment, or an incident plan. It reacts to the conditions you configure: a rapid join rate, an account age rule, or a matching username filter. Start with values that fit ordinary joins in your own community. A launch announcement, partner event, or migration can legitimately bring many people at once, so a threshold copied from another server may create unwanted action. Write down who can turn protection off and how staff will communicate with members during a real event.
Choose an Anti-Raid Log Channel
In Anti-Raid Log Channel, select a private moderator channel. This is where the module posts alerts and actions. None means logging is disabled, which makes it harder for staff to see what happened after a threshold is reached. The bot needs access to the selected channel even when the channel is hidden from normal members. If the channel list does not load, use a channel ID only after confirming it belongs to the selected server; an ID from another server cannot become a useful destination for this configuration.
Keep the log channel readable to the people who will respond, not necessarily every moderator. A useful operating habit is to pin a short incident note there: where to coordinate, which permissions are safe to change, and how to unlock the server if needed. The guide cannot choose that policy for you. The product records its alerts in the selected channel, but it does not turn an empty log channel into a staffed response team. Save after selecting the channel so the bot receives the current setting.
Set join-rate detection and a response
Turn on Enable Join Rate Limit, then set Max Joins In Window and Join Window (seconds). The join threshold is the number of joins inside that timeframe that triggers the raid response. Select the Raid Action deliberately: Lockdown Server, Kick New Joins, or Ban New Joins. Lockdown is the reversible option when you want staff to investigate before removing people. Kick and ban affect new joining members, so test them only in a controlled server and use numbers that accommodate your normal traffic pattern.
The dashboard also exposes the same state through Discord commands. `antiraid` views or configures anti-raid settings, while `raidaction lockdown` chooses lockdown as the detection response. Do not treat a command example as a recommendation for every community: the command changes the saved behavior for the server where it is run. A good first configuration is one a moderator can explain: what number of joins matters, how long the window is, who sees the alert, and whether the first automated action is reversible.
Add account-age and username checks carefully
Enable Account Age Filter only if your community has decided that recently created accounts should be blocked. Set Minimum Account Age (hours) and choose the Account Age Action, kick or ban. The optional Account Age DM Message is sent when possible, but direct messages can be closed, so do not rely on it as the only explanation. A strict age setting can exclude legitimate newcomers who made a Discord account for your server. Test with a disposable test account only when you understand the effect of the selected action.
Enable Username Filter when you have specific names or phrases you want checked on join, then add only terms your team has reviewed. The module checks username and display/global name against the blocked username words. It normalizes common spacing and lookalike bypasses, but that is not a reason to add broad words that could catch ordinary members. `namefilter` manages the saved list and `accountage` changes the age rule in Discord; both are staff controls, not member commands. Keep a written appeal or correction path for a legitimate person who is blocked.
Optionally use a verification role
Enable Verification System if you want new members to receive an unverified role until staff verify them. Choose an Unverified Role and a Verified Role from roles below the bot’s highest role. The module assigns the unverified role on join and the verified role when an authorized staff member verifies that member. Decide the permissions of those roles before activating the switch: an unverified role is useful only when your channel and role permissions actually limit access in the way you intend.
In Discord, `verification` configures the verification system and `verify` grants the verified role to a member when used by someone with Manage Roles. Run a test with a staff-controlled account that has no special role, then inspect both the role assignment and the channels the account can see. Do not test by changing a real member’s access without telling them. If Discord refuses a role assignment, move the bot role above the target role and check its Manage Roles permission before retrying.
Test the reversible emergency control
Use a test server or a quiet test channel configuration to check the emergency control. Run `lockdown on` from an account with Manage Server and inspect the affected channel permissions before inviting anyone. Then run `lockdown off` and confirm that normal access returns. This is safer than trying to manufacture a real raid just to see a threshold fire. The lockdown command is an immediate staff control; it can be useful even when the automatic join-rate response is switched off while you tune values.
When the test is complete, turn Enable Anti-Raid on, save the selected server, and make sure the bot remains online. Review the log channel after any real alert and adjust only from observed server behavior. If a response is too aggressive, disable the relevant check, resolve the situation, and choose a less disruptive configuration. Build Discord Bots can host the module, but it cannot know which join surge is welcome or which moderation action fits your community. Revisit the settings before large events rather than changing them in panic.
Frequently asked questions
Is Anti-Raid included on the Free plan?
No. Anti-Raid is a Pro module; keep your account on Pro if you need it to remain active.
What does lockdown do?
The lockdown command enables or disables the module’s server lockdown control. Check the resulting channel permissions in a test server before relying on it during an incident.
Can the bot verify members automatically?
The module can assign an unverified role on join and authorized staff can use verify to give the verified role. The staff verification decision remains yours.
