This is the new Discord bot that supersedes the old v1 discord bot at https://github.com/jack3898/discord-youtube-bot.
A lot of music bots are private and proprietary (and lock features behind a paywall), and additionally, YouTube have been targeting large Discord bots for takedown. As this bot is open source, you can use it assured YouTube can't do anything to bring it down as you have the code on your own server and is not commercially available.
TIP: Typing "/" in the Discord text channel will give you automatic suggestions of commands and will auto-complete options as you type the command!
This bot is proudly powered with Node.js, TypeScript & Redis. It also uses the newest Discord.js v13 library which leverages the latest Discord v9 bot API!
- Node.js v16/v17
- Discord.js v13
- TypeScript
- Redis (using the new v4 npm library)
Because of Discord.js v13 using the very new Discord v9 API, the bot leverages slash commands and interactive message components!
Advantages of v13:
!help
is not needed. Typing "/" will give you a list of commands natively in Discord.- Commands can be autocompleted and give you a description of each argument as you go.
- Discord type checks your arguments and enforces required arguments so its much harder to make a mistake typing a command.
- This bot has interactive buttons and dropdown lists! In the chat!
- No conflict with other bots that are also using slash commands. This bot will ALWAYS use a forward slash to initiate a command.
-
Install Docker, Docker Compose and Git for your own OS. Linux is highly recommended as a platform to host this bot on. Windows (Server) will work, but you will be missing out on a lot of performance.
-
Navigate into a directory you want to place the project directory in using
cd
. -
Clone this repository using Git:
git clone https://github.com/jack3898/discord-youtube-bot-2
. -
Rename
.env-example
to.env
.- Note: Using .env is not a requirement. You can create environment variables in your system instead.
-
Fill in the requirements for the environment variables.
DISCORD_TOKEN
&CLIENT_ID
- Which you can create/find https://discord.com/developers. This bot also requires theapplications.commands
permission otherwise you will not be able to use slash commands.DEV_GUILD_ID
- For developers only. You do not need to fill this in if you are not a developer.GOOGLE_API_TOKEN
- Which you can create in the Google Cloud platform https://console.cloud.google.com/apis/api/youtube.googleapis.com/credentials.
-
Run
docker-compose up --build --detach
. This will build the bot, and run it.
Note: Commands will not immediately appear in Discord, and can take up to 1 hour to register to Discord's servers. Just keep checking, and they should appear soon (assuming everything is set up properly!)
- Pull the latest code from this repository with
git pull
. This will not override your .env file, but it is a good idea to check the .env-example file to ensure you meet the latest environment variable requirements. - Rebuild the Docker containers with
docker-compose up --build
. - Done!
Discord YouTube Bot, an open source Discord YouTube Bot. Copyright (C) 2021 Jack Wright
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.