Getting Ready for Discord Bot Development with NodeJS

Oliy Barrett
Jun 19, 2018 · 5 min read

Setting up your development work space

Image for post
Image for post

Introduction

So you’ve seen all these amazing bots such as Misaki, Dyno, Luca and Mee6, and you want to try your own hand at creating your own Discord Bot and you have no idea where to start?

Well dear reader! You’re in luck, this tutorial will teach you the utmost basics to get your development environment set up to writing your first line of code and beyond!

If you’re reading this tutorial guide, then you’ve chosen to use , personally speaking I believe that you’ve made the correct choice.

NOTE: I’m running Microsoft Windows 10 x64, please make sure you download the correct version for your Operating System

Node

Okay, before we can do anything you should go download node.js, we need to grab the “LTS” which stands for Long Term Support, at the time of this tutorial it's version 8.9.4

Image for post
Image for post

Click the LTS button and save the installer somewhere you can remember, then navigate to the location and run the installer.

You should be greeted with this screen.

Image for post
Image for post

All you need to do right now is follow the on screen instructions until you hit this screen…

Image for post
Image for post

Click on the bottom option and it should pull up the following list, make sure you select the one that is highlighted, this step is to the entire process.

Image for post
Image for post

Let me explain what that option does.

It adds the node and npm to the windows PATH variable, which means you can run those as commands in the command prompt from any location on your machine, this is extremely vital for what you want to do.

Alright, once node has finished installing go a head and close the installer and anywhere on your desktop, right click and select Open command window here or Open PowerShell window here

Image for post
Image for post

Once you’ve got the terminal of your choice open, type node -v to tell you what version you've got installed.

Image for post
Image for post

As you can see, node installed correctly, but if it didn’t follow the previous steps.

Software

Now we need to choose which software to use, now the problem is there’s a fair few choices of software out there, but there’s 3 free programs that are extremely popular… did I mention they’re free?

I personally use Visual Studio Code by Microsoft, it’s an amazing bit of software, the other free popular programs are Atom by GitHub, and Sublime Text Editor 3, ultimately it’s up to you which software you pick to install.

Now, there’s a very very good reason as to why “Notepad++” isn’t on that list.

BECAUSE IT’S NOT PROGRAMMING SOFTWARE

Alright now I’ve got that out of the way, I will explain why, programs such as Visual Studio Code, Atom and Sublime Text Editor 3 come with something called intellisense in some form, it’s extremely handy it can auto-complete, offer suggestions on what you’re wanting to do aka code-hinting, whilst notepad++ does not, it’s just a glorified step up from the infamous notepad that comes with Windows.

If you highlight a curly brace, square bracket or regular bracket, it’s partner will be highlighted. Believe me when I say that feature can be a life safer and if you install a linter (which we will be covering next), your code should be as problem free as the software can make it.

Again as I previously stated I use Visual Studio Code so I will show you how to install and correctly configure an Eslinter extension.

On the left hand side, you should see a square symbol, that’s the extensions button, click it, and in the search box type in “Eslint”, click the one by Dirk Baeumer

Image for post
Image for post
Image for post
Image for post

NOTE: I already have the extension installed, but that button will say Install for you

Image for post
Image for post

Okay, now that will do for the eslinter for now. We will cover the important step in the next tutorial which is correctly configuring it for your project.

Process Management

Now you’ve installed Node (as well as NPM), and you’ve installed a code editor, the last thing we should install is a process manager.

I bet you’re asking why you need a process manager in the first place, well it’s simple really.

I personally use nodemon, and when ever you save a file it will automatically restart the process, and with Node you need to restart the process with every save otherwise the changes you’ve made won’t be loaded.

There are many great process managers out there, such as PM2 and Forever, those are fantastic for production (finished bots that are deployed), but not so great for development.

Which is why I use nodemon, all you need to do to install it is open up your terminal again, but this time with Administrative permissions and type npm i -g nodemon

Image for post
Image for post

Alright, if you get a screen similar to the above then it’s installed just fine, and I guess that covers this tutorial.

Congratulations, you’ve successfully set up your development environment, in the next tutorial we’ll get into the best bits, actually creating your bot!

Discord Bots

A blog for all information surrounding discord bots and our…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store