A Python script to unban all banned users from a Discord server.
This script will unban ALL banned users from your Discord server. Use with extreme caution and only if you're absolutely sure you want to unban everyone.
- Python 3.6 or higher
- A Discord bot token with "Ban Members" permission
- The server ID where you want to unban users
-
Clone or download this repository
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables: Create a
.envfile in the root directory with the following:DISCORD_BOT_TOKEN=your_discord_bot_token DISCORD_SERVER_ID=your_server_id_here
- Go to the Discord Developer Portal
- Create a new application or select an existing one
- Go to the "Bot" section
- Copy the token under "Token"
- Make sure your bot has the "Ban Members" permission in your server
- Enable Developer Mode in Discord (User Settings → Advanced → Developer Mode)
- Right-click on your server name
- Select "Copy Server ID"
Run the script:
python main.pyThe script will:
- Validate your environment variables
- Show a warning and ask for confirmation
- Fetch all banned users
- Unban each user with progress tracking
- Display a summary of results
- ✅ Secure: Uses environment variables instead of hardcoded credentials
- ✅ Safe: Requires explicit confirmation before proceeding
- ✅ Robust: Handles rate limits and network errors gracefully
- ✅ Informative: Shows progress and detailed results
- ✅ Modern: Clean code with proper error handling
- Never commit your bot token to version control
- Keep your bot token secure and regenerate it if compromised
- Only run this script when you're certain you want to unban all users
"Unauthorized" error: Check that your bot token is correct and valid
"Missing Permissions" error: Ensure your bot has the "Ban Members" permission
"Bad Request" error: Verify your server ID is correct
Rate limiting: The script automatically handles Discord's rate limits
Join our Discord for help and community support: https://discord.gg/tsbBKz2k53
Created by Atif Ahmed 🖤
This project is open source. Use responsibly and at your own risk.
