Skip to main content

telegram-slskd-local-bot

telegram-slskd-local-bot

PyPI Tests License Docker Pulls Stars

telegram-slskd-local-bot is a Telegram bot, run in Docker next to your slskd, that turns a song name typed on your phone into a lossless file in your music library. It looks the song up on Spotify, searches Soulseek, ranks the lossless copies by duration, bit depth and source with any lossy copies listed below them, and sends you the file in the chat so you can listen to it and read its lossless check before it is saved as Artist - Title in its own format. Doing the same by hand in the slskd web UI means reading file lists, guessing which copy is the studio version and finding out after the fact that the FLAC was an MP3.

Features

  • Send a song name; the bot resolves artist, title, album and duration on Spotify and searches Soulseek through your slskd for every audio format: lossless (FLAC, WAV, AIFF, ALAC, APE, WavPack, TTA, TAK) and lossy (MP3, AAC, M4A, Ogg, Opus, WMA).
  • Lists every lossless copy of known length before every lossy one, so a song with no lossless copy still gets the best MP3 or AAC. Within each group it ranks by duration against Spotify, bit depth and sample rate (hi-res first) or bitrate, free slots, speed and file name; drops live, remix and karaoke cuts unless the title has them.
  • Sends you the track in the chat before it is saved: the file itself, or an Opus copy of the whole song when the file is over Telegram's 50 MB limit. With a local Bot API server (compose profile bigfiles) the limit is 2000 MB and originals go as they are.
  • Checks the spectrum of a lossless file found from a song name (by you or /auto) and flags an MP3-style cutoff ("Possible transcode", "Likely transcode", "Fake lossless") before Save. /import skips it. FLAC, WAV and AIFF are checked; other lossless formats say "not checked".
  • Warns when similar files are already in the library before it searches.
  • Saves as Artist - Title with its own extension (.flac, .wav, .mp3...) and the Spotify cover art embedded, in the folder your player or audio-transcode-watcher watches.
  • /import a Spotify playlist or album and review each track or auto-save them all; /status shows the progress.
  • Chat delivery (/deliver, or fixed per account with TELEGRAM_CHAT_DELIVERY_USERS) sends the track into the chat under 50 MB and saves nothing anywhere, so you can share the bot without sharing your library. It ranks copies by quality for their size instead: an MP3 at 320 kbps counts as much as a lossless file, and the smaller file wins.
  • /format per chat sends tracks as the original, MP3 320 kbps or Opus 192 kbps, for whoever wants MP3 whatever the source.
  • A wishlist: "Tell me when it appears" when nothing is found, "Wait for a better copy" under every result list. The bot searches again every WISHLIST_CHECK_HOURS and tells you, or fetches the copy with /auto on; /wishlist lists and removes wishes.
  • /auto per chat saves the best match without a tap; a failed transfer gets Retry and Try next result; downloads show live progress.
  • Answers only allow-listed Telegram users, and denies everyone while the list is empty.
  • Sweeps abandoned downloads after DOWNLOAD_CLEANUP_HOURS and never touches a transfer in flight.
  • An MCP server over the same pipeline, so an agent like Claude Code can resolve, search, download and wishlist tracks: stdio with python -m music_downloader mcp, or HTTP from the bot process with a bearer token (MCP_PORT, MCP_TOKEN).

Quick start

You need a running slskd with an API key, a Spotify Developer app and a Telegram bot token, on an amd64 host (the image has no arm64 build).

mkdir slskd-importer && cd slskd-importer
curl -fsSLO https://raw.githubusercontent.com/GeiserX/telegram-slskd-local-bot/main/docker-compose.yml
curl -fsSL https://raw.githubusercontent.com/GeiserX/telegram-slskd-local-bot/main/.env.example -o .env
# edit .env: TELEGRAM_BOT_TOKEN, TELEGRAM_ALLOWED_USERS (your Telegram user id), SPOTIFY_CLIENT_ID and
# SPOTIFY_CLIENT_SECRET, SLSKD_HOST and SLSKD_API_KEY, SLSKD_DOWNLOAD_PATH (slskd's completed-downloads
# folder) and MUSIC_OUTPUT_PATH (your library); the last two must be writable by uid 1000
mkdir -p data && sudo chown 1000:1000 data    # the container runs as uid 1000
docker compose up -d                          # starts drumsergio/telegram-slskd-local-bot:0.16.1

The container is slskd_importer, and the log line Music Downloader v0.16.1 starting means it is up. A message to your bot (for example Nancy Sinatra Bang Bang) is answered with the Spotify matches to pick from, or with the ranked copies when there is only one match; an empty TELEGRAM_ALLOWED_USERS answers nobody, and the denial reply shows your id. Getting started has the other install paths.

Documentation

The docs are at geiserx.github.io/telegram-slskd-local-bot.

  • Getting started: prerequisites, Docker Compose, running from PyPI
  • Configuration: every environment variable and its default
  • Usage: what the chat shows, the commands, how results are scored
  • MCP server: the tools, the stdio and HTTP setup for Claude Code and Claude Desktop, the token
  • How it works: the path from a message to a file in the library
  • Troubleshooting: the failures people hit and what to report in an issue
  • Development: running from a checkout, tests, releases

Release notes are in the changelog. Bugs and questions go to the issues; security problems to the security policy, never a public issue.

Music pipeline: slskd-transform, audio-transcode-watcher, quality-gate-encoder. Other Telegram bots: paperless-telegram-bot, jellyfin-telegram-channel-sync, Telegram-Archive. The rest are in Related projects.

License

GPL-3.0-or-later

Metadata

Release files for telegram-slskd-local-bot 0.16.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for telegram-slskd-local-bot 0.16.1
File Size Uploaded
telegram_slskd_local_bot-0.16.1.tar.gz 197.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for telegram-slskd-local-bot 0.16.1
File Interpreter ABI Platform
telegram_slskd_local_bot-0.16.1-py3-none-any.whl Python 3 none any Details

Total release size: 315.8 kB

Release files / telegram_slskd_local_bot-0.16.1.tar.gz

Download URL telegram_slskd_local_bot-0.16.1.tar.gz
Size 197.2 kB
Tags Source
SHA-256 checksum
How to use checksums
60a2e2c5963555a8577ff33a2c8c0a52cc89f62fea5e10a1e7a0f4bdbc46af13
BLAKE2b-256 checksum
How to use checksums
d9c31d31adbb23c4deac70def293b547584381afee8535b30fe589aea8ed4bfc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release files / telegram_slskd_local_bot-0.16.1-py3-none-any.whl

Download URL telegram_slskd_local_bot-0.16.1-py3-none-any.whl
Size 118.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8201daeedbc2795c054e26f451f53644f81e1fea9a6cad3f0328dfc7b1746c97
BLAKE2b-256 checksum
How to use checksums
4fc3307090a1035f1f2007edac729dc5f3ce6f767624a3093def9a5baea2268a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release history Release notifications | RSS feed

This release

0.16.1 This release

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.5

2 release files

0.10.4

2 release files

0.10.3

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.5.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page