Discord bot for downloading media from URLs (using yt-dlp) and uploading them directly into Discord channels.
- Context Menu Command: Right-click any message →
Apps→Download media. - Slash Command: Use
/download url:<media_url>in any channel or DM. - Discord Attachment Limit (20 MB): Enforces a strict 20 MB size limit (configurable) and formats media to stay within limit.
- Auto-Discovery: Automatically locates
yt-dlpin$PATHifYTDLP_PATHis not explicitly set. - Concurrency Control: Limits simultaneous downloads via a configurable worker semaphore to avoid CPU/network exhaustion.
- Safe Temp File Handling: Downloads directly to temporary directories and reliably cleans them up after upload.
- Clean Error Handling: Catches and sanitizes yt-dlp errors for user-friendly Discord feedback.
- Go 1.26+
yt-dlpinstalled and in yourPATH(or specified via config)ffmpeg(recommended for yt-dlp audio/video muxing)
You can configure dwn via a JSON file or environment variables.
{
"DISCORD_BOT_TOKEN": "YOUR_DISCORD_BOT_TOKEN",
"YTDLP_PATH": "/usr/bin/yt-dlp",
"MAX_FILE_SIZE_MB": 20,
"MAX_CONCURRENT": 4,
"DOWNLOAD_TIMEOUT_S": 180
}| Variable | Description | Default |
|---|---|---|
DISCORD_BOT_TOKEN |
Discord Bot Token (required) | — |
YTDLP_PATH |
Path to yt-dlp binary |
Auto-detected in $PATH |
MAX_FILE_SIZE_MB |
Maximum attachment file size limit in MB | 20 |
MAX_CONCURRENT |
Maximum concurrent downloads | 4 |
DOWNLOAD_TIMEOUT_S |
Download timeout per item in seconds | 180 |
export DISCORD_BOT_TOKEN="your_token_here"
go run .go run . config.json
# or
go run . -config config.jsongo test -v ./...