A comprehensive Discord bot that downloads and organizes photos from any Discord channel, with intelligent duplicate prevention and progress tracking.
- 🖼️ Download all images from any Discord channel
- 🔄 Resume capability - picks up where it left off
- 📁 Organized storage - files sorted by server/channel
- 🚫 Duplicate prevention - tracks processed messages
- ⚡ Concurrent downloads - fast and efficient
- 📊 Progress tracking - detailed statistics and reporting
- 🛡️ Error handling - robust with retry logic
- Python 3.8 or higher
- Discord Bot Token (or User Token)
- Bot permissions:
Read Message History,View Channel
-
Clone or download this project to your desired location
-
Install dependencies:
pip install -r requirements.txt
-
Set up Discord Bot:
- Go to Discord Developer Portal
- Create a new application
- Go to "Bot" section and create a bot
- Copy the bot token
- Invite the bot to your server with "Read Message History" permissions
-
Configure environment: Create a
.envfile in theconfigdirectory:DISCORD_BOT_TOKEN=your_bot_token_here
List available servers:
python main.py --list-guildsList channels in a server:
python main.py --list-channels --server-id YOUR_SERVER_IDDownload images from a channel:
python main.py --server-id YOUR_SERVER_ID --channel-id YOUR_CHANNEL_IDStart fresh (ignore previous progress):
python main.py --server-id YOUR_SERVER_ID --channel-id YOUR_CHANNEL_ID --freshView channel statistics:
python main.py --stats --server-id YOUR_SERVER_ID --channel-id YOUR_CHANNEL_IDList all tracked channels:
python main.py --list-tracked-
Enable Developer Mode in Discord:
- User Settings → Advanced → Developer Mode (ON)
-
Get Server ID:
- Right-click on server name → "Copy Server ID"
-
Get Channel ID:
- Right-click on channel name → "Copy Channel ID"
Downloaded images are organized as follows:
data/
└── downloads/
└── ServerName_ServerID/
└── ChannelName_ChannelID/
├── 2024-01-15_MessageID_image1.jpg
├── 2024-01-15_MessageID_image2.png
└── ...
You can customize the scraper by setting environment variables:
# Maximum file size in MB (default: 50)
MAX_FILE_SIZE_MB=100
# Number of concurrent downloads (default: 5)
CONCURRENT_DOWNLOADS=3
# Supported image formats (default: jpg,jpeg,png,gif,webp,bmp)
SUPPORTED_FORMATS=jpg,png,gif
# Progress report interval (default: 100 messages)
PROGRESS_REPORT_INTERVAL=50The scraper automatically saves progress in data/progress.json. This allows you to:
- Resume interrupted downloads - restart from where you left off
- Avoid duplicates - skip already downloaded images
- Track statistics - see total images downloaded per channel
- Rate limiting - respects Discord's API limits
- File size limits - prevents downloading huge files
- Permission checking - validates access before starting
- Error recovery - handles network issues gracefully
"No Discord token provided"
- Make sure your
.envfile is in theconfigdirectory - Verify the token is correct and properly formatted
"Guild not found or bot not in guild"
- Ensure the bot is invited to the Discord server
- Check that the server ID is correct
"No permission to read message history"
- The bot needs "Read Message History" permission
- Re-invite the bot with proper permissions
"Channel not found"
- Verify the channel ID is correct
- Ensure the bot has access to the channel
- Check the error messages - they usually indicate the exact problem
- Verify your Discord IDs - use the
--list-guildsand--list-channelscommands - Test bot permissions - try accessing a public channel first
- Never share your bot token - treat it like a password
- Use bot tokens, not user tokens - user tokens violate Discord's ToS
- Store tokens securely - use environment variables or
.envfiles - Respect Discord's ToS - don't scrape private content without permission
This tool is for educational and personal use only. Users are responsible for:
- Complying with Discord's Terms of Service
- Respecting copyright and privacy rights
- Obtaining necessary permissions before scraping content
- Using downloaded content appropriately
Happy scraping! 🎉