This Discord bot plays music in voice channels using YouTube as a source. It includes commands to play, queue, skip, pause, and manage songs in a playlist.
- Play music from YouTube by URL or search term.
- Queue multiple songs.
- Pause, resume, and skip songs.
- Clear the music queue.
- Disconnect from the voice channel when idle.
- Python 3.8+
discord.pylibraryyt-dlplibraryyoutubesearchpythonlibrary
-
Clone the repository:
git clone https://github.com/Brutarul/MusicBot.py.git cd MusicBot.py -
Install the required Python packages:
pip install -r requirements.txt
-
Create a
config.pyfile and add your bot token:TOKEN = 'your-bot-token'
-
Run the bot:
python bot.py
Invite your bot to your server and use the following commands:
- /play : Plays a song based on the URL or name provided.
- /queue: Displays the current songs in the queue.
- /clear_queue: Stops the music and clears the queue.
- /stop: Disconnects the bot from the voice channel.
- /remove: Removes the last song added to the queue.
- /pause: Pauses the current song being played.
- /resume: Resumes the paused song.
- /skip: Skips the current song.
To play a song, simply type: /play Never Gonna Give You Up
The bot will join your voice channel and start playing the song. You can queue more songs using the same command.
bot.py: Main entry point for the bot.cogs/music_cog.py: Contains theMusicCogclass with music commands and functionality.config.py: Contains your bot token. (Do not forget to add this file and update it with your own token.)requirements.txt: Lists required Python packages.
Contributions are welcome! Feel free to open issues or submit pull requests. For major changes, please open an issue to discuss your proposed changes.
This project is licensed under the MIT License. See the LICENSE file for details.
If you encounter any issues or have questions, please open an issue on the GitHub repository.