Stream music from YouTube and Spotify directly in your Discord server.
Queue management • Loop modes • Volume control • Rich embeds
Features • Commands • Installation • Configuration • Deployment • Troubleshooting
| Feature | Description |
|---|---|
| 🎵 YouTube Support | Play songs via URL or search query |
| 🎧 Spotify Integration | Play tracks, playlists, and albums from Spotify links |
| 📋 Queue Management | Add, remove, shuffle, and clear songs from queue |
| 🔊 Volume Control | Adjustable volume from 0-100% |
| 🔂 Loop Modes | Loop single song or entire queue |
| 🎨 Rich Embeds | Beautiful now playing and queue displays |
| ⚡ Fast & Reliable | Optimized YT-DLP configuration for quick playback |
| 🐳 Docker Ready | Easy deployment with Docker support |
| Command | Description |
|---|---|
!join |
Join your voice channel |
!leave |
Leave voice channel |
| Command | Description |
|---|---|
!play <song> |
Play from YouTube or Spotify (URL or search) |
!pause |
Pause current song |
!resume |
Resume playback |
!stop |
Stop and clear queue |
!skip |
Skip to next song |
| Command | Description |
|---|---|
!queue |
View the current queue |
!nowplaying |
Show currently playing song |
!shuffle |
Shuffle the queue |
!clear |
Clear the entire queue |
!remove <#> |
Remove song by position |
| Command | Description |
|---|---|
!volume <0-100> |
Set playback volume |
!loop |
Toggle song loop |
!loopqueue |
Toggle queue loop |
!help |
Show all commands |
- Python 3.8+ — Download Python
- FFmpeg — Required for audio processing
Windows
Using Chocolatey (Recommended):
choco install ffmpegManual Installation:
- Download from ffmpeg.org
- Extract to
C:\ffmpeg - Add
C:\ffmpeg\binto your system PATH
Linux (Ubuntu/Debian)
sudo apt update && sudo apt install ffmpegmacOS
brew install ffmpeggit clone https://github.com/your-username/Discord-Music-Bot.git
cd Discord-Music-Bot/discord-music-botpip install -r requirements.txt- Go to Discord Developer Portal
- Click "New Application" → Name your bot → "Create"
- Navigate to Bot tab → Click "Add Bot"
- Copy the TOKEN (save this for later!)
- Enable Privileged Gateway Intents:
- ✅
MESSAGE CONTENT INTENT
- ✅
- Go to OAuth2 → URL Generator:
- Scopes:
bot,applications.commands - Bot Permissions:
Send Messages,Connect,Speak,Embed Links
- Scopes:
- Copy the generated URL and invite the bot to your server
Create a .env file in the discord-music-bot folder:
DISCORD_TOKEN=your_discord_bot_token_hereTo enable Spotify link support:
- Go to Spotify Developer Dashboard
- Create a new application
- Get your Client ID and Client Secret
- Add to your
.envfile:
SPOTIFY_CLIENT_ID=your_spotify_client_id
SPOTIFY_CLIENT_SECRET=your_spotify_client_secretcd discord-music-bot
python bot.pyExpected output:
==================================================
🎵 YourBotName is now online!
🆔 Bot ID: 123456789
📡 Connected to 1 server(s)
🔧 Prefix: !
==================================================
Build and run with Docker:
# Build the image
docker build -t discord-music-bot .
# Run the container
docker run -d --env-file .env discord-music-botThis bot is ready for cloud deployment with included:
Dockerfile— Container configurationProcfile— Process file for Herokuruntime.txt— Python version specificationnixpacks.toml— Railway configuration
Discord-Music-Bot/
├── Dockerfile # Docker configuration
├── requirements.txt # Dependencies
├── README.md # Documentation
│
└── discord-music-bot/
├── bot.py # Main entry point
├── config.py # Bot configuration
├── .env # Your secrets (create this!)
├── .env.example # Environment template
│
├── cogs/
│ └── music.py # Music commands & queue
│
└── utils/
├── ytdl.py # YouTube handler
├── spotify.py # Spotify integration
├── embeds.py # Rich embed templates
├── messages.py # User message system
└── cache.py # Cache management
| Issue | Solution |
|---|---|
| Bot won't start | Verify DISCORD_TOKEN is set correctly in .env |
| No audio playing | Ensure FFmpeg is installed and added to PATH |
| "No module named X" | Run pip install -r requirements.txt |
| Spotify links not working | Add Spotify API credentials to .env |
| Bot disconnects randomly | Check internet connection and Discord API status |
| Permission denied | Ensure bot has Connect and Speak permissions |
| Technology | Purpose |
|---|---|
| discord.py | Discord API wrapper |
| yt-dlp | YouTube audio extraction |
| spotipy | Spotify API integration |
| PyNaCl | Voice encryption |
| FFmpeg | Audio processing |
Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
This project is open source and available for personal use.
Made with ❤️ for music lovers!
Star ⭐ this repo if you found it helpful!