Automated music discovery and download via Telegram bot. Resolves track metadata from Spotify, searches and downloads FLAC files from Soulseek (via slskd), renames them to Artist - Title.flac, and places them in your music library. Docker-ready.
You: "Nancy Sinatra Bang Bang"
Bot: Found: Nancy Sinatra - Bang Bang (My Baby Shot Me Down) (2:42)
Searching slskd for FLAC...
#1 [free] 2:42 | 16bit/44.1kHz | 30MB
#2 [free] 2:41 | 16bit/44.1kHz | 28MB
[Download #1] [Download #2] [Auto-pick best] [Cancel]
You: (taps Download #1)
Bot: Downloaded! Nancy Sinatra - Bang Bang (My Baby Shot Me Down).flac -> /music/
Artist - Title.flac, and placed in your output directoryservices:
slskd-importer:
image: drumsergio/telegram-slskd-local-bot:0.12.0
container_name: slskd_importer
restart: unless-stopped
environment:
TELEGRAM_BOT_TOKEN: "your-bot-token"
TELEGRAM_ALLOWED_USERS: "your-telegram-user-id"
SPOTIFY_CLIENT_ID: "your-spotify-client-id"
SPOTIFY_CLIENT_SECRET: "your-spotify-client-secret"
SLSKD_HOST: "http://your-slskd-host:5030"
SLSKD_API_KEY: "your-slskd-api-key"
volumes:
# Read-write: the bot deletes rejected files and sweeps abandoned ones
- /path/to/slskd/downloads:/downloads
- /path/to/music/library:/music
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "3"
# Clone the repo
git clone https://github.com/GeiserX/telegram-slskd-local-bot.git
cd telegram-slskd-local-bot
# Create virtual environment
python -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
pip install -e ".[dev]"
# Copy and configure environment
cp .env.example .env
# Edit .env with your credentials
# Run
python -m music_downloader run
| Variable | Required | Default | Description |
|---|---|---|---|
TELEGRAM_BOT_TOKEN | Yes | — | Telegram bot token from @BotFather |
TELEGRAM_ALLOWED_USERS | Yes | (deny all) | Comma-separated Telegram user IDs allowed to use the bot. Empty means the bot denies everyone (fail-closed) — the denial reply shows you your ID |
SPOTIFY_CLIENT_ID | Yes | — | Spotify Developer app Client ID |
SPOTIFY_CLIENT_SECRET | Yes | — | Spotify Developer app Client Secret |
SLSKD_HOST | Yes | — | slskd instance URL (e.g., http://192.168.1.100:5030) |
SLSKD_API_KEY | Yes | — | slskd API key (Settings > Security > API Keys) |
DOWNLOAD_DIR | No | /downloads | Where slskd stores completed downloads (container path) |
OUTPUT_DIR | No | /music | Where to place renamed FLAC files (container path) |
AUTO_MODE | No | false | Default auto-download state for chats that never toggled /auto: best match is downloaded and saved without asking |
MAX_RESULTS | No | 10 | Maximum search results shown to user |
DURATION_TOLERANCE_SECS | No | 5 | Duration match tolerance in seconds |
SEARCH_TIMEOUT_SECS | No | 30 | slskd search timeout |
DOWNLOAD_TIMEOUT_SECS | No | 600 | Download completion timeout |
DOWNLOAD_CLEANUP_HOURS | No | 24 | Hours before abandoned files in DOWNLOAD_DIR are auto-deleted (hourly sweep; 0 disables). In-flight transfers are never touched |
EXCLUDE_KEYWORDS | No | live,remix,... | Comma-separated keywords to filter out |
FILENAME_TEMPLATE | No | {artist} - {title} | Output filename template |
LOG_LEVEL | No | INFO | Logging level |
HEALTH_PORT | No | 8080 | Health check HTTP port |
| Command | Description |
|---|---|
| (any text) | Search for a song and show download options |
/import <spotify url> | Import a Spotify playlist or album — review each track or auto-save all |
/cancel | Cancel the active import or search |
/auto | Toggle auto-download per chat: best match is downloaded and saved without picking or approval (persists across restarts) |
/status | Show active searches and downloads |
/history | Show recent download history |
/help | Show help message |
Search results are ranked by:
Results containing excluded keywords (live, remix, etc.) are automatically filtered out, unless the original track title also contains that keyword.
┌──────────────────┐ ┌──────────────┐ ┌──────────────────┐
│ Telegram Bot │────▶│ Spotify API │ │ slskd (Soulseek)│
│ (user input) │ │ (metadata) │ │ (search/download)│
└──────────────────┘ └──────────────┘ └──────────────────┘
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────────────────────────┐
│ Music Downloader Service │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────────┐│
│ │ Resolver │─▶│ Searcher │─▶│ Scorer │─▶│ File Processor ││
│ │(Spotify) │ │ (slskd) │ │(ranking) │ │(rename + move) ││
│ └──────────┘ └──────────┘ └──────────┘ └──────────────────┘│
└─────────────────────────────────────────────────────────────────┘
│
▼
┌──────────────┐
│ Music Library │
│ (FLAC files) │
└──────────────┘
Music Pipeline:
Telegram Bots:
Content type
Image
Digest
sha256:7a429f81d…
Size
278.5 MB
Last updated
about 1 month ago
docker pull drumsergio/telegram-slskd-local-bot