This a basic Discord music bot created using Node.js and the Discord.js library.
If Node.js and npm are already installed, skip this step. If not, follow these instructions.
- Create a Discord application in the Discord Developer Portal
- In the Bot tab, click the Add Bot button
- Copy the bot token and paste it as the TOKEN enviroment variable
- Copy the client ID in the OAuth2 tab and paste it as the CLIENT_ID environment variable
- Go to the Google Cloud API Credentials Page and click Create Credentials and then API Key. If you want, you can restrict the key to only call YouTube Data API v3. Paste this key as the YT_DATA_KEY environment variable. This key is what the bot uses to search for videos on YouTube
- Optionally, to enable the anime opening autoplayer, create a client ID for the MyAnimeList API v2. Ensure the App Type field is set to web. None of the other fields have specifically required values. Paste the client ID as the MAL_API_ID environment variable. This is what the anime opening autoplayer uses to search for the most popular anime series
- Add the bot to servers using
https://discord.com/api/oauth2/authorize?client_id=CLIENT_ID&permissions=3147776&scope=applications.commands%20bot
, replacing CLIENT_ID with the bot's client ID
- Install all packages by running
npm install
in the console at the directory of the bot - Start the bot with the command
npm start
in the console at the directory of the bot
Key | Value | Required |
---|---|---|
TOKEN | Token of Discord bot | yes |
CLIENT_ID | Client ID of Discord bot | yes |
YT_DATA_KEY | API key for YouTube Data API v3 | yes |
MAL_API_ID | Client ID for MyAnimeList API v2 | no |
Name | Description |
---|---|
play | Queues a track using a query searched on YouTube |
queue | Displays the current queue |
skip | Skips the current track |
clear | Clears the whole queue |
remove | Removes a track from the queue based on the query |
shuffle | Randomizes the order of the queue |
autoplay | Sets the autoplayer |
leave | Tells this bot to leave the voice channel |
join | Joins the current channel |