2026-11-17 21:36:30 +03:00
2026-11-17 21:36:30 +03:00
2026-11-17 21:36:30 +03:00
2026-11-17 21:36:30 +03:00
2026-04-13 13:57:48 +03:00
2026-11-17 21:36:30 +03:00
2026-11-17 21:36:30 +03:00
2026-11-17 21:36:30 +03:00

WAYG Music Bot

Inline search for a Navidrome / Subsonic music library.

The bot downloads tracks from Navidrome and uploads them to a private Telegram storage channel. It saves Telegram file_id values in SQLite and returns InlineQueryResultCachedAudio results. Telegram never needs to fetch a signed Navidrome URL directly. The cache is shared by all users of this bot.

Setup

  1. Enable inline mode for the bot in BotFather with /setinline.

  2. Enable inline feedback in BotFather: /setinlinefeedback, select the bot, then select 100%. This lets uploads start automatically when a result is chosen.

  3. Create a private storage channel and add the bot as an administrator with permission to post messages.

  4. Copy .env.example to .env and set the bot token, Navidrome credentials and CACHE_CHAT_ID (the channel's numeric ID, usually starting with -100).

  5. Install dependencies and run the bot:

    uv sync
    uv run main.py
    

Type @your_bot track name in any chat and select a track. A new track first appears as a loading message; the bot uploads it to the storage channel and replaces that message with audio. The message also has a "Load audio" button as a fallback if inline feedback is disabled, and a retry button if the upload fails. Search itself never uploads tracks. Concurrent requests for the same track share one upload, with at most two uploads active and twenty queued. Cached tracks can be sent immediately, without starting a private conversation.

Album covers are downloaded from Navidrome, converted to JPEG thumbnails (up to 320×320 pixels and under 200 kB), and uploaded alongside the audio. If a cover is missing or cannot be downloaded, audio is still sent. Previously cached tracks with cover art are uploaded again on their next selection to add the thumbnail; messages already sent to chats are not changed.

AUDIO_CACHE_PATH defaults to .cache/audio.sqlite3. Preserve that file across deployments to avoid uploading tracks again. Cache entries are separated by bot, Navidrome address/account and track metadata. Keep the storage channel private.

Run offline tests with .venv/bin/python -m unittest discover -s tests.

S
Description
Telegram Bot to search music on OpenSubSonic server via inline queries
Readme MIT
222 KiB
0 Stars 1 Watchers 0 Forks
Languages
Python 100%