A Discord bot for playing music from YouTube (and SoundCloud) in your server’s voice channels.
- Play music from YouTube and SoundCloud
- Slash command support
- Filter banned words and invitation spam
- Dockerized for easy deployment
- Docker
- Docker Compose
- A Discord account with permission to create bots
-
Create a Discord Application
- Go to the Discord Developer Portal
- Create a new application and add a bot user
- Under "OAuth2 > URL Generator":
- Scopes:
bot,applications.commands - Bot Permissions:
Send Messages,Embed Links,Use Slash Commands,Connect,Speak,Manage Messages
- Scopes:
-
Clone this repository
git clone https://github.com/dongcodebmt/discord-yt-bot.git cd discord-yt-bot -
Configure environment variables
- Copy
.env.exampleto.envand fill in your bot token and other required values
- Copy
-
Add YouTube cookie
- Use Cookie-Editor to export your YouTube cookie and save them as
cookie.txtin the project root
- Use Cookie-Editor to export your YouTube cookie and save them as
-
Build and run with Docker Compose
docker compose up -d --build -
Invite the bot to your server
- Use the OAuth2 URL from the Developer Portal with the correct scopes and permissions
-
Deploy slash commands
- Join a voice channel and send
/deployin your server to register slash commands
- Join a voice channel and send
- Send
/helpin your server to view available bot commands - See
soundcloud.tsandyoutubei.jsfor implementation details
- Based on MisaBot
- Uses discord.js, youtubei.js, soundcloud.ts and other open-source libraries