A simple music bot for Discord that can play music from YouTube. The bot allows users to play music in voice channels with commands like !play
, !skip
, and !stop
.
- Play music from YouTube
- Skip and stop commands to control music playback
- Easy-to-use commands to control the music playback
- Join and leave voice channels
- Node.js: For the bot development
- discord.js: A library to interact with the Discord API
- ytdl-core: To stream audio from YouTube
- ffmpeg-static: For audio conversion
- @discordjs/voice: For audio playback in voice channels
First, clone the repository to your local machine:
git clone https://github.com/luke22076/vibe-bot.git
cd discord-music-bot
Install all required packages:
npm install
Create a .env
file in the root directory of the project and add your Discord bot token:
DISCORD_TOKEN=YOUR_DISCORD_BOT_TOKEN
Replace YOUR_DISCORD_BOT_TOKEN
with the actual token you received from the Discord Developer Portal.
Once all dependencies are installed and the token is set, you can start the bot:
npm start
Or, if you're using nodemon
for development (to automatically restart the bot when code changes):
npx nodemon index.js
Go to the Discord Developer Portal, select your bot, and invite it to your server using the following URL:
https://discord.com/oauth2/authorize?client_id=YOUR_BOT_ID&scope=bot&permissions=PERMISSION_ID
Replace YOUR_BOT_ID
with your bot's ID and PERMISSION_ID
with the required permissions (e.g., 8
for admin rights).
!play <YouTube-URL>
: Plays music from the provided YouTube URL.- Example:
!play https://www.youtube.com/watch?v=dQw4w9WgXcQ
- Example:
!skip
: Skips the current song.!stop
: Stops the music and makes the bot leave the voice channel.
- Queue: The bot could support a queue, allowing multiple songs to be played one after the other.
- Error handling: Enhance error handling for scenarios where a song cannot be played, or if there are issues connecting.
- Playlist: Add functionality to manage and play a playlist of songs.
This project is licensed under the MIT License. See the LICENSE file for more information.
Feel free to contribute to the project by creating a pull request.
If you're having issues with the bot, check the error output in your terminal. For further questions, feel free to open an issue on GitHub.