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.example
to.env
and fill in your bot token and other required values
- Copy
-
Add YouTube cookies
- Use Cookie-Editor to export your YouTube cookies and save them as
cookies.txt
in the project root
- Use Cookie-Editor to export your YouTube cookies 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
/deploy
in your server to register slash commands
- Join a voice channel and send
- Send
/help
in your server to view available bot commands - See
soundcloud.ts
andyoutubei.js
for implementation details
- Based on MisaBot
- Uses discord.js, youtubei.js, soundcloud.ts and other open-source libraries