Skip to content

Pr0degie/musicbot

Repository files navigation

🎵 Discord Music Bot

Modular Discord music bot powered by yt_dlp, FFmpeg, buttons and equalizer presets.
Built with discord.py and yt_dlp.


Features

  • Play YouTube links, playlists and search terms
  • Control buttons directly in Discord: ⏸️ ▶️ ⏭️ 🔁
  • Autoplay: finds the next song automatically when queue runs out
  • Equalizer presets: bassboost, flat, vocalboost, superbass, punchy, nightcore, karaoke, 8d
  • Audio format: webm (default, lossless) or mp3
  • Internet radio via direct stream
  • Queue management with save/load, shuffle and loop mode
  • Short songs are cached; long songs (>20 min) start instantly via stream
  • Auto-leave: bot leaves voice when all users go, or after 2 h of inactivity
  • Voice stability: reconnect watchdog recovers playback after Discord drops (code 1006)

Commands (prefix: !)

Playback

Command Description
!p <url/search> Play music — YouTube URL, playlist or titel search
!next <url/search> Queue a song as next
!s Skip
!x Pause
!resume Resume
!now <url/search/n> Play immediately, skip current song — also accepts queue position n
!seek <time> Jump to position — e.g. 1:23 or 83
!replay Re-queue last song

Queue

Command Description
!q Show queue (paginated)
!shuffle Shuffle queue
!clear Stop + clear queue
!remove <n> Remove song at position n
!move <n|title> Move song to front — by position or title search
!loop Loop mode: off → song → queue → off
!saveq <name> Save current queue
!loadq <name> Load saved queue
!lists List all saved queues

Audio & Radio

Command Description
!eq <preset> Set EQ preset (no argument: list all)
!format <type> Switch audio format: mp3 or webm
!radio Show station list
!radio <nr/name> Play station
!radio <url> [name] Play & save stream
!radio delete <nr/name> Delete station
!radio rename <nr/name> <new name> Rename station
!stop Stop playback/radio (queue is preserved)

Misc

Command Description
!score Top 10 most played songs
!baba Play Baba playlist
!text Fetch song lyrics
!stats Bot stats (RAM, CPU, cache)
!j / !l Join / leave voice channel
!dm Show DM-bridge status (AI dungeon master audio output)
!reloadcookies Reload cookies.txt without restarting
!restart Restart bot (owner only) — new console window on Windows, in-place on Linux

Project Structure

├── main.py                    # Entry point
├── config.py                  # Load environment variables
├── cogs/
│   ├── music.py               # Core: queue, FFmpeg playback, EQ, autoplay
│   ├── music_radio.py         # RadioMixin: internet radio (!radio)
│   ├── music_stats.py         # StatsMixin: !score, !stats
│   ├── music_queue_io.py      # QueuePersistenceMixin: !saveq, !loadq, !lists
│   ├── downloader.py          # yt_dlp instances, download cache, streaming
│   ├── presets.py             # EQ filter chains
│   ├── basic.py               # !j, !l, !ping, !echo, !help
│   └── dm_bridge.py           # HTTP audio-output bridge for AI dungeon master (localhost path + remote byte mode)
├── views/
│   ├── music_controls.py      # Discord buttons (Pause, Resume, Skip, Autoplay)
│   └── queue_view.py          # Paginated queue view
├── utils/
│   ├── logger.py              # Logging (console + bot.log)
│   ├── files.py               # safe_unlink + pending-delete list (Windows file locking)
│   ├── text.py                # normalize_title (dependency-free, tested)
│   └── i18n.py                # Localization helper (t() function)
├── locales/
│   ├── en.json                # English strings
│   └── de.json                # German strings
├── downloads/                 # Audio cache
├── playlists/                 # Saved queues (!saveq / !loadq)
└── tests/                     # pytest suite (test_text.py, test_presets.py)

Language

Set via LANGUAGE in .env:

LANGUAGE=en   # English (default)
LANGUAGE=de   # German

Setup

→ See SETUP.md

About

Modular Discord music bot — YouTube, playlists, autoplay, EQ presets, internet radio, queue management and buttons. ▎ Built with discord.py and yt_dlp. EN/DE.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors