https://github.com/cluena/mscbot
https://github.com/cluena/mscbot
discord-bot python
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cluena/mscbot
- Owner: clueNA
- Created: 2025-01-04T08:01:54.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-01-30T17:05:31.000Z (9 months ago)
- Last Synced: 2025-01-30T18:19:32.443Z (9 months ago)
- Topics: discord-bot, python
- Language: Python
- Homepage:
- Size: 41 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

# 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.
```bash
git clone https://github.com/clueNA/MSCBOT
```
3. Install the required dependencies:
```bash
pip install discord.py yt-dlp python-dotenv pynacl
```
4. Install `ffmpeg`:
- On Windows: Download from [FFmpeg](https://www.ffmpeg.org/) and add to PATH.
- On macOS: Use Homebrew: `brew install ffmpeg`.
- On Linux: Install via your package manager: `sudo apt install ffmpeg`.
5. Create a `.env` file in the project directory with your Discord bot token:
```bash
echo DISCORD_TOKEN=your_token_here > .env
```
6. Run the bot:
```bash
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 ` 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.