🎵 Discord Music Bot
A lightweight, self-hosted Discord music bot written in Python. Plays .mp3 files from a local directory, supports shuffle, playback controls, and displays the current track using rich embeds.
🚀 Features
- ✅ Joins and leaves voice channels
- ▶️ Plays specific or random
.mp3files - 🔀 Shuffles playlist
- ⏸️ Pauses / ▶️ Resumes / ⏹️ Stops playback
- ⏭️ Skips to next track
- 📃 Lists available tracks
- 📦 Uses
.envfor secure token management - 🎨 Displays current track as an embed
📦 Requirements
- Python 3.8+
- FFmpeg installed and available in system path
- The following Python libraries:
pip install discord.py python-dotenv PyNaCl
Optional (for future YouTube support):
pip install yt-dlp
##🛠️ Setup
- Clone the repository:
git clone https://github.com/JoranJix/dicord-musicbot.git
cd musicbot
- Create a file
touch .env
nano .env
then paste
DISCORD_TOKEN=your_discord_bot_token_here
- Create a folder music/ and add your mp3 files
- Run the bot:
python3 bot.py
##⚙️ Systemd Integration (Linux To run the bot as a service:
# /etc/systemd/system/musicbot.service
[Unit]
Description=Discord Music Bot
After=network.target
[Service]
WorkingDirectory=/path/to/your/bot
ExecStart=/usr/bin/python3 /path/to/your/bot/bot.py
Restart=on-failure
RestartSec=5
Environment="PYTHONUNBUFFERED=1"
[Install]
WantedBy=multi-user.target
Enable and start:
sudo systemctl daemon-reload
sudo systemctl enable musicbot
sudo systemctl start musicbot
##📜 License MIT License — free to use, modify, and share
Description
Languages
Python
100%