A simple Discord music bot built with Python and yt-dlp
, allowing users to play music from YouTube directly in their Discord voice channels. The bot includes basic features like playing songs, skipping tracks, and managing a song queue.
- Play Music: Play songs from YouTube by searching or providing a direct link.
- Skip Tracks: Skip the current track to play the next one in the queue.
Make sure you have the following installed:
- Python 3.8 or higher
discord.py
libraryyt-dlp
libraryffmpeg
(for audio processing)
-
Clone the repository:
git clone https://github.com/yourusername/discord-music-bot.git cd discord-music-bot
-
Install dependencies: Create and activate a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
Install required Python packages:
pip install -r requirements.txt
-
Setup your Discord bot:
- Create a bot on the Discord Developer Portal.
- Get your bot token and replace
'YOUR_BOT_TOKEN'
in the code.
-
Run the bot:
python bot.py #(bot = your file name)
-
Invite the bot to your server:
- Generate an OAuth2 URL with the
bot
scope andadministrator or Connect and Speak
permissions from the Developer Portal and use it to invite the bot to your Discord server. - Must need Connect and Speak permissions
- Generate an OAuth2 URL with the
-
Bot Commands:
!play <song name or URL>
: Play a song or add it to the queue.!skip
: Skip the currently playing song.
!play never gonna give you up
: Searches YouTube for the song and plays it in the voice channel.!skip
: Skips to the next song in the queue.
If you'd like to contribute to this project, feel free to fork the repository and submit a pull request. Please ensure your code follows the existing style and structure.
- discord.py - The Python API wrapper for Discord.
- yt-dlp - A command-line program to download videos from YouTube and other video sites.
- FFmpeg - A complete, cross-platform solution to record, convert and stream audio and video.
This project is licensed under me LICENSE,
Contact for more details, Click me.