Lyra is a self-hosted, lightweight, and modern Discord Music Bot containerized with Docker. Designed for high reliability on Unraid (home network) and Linux VPS servers.
It utilizes a hybrid streaming engine:
- YouTube Data API v3: Lightning-fast song search, playlist item resolution, and metadata lookup without triggering bot scraping blocks.
- yt-dlp: Direct Opus audio stream URL extraction on demand.
- FFmpeg: Real-time transcoding and audio streaming directly to Discord voice channels with zero disk bloat.
- Slash Commands (
/): Modern Discord interaction with autocomplete and intuitive UI. - Rich Embeds: Thumbnail previews, song duration, channel name, and live playback progress bar (
/nowplaying). - Queue Management: Add single tracks, playlists, reorder, view upcoming songs (
/queue), loop (/loop), or clear (/clear). - Quota & Bot Fallback: If your YouTube Data API v3 key is omitted or exceeds its daily quota, the bot automatically falls back to
yt-dlpsearch without interruption. - Smart Resource Management: Automatically leaves voice channels when idle for 5 minutes or if all human listeners leave.
- VPS Anti-Bot Support: Native support for mounting
cookies.txtto bypass datacenter IP restrictions (e.g. Hetzner, DigitalOcean, AWS). - Unraid Ready: Includes a native Unraid Docker XML template for 1-click installation via Unraid's Docker Manager.
| Command | Description |
|---|---|
/play <query or url> |
Play a song or entire playlist by search query, video URL, or playlist link. |
/pause |
Pause currently playing track. |
/resume |
Resume playback if paused. |
/skip |
Skip the currently playing track. |
/stop |
Stop playback, clear the queue, and disconnect the bot from voice. |
/nowplaying |
Show details and visual progress bar for the current song. |
/queue |
Display the list of upcoming tracks. |
/volume <1-100> |
Adjust playback volume. |
/loop |
Toggle repeat mode for the current track. |
/clear |
Clear upcoming songs from the queue. |
- Go to the Discord Developer Portal.
- Click New Application, give it a name (e.g.,
MusicBot), and open it. - In the left sidebar, navigate to Bot:
- Click Reset Token and copy the bot token (this is your
DISCORD_TOKEN). - Under Privileged Gateway Intents, ensure Server Members Intent and Message Content Intent (if prompted) are enabled.
- Click Reset Token and copy the bot token (this is your
- In the left sidebar, navigate to OAuth2 -> URL Generator:
- Scopes: select
botandapplications.commands. - Bot Permissions: select
Connect,Speak,Send Messages,Embed Links,Read Message History. - Copy the generated URL at the bottom, paste it into your browser, and invite the bot to your Discord server.
- Scopes: select
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
- Go to APIs & Services -> Library, search for YouTube Data API v3, and click Enable.
- Go to APIs & Services -> Credentials -> click + Create Credentials -> API Key.
- Copy the generated API key (this is your
YOUTUBE_API_KEY).Note: If you don't provide an API key, the bot will automatically fall back to yt-dlp search.
Unraid is the ideal platform for Lyra because home residential IPs rarely encounter YouTube bot challenges.
With the prebuilt GitHub Container Registry image (ghcr.io/nate-eisner/lyra:latest), you do not even need to compile or build on Unraid!
- Copy the included
unraid-template.xmlto your Unraid server at:(Or in Unraid terminal:/boot/config/plugins/dockerMan/templates-user/my-lyra.xml
curl -sLo /boot/config/plugins/dockerMan/templates-user/my-lyra.xml https://raw.githubusercontent.com/nate-eisner/Lyra/main/unraid-template.xml) - In your Unraid WebGUI, navigate to the Docker tab and click Add Container at the bottom.
- In the Template dropdown, select lyra.
- Enter your
DISCORD_TOKENand (optional)YOUTUBE_API_KEY. - Verify the appdata path (
/mnt/user/appdata/lyra). - Click Apply. Unraid will automatically pull the container image and start Lyra!
- Install the Docker Compose Manager plugin from Community Applications.
- Copy this repository folder to
/mnt/user/appdata/lyra/. - Create
.envfrom.env.exampleand fill in your tokens. - Launch the stack via Docker Compose Manager or terminal:
cd /mnt/user/appdata/lyra docker compose up -d
-
Clone this repository on your VPS:
git clone https://github.com/nate-eisner/Lyra.git cd Lyra -
Create your configuration file:
cp .env.example .env nano .env
Fill in
DISCORD_TOKENandYOUTUBE_API_KEY. -
Start the bot:
docker compose up -d --build
-
View logs to verify connection:
docker compose logs -f
Cloud providers (AWS, DigitalOcean, Hetzner, Linode, OVH) have datacenter IP ranges that YouTube actively flags with Sign in to confirm you're not a bot or HTTP 403 Forbidden.
If you run on a VPS and encounter playback issues, export your browser cookies:
- Install the browser extension Get cookies.txt locally (Chrome Web Store or Firefox Add-ons).
- Go to youtube.com while signed into a Google account.
- Open the extension and click Export to save
cookies.txt. - Place this file on your server inside the
configdirectory:- VPS:
./config/cookies.txt - Unraid:
/mnt/user/appdata/discord-music/cookies.txt
- VPS:
- The container automatically mounts this path, and the bot will use your session to authenticate stream extraction.
If running locally without Docker:
# 1. Install system dependencies (FFmpeg must be installed on your OS)
# macOS: brew install ffmpeg
# Ubuntu/Debian: sudo apt install ffmpeg nodejs
# 2. Install python dependencies
pip install -r requirements.txt
# 3. Configure environment
cp .env.example .env
# Edit .env with your DISCORD_TOKEN
# 4. Run the bot
python -m bot.main