Skip to content
/ MSCBOT Public

Discord bot to play music from YouTube, manage a queue, and control playback in voice channels.

Notifications You must be signed in to change notification settings

clueNA/MSCBOT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 

Repository files navigation

MSCBOT

Discord Music Bot

A simple Discord bot to play music from YouTube, manage a queue, and control playback in voice channels.

Features

  • Play audio from YouTube URLs.
  • Queue management (add, view, skip, clear).
  • Control playback (pause, resume, stop).
  • Join and leave voice channels automatically.

Prerequisites

Before running the bot, make sure you have the following:

  1. Python 3.8 or later.
  2. The required Python packages:
    • discord.py
    • yt-dlp
    • python-dotenv
    • PyNaCl
    • ffmpeg (installed on your system and added to PATH).

Setup

  1. Clone the repository or copy the script.
    git clone https://github.com/clueNA/MSCBOT
  2. Install the required dependencies:
    pip install discord.py yt-dlp python-dotenv pynacl
  3. Install ffmpeg:
    • On Windows: Download from FFmpeg and add to PATH.
    • On macOS: Use Homebrew: brew install ffmpeg.
    • On Linux: Install via your package manager: sudo apt install ffmpeg.
  4. Create a .env file in the project directory with your Discord bot token:
    echo DISCORD_TOKEN=your_token_here > .env
  5. Run the bot:
    python music_bot.py

Commands

General Commands

Command Description
!help Show all available commands.
!join Bot joins your voice channel.
!leave Bot leaves the voice channel.

Music Playback Commands

Command Description
!play <url> Play or queue audio from a YouTube URL.
!queue Display the current queue.
!skip Skip the currently playing song.
!np Shows information about the currently playing track
!clear Clear the queue.
!loop Changes loop mode (off/track/queue).
!pause Pause the current song.
!resume Resume the paused song.
!stop Stop playback and clear the queue.

Example Usage

  1. Join a voice channel.
  2. Use !play <YouTube URL> to start playing music.
  3. Use !queue to view the current queue.
  4. Manage playback with commands like !skip or !pause.

Troubleshooting

  • Error: "Could not extract video data"

    • Ensure the YouTube URL is valid, and yt-dlp is installed and up-to-date.
  • Bot does not join voice channel:

    • Verify you are in a voice channel and the bot has permission to join.
  • Bot does not respond:

    • Ensure the bot is running, and the token in .env is correct.

Acknowledgments

  • discord.py: For Discord API integration.
  • yt-dlp: For YouTube video and audio extraction.
  • FFmpeg: For audio processing.
  • PyNaCl: For voice support in discord.py.

About

Discord bot to play music from YouTube, manage a queue, and control playback in voice channels.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages