- Create a new Discord Application: https://discord.com/developers/applications
- Open the Discord Application and click the
Bot
tab on the left nav bar. - Give your bot a name and get an auth token for it (this goes into
DISCORD_BOT_AUTH_TOKEN
below) - Enable
Message Content Intent
for your bot. - Go to OAuth2 > URL Generator in the left nav bar, choose
bot
scope andBan Members
+Send Messages
+Read Messages/View Channels
+Read Message History
fromBot Permissions
. - Navigate to the link at the bottom of the page using an account with
Manage Server
permission. - Create a new private channel and in server settings set it as the
System Messages Channel
. Be sure to leave "Send ea random welcome message when someone joins this server" enabled. - Make sure the bot can has
Ban Members
,Send Messages
,Read Message History
in the system messages channel andSend Messages
in the admin channel of your choice. - Create a
docker-compose.yml
file, or similardocker run
command with the following, and make sure it can access the internet:
my-service-name:
deploy:
restart_policy:
condition: 'any'
environment:
DISCORD_SERVER_ID: '<server ID of Discord server in question>'
DISCORD_JOIN_LOG_CHANNEL_ID: '<channel ID that user join logs show up in, should not contain any other messages and should be private>'
DISCORD_ADMIN_CHANNEL_ID: '<channel ID that the bot should send a message if it notices a raid>'
DISCORD_BOT_AUTH_TOKEN: '<Discord bot auth token>'
image: 'micahzoltu/discord-mass-ban-bot@sha256:a7e19954255c33b7855131a0db02e1758b1add8ff146f445c4df379a0f687f44'
logging:
driver: 'json-file'
options:
max-size: '5m'
user: 'root'
- Run the docker container.
- When you see a large number of people join in a row, send the following message to the channel:
ban <message ID> <message ID>
wheremessage id
is the id of the first and last message in the system messages channel that contains the joins you want to ban. - The bot will send a message to the channel confirming your intent.
- React to the bot's message with a 👍
- Watch the bot ban all of the new joiners.
It is recommended to use this bot along with the 10 minute delay for new members, as this gives you time to react to the raid before they can start DMing people.