A simple, lightweight, and feature-rich Discord music bot built using Python, lavalink and discord.py.
✔️ Plays high-quality music from YouTube and spotify (via lavalink)
✔️ Supports playlists and song queues
✔️ Basic playback controls: play, pause, resume, skip, stop
✔️ Volume control
✔️ Loop single song or entire queue
✔️ Auto-disconnect when idle
✔️ Supports slash commands
- Python 3.11+
discord.py(pip install discord.py)wavelink(pip install wavelink) (Required for Lavalink integration)psutil(pip install psutil)aiohttp(pip install aiohttp)- LavaLnk
This bot requires a Lavalink server to function properly for music playback. You can either:
-
Host your own Lavalink server
- Download Lavalink from GitHub
- Install Java 17+ (
OpenJDK 17recommended) - Configure
application.ymlwith your credentials - Run Lavalink using:
java -jar Lavalink.jar
-
Use a public Lavalink server (Not recommended due to reliability concerns)
- Some providers offer public Lavalink nodes; ensure you get valid credentials.
If hosting your own server, you need to set these credentials in your bot's configuration:
server:
port: 2333
lavalink:
password: "your_password"
rest_url: "http://localhost:2333"
ws_url: "ws://localhost:2333"
### **Setup**
**Clone the repository:**
```bash
git clone https://github.com/yourusername/discord-music-bot.git
cd discord-music-bot2Install dependencies:
pip install -r requirements.txt3Add your bot token and lavalink credientials
DISCORD_BOT_TOKEN=your-bot-token-here
LAVALINK_HOST = "" # Replace with actual Lavalink server
LAVALINK_PORT =
LAVALINK_PASSWORD = "" # Replace with your Lavalink password
4Run the bot:
python bot.py| Command | Description |
|---|---|
/play [query] |
Play a song from YouTube/Spotify |
/nowplaying |
Show the currently playing track |
/queue |
View the current queue |
/skip |
Skip to the next track |
/playprevious |
Play the previously played song |
/pause |
Pause the current song |
/resume |
Resume paused music |
/stop |
Stop playback and clear the queue |
/clearqueue |
Remove all tracks from the queue |
/shuffle |
Shuffle the queue |
/loop [on/off] |
Toggle loop mode |
/volume [0-100] |
Adjust music volume |
/247 [on/off] |
Enable or disable 24/7 mode |
| Command | Description |
|---|---|
/ping |
Check bot latency & Lavalink ping |
/stats |
View bot statistics |
/invite |
Get the bot invite link |
/help |
Display this help menu |
🔹 Lightweight & Fast – Minimal resource usage
🔹 No Lag & Smooth Playback – Optimized audio streaming
🔹 Easy to Customize – Modify commands as per your needs
Feel free to fork this repository, make changes, and submit a pull request! 🚀