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!