This bot facilitates banning many users at a time on Discord using regular expressions.
- python3
- discord.py, python-dateutil
python3 -m pip install -U discord.py python-dateutil
- Create an application: https://discord.com/developers/applications .
- Enable the bot in the tab "Bot" on the side.
- Disable "Public Bot".
- Enable "Server Members Intent".
- Copy the token and set the environment variable in your terminal
export DISCORD_BAN_BOT_TOKEN=thetoken
. - Go to the tab "OAuth2" and check "bot" followed by "Kick Members", "Ban Members", "View Channels".
- Copy the URL, go to the URL, and join the server you want to ban people from.
python3 ban.py --after 2021-04-23 'botToBanUser.*'
The bot will let you confirm before actually banning the users.