A Discord bot that plays music in voice channels using Python and Discord.py.
- Plays music from YouTube URLs in voice channels.
- Supports commands to play, pause, resume, and stop music playback.
- Queue functionality to manage multiple song requests.
- Announces the currently playing song and queued songs.
- Uses
yt-dlp
for extracting YouTube video URLs.
- Python 3.6 or higher
discord.py
library (pip install discord.py
)yt-dlp
library (pip install yt-dlp
)- FFmpeg installed and added to PATH
-
Clone the repository:
git clone https://github.com/YourUsername/discord-music-bot.git cd discord-music-bot
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
Create a .env file in the root directory.
Add your Discord bot token to the .env file: DISCORD_TOKEN=your_discord_bot_token
Note: Ensure .env is added to your .gitignore file to keep your token secret.
-
Run the bot:
python main.py
-
Join a voice channel in your Discord server.
-
Use the following commands prefixed with
dreamy
(or modify as needed):dreamyplay <YouTube URL>
: Plays music from the provided YouTube URL.dreamypause
: Pauses the currently playing music.dreamyresume
: Resumes paused music playback.dreamystop
: Stops playing music and disconnects the bot from the voice channel.dreamyskip
: Skips the currently playing song and plays the next song in the queue.
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
This project is licensed under the MIT License - see the LICENSE file for details.
- Replace
YourUsername
with your actual GitHub username in the repository URL. - Replace
your_discord_bot_token
with your actual Discord bot token in the.env
setup section. - Ensure you have Python, necessary libraries (
discord.py
,yt-dlp
), and FFmpeg installed before running the bot. - Customize commands (
dreamyplay
,dreamypause
, etc.) to fit your bot's prefix or naming convention.
- Repeat Functionality - able to repeat certain tracks
- Playlist Support - able to play whole playlists
- randomize queue or playlist given - randomize current queue or tracks
- Song Search - able to just type the title of the song or other details then play music the one the program searches
- Now Playing Command - enhance the currently playing command, currently it only display title. in the future i will try to add the duration.
- Error Handling and Logging: Improve error handling and log messages to help diagnose issues.
- Music Queue Management: Enhance queue management with commands to view, reorder, remove specific songs, or clear the entire queue.
- Shuffle Command: Allow users to shuffle the queue or playlist.
- Integration with Music APIs: Explore integrating with music APIs like Spotify, SoundCloud, or others for broader music selection.
- User Permissions: Implement permission checks to restrict certain commands to server admins or specific roles.
- Cross-Server Support: Ensure the bot can handle requests and queues independently across multiple servers. (Not Sure if fixed)
- Interactive Help Command: Create a detailed help command to guide users on how to use different features.
- Customizable Prefix: Allow server admins to customize the bot's command prefix.
- Pause on Disconnect: Automatically pause playback when the bot is disconnected from a voice channel due to network issues or server restarts. (not necessarily needed)
- Vote Skip: Implement a voting system to skip songs democratically. (have voting system?)
- Playback Statistics: Track and display statistics such as total songs played, most played songs, etc.