2025-09-19 12:11:17 +02:00
2025-09-19 12:06:41 +02:00
2025-09-19 12:07:49 +02:00
2025-09-19 12:11:17 +02:00

🎵 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 .mp3 files
  • 🔀 Shuffles playlist
  • ⏸️ Pauses / ▶️ Resumes / ⏹️ Stops playback
  • ⏭️ Skips to next track
  • 📃 Lists available tracks
  • 📦 Uses .env for 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

  1. Clone the repository:
git clone https://github.com/JoranJix/dicord-musicbot.git
cd musicbot
  1. Create a file
touch .env
nano .env

then paste

DISCORD_TOKEN=your_discord_bot_token_here
  1. Create a folder music/ and add your mp3 files
  2. 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
A musicbot that can be invited to a single voice channel
Readme 46 KiB
Languages
Python 100%