← Back to projects
Overview

What it does

A versatile Discord bot built from scratch with Python. The goal is simple: combine all premium music bot features into a single open-source project.

Plays tracks from YouTube, Spotify (auto-resolved through YouTube), SoundCloud, Bandcamp, Twitch, and anything else yt-dlp supports. Just /play <title> or paste a URL — the bot will join your voice channel, queue the track, and deliver an interactive embed with 8 control buttons.

Features 25+ slash commands, per-user save/load playlists, automatic lyrics via lrclib.net, play stats tracking, a DJ role to restrict who can skip/stop, and 24/7 mode for music servers.

Modular architecture
bot.py        # Entry point + 25+ slash commands
player.py     # Per-guild playback engine + queue
sources.py    # Multi-source resolver (YouTube/Spotify/SoundCloud)
views.py      # Now-playing embed + 8 interactive buttons
lyrics.py     # lrclib.net lyrics fetcher
database.py   # SQLite layer (playlists/settings/stats)
Capabilities

Features

Playback Engine
▶️

Multi-Source Streaming

Stream directly from YouTube, Spotify, SoundCloud, Bandcamp, and Twitch. Auto-fallback when one source goes down.

🎯

Seek & Skip

Fast-forward, rewind, or jump to any position in a track. Instant skips with no loading delay.

🔁

Loop Modes

Three modes: off, loop track, loop queue. Perfect for study sessions.

🔊

Volume Boost

Range from 0–200%. Push above the original level when the source audio is too quiet.

Queue Management
📜

Smart Queue

View the full track list with duration and requester. The queue persists even if the bot briefly disconnects.

🔀

Shuffle & Remove

Shuffle the queue order or remove specific tracks by position. Total flexibility.

📁

Playlist Persistence

Save the current queue as a playlist (per user, per server). Load any time — the bot re-resolves URLs so they never expire.

Smart Features
🎤

Lyrics Fetching

Auto-fetch lyrics via lrclib.net. No API key, no rate limits. Synced lyrics supported too.

📊

Stats Tracking

Top 10 most-played tracks per server or per user. Automatic medals for the top three.

♾️

24/7 Mode

Bot stays in the voice channel forever, even with no listeners. Great for lounge / study servers. Admin only.

🎚️

DJ Role System

Restrict skip/stop/clear to a specific role. Admins always bypass. Restrictions can be removed any time.

UI / UX
🎨

Now-Playing Embed

Auto-updating embed with thumbnail, duration, queue length, requester, loop status, and an up-next preview.

🎮

8 Interactive Buttons

Rewind, pause/resume, skip, fast-forward, stop, shuffle, loop, queue. All accessible without typing a thing.

📻

Bot Status Display

"Listening to /help to view commands" — users immediately know how to get started.

👤

Auto-Disconnect

Disconnects automatically after being alone for 60 seconds. Saves resources. Can be disabled via /247.

Reference

Command list

Playback
CommandDescription
/play <query>Play a YouTube/Spotify/SoundCloud URL or search term
/pausePause playback
/resumeResume playback
/skip DJSkip to the next track
/stop DJStop and clear the queue
/leaveDisconnect the bot from voice
Seeking
/forward [seconds]Fast-forward (default 10s)
/rewind [seconds]Rewind (default 10s)
/seek <seconds>Jump to a specific position
Queue
/queueView the track queue
/nowplayingShow the currently playing track
/shuffleShuffle the queue
/remove <position>Remove a track at a specific position
/clear DJClear the queue
Modes & Volume
/loop <mode>off / track / queue
/volume <percent>0–200% (default 50%)
Lyrics & Stats
/lyrics [query]Lyrics for the current track or by title
/stats [scope]Top tracks (server / me)
Playlist (per-user)
/playlist save <name>Save the current queue as a playlist
/playlist load <name>Load a saved playlist into the queue
/playlist listList your saved playlists
/playlist delete <name>Delete a saved playlist
Admin
/247Toggle 24/7 mode (Manage Server)
/djrole [@role]Set DJ role (leave empty to remove)
/helpShow all commands
Get Started

Quick start

1. Install Dependencies
# Clone & enter project
cd discord-music-bot
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
2. Install FFmpeg (Required)
# Quick install on Windows:
winget install Gyan.FFmpeg

# Verify:
ffmpeg -version
3. Setup Bot Token
# Open: https://discord.com/developers/applications
# 1. New Application -> Bot tab -> Reset Token -> copy
# 2. Enable MESSAGE CONTENT INTENT
# 3. OAuth2 URL Generator -> bot + applications.commands
# 4. Invite the bot to your server

cp .env.example .env
# Edit .env, paste token & GUILD_ID
4. Run!
python bot.py

# Output:
# Logged in as MusicBot#1234
# Database ready
# Synced 25 slash command(s) (INSTANT)
# Bot is ready! 🎵
📁 Source projects/discord-music-bot/
🐍 Language Python 3.10+
📦 Dependencies discord.py, yt-dlp, spotipy, aiohttp, PyNaCl
💾 Database SQLite (auto-created on first run)
🌐 Sources YouTube · Spotify · SoundCloud · Bandcamp · Twitch · 1000+ via yt-dlp