A professional and feature-rich Discord music bot with advanced playlist management, audio controls, and detailed statistics tracking. Built with discord.py and yt-dlp.
- 🎵 High-quality YouTube audio playback
- 📑 Advanced playlist management
- 🔄 Queue system with history tracking
- 🔊 Volume control and audio settings
- 🎯 Precise playback control (play, pause, skip, seek)
- 📊 Detailed statistics tracking
- 📝 Song history logging
- 🔁 Multiple loop modes (off/single/queue)
- 🔀 Queue shuffling
- 📈 User activity monitoring
- 💾 Playlist saving and loading
- 📱 Now playing status with thumbnails
- 🔒 Secure environment variable configuration
- 📋 Comprehensive error handling and logging
- ⚡ Asynchronous operation
- 🔍 Advanced YouTube search
- 💻 Cross-platform compatibility
- Python 3.8 or higher
- Discord.py 2.0 or higher
- FFmpeg
- Required Python packages (see requirements.txt)
- Clone the repository
git clone https://github.com/yourusername/discord-music-bot.git
cd discord-music-bot
- Install dependencies
pip install -r requirements.txt
- Set up environment variables
Create a
.env
file in the root directory:
DISCORD_TOKEN=your_bot_token_here
MAX_QUEUE_SIZE=100
DEFAULT_VOLUME=0.5
- Run the bot
python bot.py
/play <query>
- Play a song or playlist from YouTube/pause
- Pause the current song/resume
- Resume playback/skip
- Skip the current song/queue
- View the current queue/nowplaying
- Show current song information/volume <0-100>
- Adjust playback volume/seek <seconds>
- Seek to a specific position
/playlist create <name>
- Create a new playlist/playlist add <name> <song>
- Add a song to a playlist/playlist load <name>
- Load and play a playlist/playlist list
- Show all saved playlists/playlist delete <name>
- Delete a playlist
/shuffle
- Shuffle the current queue/loop
- Toggle loop mode (off/single/queue)/clear
- Clear the current queue/history
- View recently played songs
/stats
- View bot statistics/mystats
- View your listening statistics/topplayed
- Show most played songs/servertop
- Show server's top tracks
The bot tracks various statistics including:
- Most played songs
- User listening time
- Popular genres
- Peak usage times
- Server activity
- Playlist popularity
Statistics are stored locally and can be exported or reset by server administrators.
Advanced configuration options can be set in config.json
:
{
"max_queue_size": 100,
"default_volume": 50,
"stats_tracking": true,
"history_size": 50,
"playlist_limit": 10
}
Common issues and solutions:
-
Bot won't play audio
- Ensure FFmpeg is installed and in PATH
- Check voice channel permissions
-
Command not working
- Verify bot has required permissions
- Check command syntax
-
Statistics not updating
- Verify database permissions
- Check disk space
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
If you need help with the bot:
- Check the Troubleshooting section
- Open an issue on GitHub
- Discord.py team
- yt-dlp developers
- FFmpeg project
- All contributors
Made with ❤️ by Marc