Server protection bot: anti-nuke, anti-raid, anti-spam.
pip install -r requirements.txt
cp .env.example .env
Fill DISCORD_TOKEN in .env with a bot token from the Discord Developer Portal.
Enable these privileged intents on the bot: Server Members Intent, Message Content Intent.
Invite the bot with permissions: Manage Roles, Kick Members, Ban Members, Manage Channels, Moderate Members, View Audit Log.
python bot.py
/guard status- show current config/guard setlog #channel- set alert channel/guard whitelist_add @member//guard whitelist_remove @member/guard nuke_threshold count window_seconds/guard nuke_punishment strip_roles|kick|ban/guard raid_threshold count window_seconds/guard raidmode on|off/guard toggle anti_nuke|anti_raid|anti_spam enabled:true|false
- Anti-nuke watches audit log entries for channel/role deletion, mass channel creation, bans, webhook creation. If the same executor exceeds the threshold within the window, roles are stripped (or the executor is kicked/banned depending on config) and an alert is posted.
- Anti-raid tracks join rate. Once the threshold is hit, raid mode auto-enables and kicks new joiners whose account age is below the configured minimum until disabled.
- Anti-spam tracks message rate per member per guild, purges the burst and times the member out.
Per-guild config is stored as JSON under guard/data/<guild_id>.json.