Node.js Music Discord Bot

by mrsmook

GitHub Readme.md

The discord API provides you with an easy tool to create and use your own bots and tools. For this tutorial we are going to create a basic music bot and add it to our server, not only for developers any one can do it. The bot will have the following command :

  • PLAY command.
  • HELP command.
  • QUEUE command.
  • NOWPLAYING command.
  • LOOP command.
  • SKIP command.
  • PAUSE command.
  • RESUME command.
  • CLEARQUEUE command.
  • LEAVE command.
  • SEARCH command.
  • VOLUME command.
  • REMOVE command.

Requirements

Heroku account

Google account

Setting up a discord bot

First, we need to create a new application on the discord development portal. We can do so by visiting the portal and clicking on new application.

Make your own music Discord bot for FREE

Chose the right name for the application

Make your own music Discord bot for FREE

After that, we need to select the bot tab and click on add bot and copy the token and store it we will need it later.

Make your own music Discord bot for FREE Make your own music Discord bot for FREE

Now that both application and bot are created we have to associate the bot to our server

Make your own music Discord bot for FREE Make your own music Discord bot for FREE

Get a youtube API token

Go to https://developers.google.com/ and log in or create an account, if necessary. After logging in go to this link https://console.developers.google.com/project and click on the blue CREATE PROJECT button as depicted in the photo below. Wait a moment as google prepares your project.

Fill in whatever Project Name you want.

Then click GoogleAPIs link in the top left corner and then click the link option called “YouTube Data API.” It’s under YouTube API’s. You can see it highlighted in the photo below, bottom right.

Now click on the “ENABLE” button.

Next click on the blue ‘Go to Credentials’ button to the right.

Choose the select option YouTube Data API v3 for the first select option and Web server(e.g. node js. Tomcat) for the second selection. Then choose Public data. Now click the blue button, “What credentials do I need?.”

Almost done, wait for google to create your new project and you should see the screen below where you can copy your API Key.

Store the copied API youtube key we will need it in the last step of the tutorial.

Deploy our bot

If you are not a developer all you have to is to copy my pre-coded project and you are good to go, for more details if you want to add more functionalities ask me in comment and i will do a developer version of this tutorial. click this button. Add the copied tokens and prefix.

Deploy

Make your own music Discord bot for FREE

And then click manage app for the next section.

Configure your bot

Under resources tab disable Web and activate Worker.

Make your own music Discord bot for FREE

Finally click on more and restart all dynos

Make your own music Discord bot for FREE

Now you cant test your bot with any command

play justin bieber baby

if you liked the tutorial you can support me by :

Buy Me A Coffee