A Go tool that automatically uploads images from specific folders on your PC to a Discord channel.
Download the latest version for your operating system from the Releases page.
💡 Tip: After downloading, make the file executable:
chmod +x discord-image-uploader-*
- Download binary (see above)
- Create configuration:
curl -O https://raw.githubusercontent.com/ManuelReschke/discord-image-uploader/main/config/config.example.json mv config.example.json config.json
- Create Discord webhook and add URL to
config.json
- Start:
./discord-image-uploader-* -config config.json
- ✅ Multi-Path Monitoring: Watch multiple configurable folders for new image files in real-time
- ✅ Recursive/Non-Recursive: Each path can be individually monitored recursively or top-level only
- ✅ Exclude Patterns: Exclude folders/files per path (e.g., "Thumbs", "*.tmp", ".git")
- ✅ Discord Integration: Automatic upload to Discord channel via Bot API or Webhooks
- ✅ Supported Formats: PNG, JPG, JPEG, GIF, WEBP
- ✅ Batch Upload: Upload multiple images simultaneously
- ✅ Configurable: Upload intervals, batch size, file size limits
- ✅ Optional: Delete images after successful upload
- ✅ Robust Error Handling: Comprehensive logging and graceful shutdown
- ✅ Windows Pause: Window stays open on errors for better user experience
- ✅ Backward Compatibility: Old configurations continue to work
- ✅ File Size Validation: Discord-compliant size limits (8MB default)
- Go 1.19 or higher
- Option 1: Discord Bot Token and appropriate permissions
- Option 2: Discord Webhook URL (easier setup)
-
Clone repository:
git clone https://github.com/ManuelReschke/discord-image-uploader.git cd discord-image-uploader
-
Install dependencies:
go mod tidy
-
Create configuration:
cp config/config.example.json config/config.json
-
Configure Discord (choose one option):
Option A: Webhook (Recommended - Easier Setup)
- Go to your Discord channel
- Right-click → "Edit Channel" → "Integrations" → "Webhooks"
- Click "New Webhook" and copy the webhook URL
- Enter the webhook URL in
config/config.json
Option B: Discord Bot
- Create a Discord Bot at https://discord.com/developers/applications
- Copy the Bot Token
- Invite the bot to your server with "Send Messages" and "Attach Files" permissions
- Find the Channel ID of the target channel
- Enter token and Channel ID in
config/config.json
-
Compile tool:
go build -o discord-image-uploader.exe ./cmd
Configuration is done via a JSON file (config/config.json
):
Multi-Path Configuration (v0.2.0+):
{
"discord": {
"webhook_url": "https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_WEBHOOK_TOKEN"
},
"watcher": {
"paths": [
{
"path": "C:\\Users\\Username\\Pictures\\Screenshots",
"recursive": true,
"exclude_patterns": ["Thumbs", "*.tmp", ".git"]
},
{
"path": "C:\\Users\\Username\\Downloads\\Images",
"recursive": false,
"exclude_patterns": ["temp", "cache"]
}
],
"supported_formats": [".png", ".jpg", ".jpeg", ".gif", ".webp"],
"delete_after_upload": false
},
"upload": {
"batch_size": 5,
"interval_seconds": 10,
"max_file_size_mb": 8
}
}
Legacy Configuration (still supported):
{
"discord": {
"webhook_url": "https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_WEBHOOK_TOKEN"
},
"watcher": {
"folder_path": "C:\\Users\\Username\\Pictures\\Screenshots",
"supported_formats": [".png", ".jpg", ".jpeg", ".gif", ".webp"],
"delete_after_upload": false
}
}
Parameter | Description | Required | Default |
---|---|---|---|
discord.webhook_url |
Discord Webhook URL (Option A) | Webhook or Bot | - |
discord.token |
Discord Bot Token (Option B) | Webhook or Bot | - |
discord.channel_id |
Discord Channel ID (Bot only) | With Bot Token | - |
Parameter | Description | Default |
---|---|---|
watcher.paths |
Array of watch paths (v0.2.0+) | - |
watcher.paths[].path |
Path to watch | - |
watcher.paths[].recursive |
Watch recursively (true/false) | true |
watcher.paths[].exclude_patterns |
Exclude pattern array | [] |
watcher.folder_path |
Legacy: Single path (deprecated) | - |
watcher.supported_formats |
Supported file formats | [".png", ".jpg", ".jpeg", ".gif", ".webp"] |
watcher.delete_after_upload |
Delete files after upload | false |
Parameter | Description | Default |
---|---|---|
upload.batch_size |
Number of files per batch | 5 |
upload.interval_seconds |
Upload interval in seconds | 10 |
upload.max_file_size_mb |
Maximum file size in MB | 8 |
"Thumbs"
- Excludes all folders named "Thumbs""*.tmp"
- Excludes all .tmp files".git"
- Excludes .git folders"cache"
- Excludes folders named "cache"
./discord-image-uploader.exe -config config/config.json
-config
: Path to configuration file (default:config/config.json
)
Configuration values can also be set via environment variables:
# Webhook configuration
export DISCORD_UPLOADER_DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/..."
# Bot configuration (alternative)
export DISCORD_UPLOADER_DISCORD_TOKEN="your_token"
export DISCORD_UPLOADER_DISCORD_CHANNEL_ID="your_channel_id"
# Additional options
export DISCORD_UPLOADER_WATCHER_FOLDER_PATH="/path/to/watch"
discord-image-uploader/
├── cmd/
│ └── main.go # Main application
├── internal/
│ ├── config/
│ │ └── config.go # Configuration management
│ ├── discord/
│ │ └── client.go # Discord API Client
│ ├── watcher/
│ │ └── watcher.go # File System Watcher
│ └── uploader/
│ └── uploader.go # Upload logic
├── config/
│ └── config.example.json # Example configuration
├── go.mod
├── go.sum
└── README.md
- Initialization: Loads configuration and establishes Discord connection (Bot or Webhook)
- Folder Monitoring: Watches configured folder with
fsnotify
- File Detection: Detects new image files in supported formats
- Queue: Adds files to upload queue
- Batch Upload: Uploads files via Discord API (Bot) or HTTP requests (Webhook)
- Cleanup: Optional: Deletes files after successful upload
Aspect | Webhook | Bot |
---|---|---|
Setup | Very easy - just copy URL | Complex - create bot, set permissions |
Permissions | Automatically available | Manual configuration |
Rate Limits | Less restrictive | Discord Bot Rate Limits |
Features | File upload only | Extended Discord features possible |
Recommendation | ✅ For simple uploads | For advanced bot functions |
github.com/bwmarrin/discordgo
- Discord API Clientgithub.com/fsnotify/fsnotify
- File System Watchergithub.com/spf13/viper
- Configuration Management
Use the Makefile for easy builds:
# All platforms
make build-all
# Current platform only
make build
# Development build
make dev
# Full release
make release
# Show help
make help
Manual Builds:
# Development build
go build -o discord-image-uploader ./cmd
# Cross-platform builds
make build-windows # Windows builds
make build-linux # Linux builds
make build-mac # macOS builds
go test ./...
-
"Failed to connect to Discord"
- With Webhook: Check webhook URL for validity
- With Bot: Check bot token and channel ID, ensure bot has necessary permissions
-
"Watch path does not exist"
- Check the path in configuration
- Ensure the folder exists
-
"File too large"
- Standard Discord limit is 8MB
- Nitro servers have 50MB limit
The tool logs all important events:
- Connection status
- File detection
- Upload status
- Errors and warnings
MIT License - see LICENSE file for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Image compression before upload
- Web interface for configuration
- Multiple Discord server support
- Statistics and monitoring
- Plugin system for various cloud providers