If you’re reading this article, you probably have a pretty good understanding of what Discord is. However, for those that are completely new to the software, Discord is the biggest free-to-use online VOIP program currently available. It grew to popularity through sources like Reddit and gamers who needed a place to communicate after the death of IRC.
It’s now used globally for everything from YouTube gatherings to office chit-chat. Discord has truly exploded in a way that no one envisaged five years ago.
Thanks to Discord’s global popularity, we now get asked Discord related FAQ’s all too regularly. One of the most common, however, is how to make a discord bot. For that reason, this article will be based around that question and will walk you through exactly how to make a Discord bot, and how you decide what it can, and can’t do.
With that in mind, let’s discuss exactly what a Discord bot can do.
What Does A Discord Bot Do?
Considering Discord is a free-to-use software application, the number of built-in features is pretty impressive, to say the least. One of our favorite features, however, is making a Discord bot who will keep watching over the server whilst your away. The bot will act as your chauffeur when you’re busy elsewhere; we’ll call our bot, Jeffrey. Keeping the server maintained and greeting people as they join are easily programmable tasks that don’t require a great deal of technical understanding.
You can get Jeffrey to greet people upon arrival, play music for gamers whilst they’re in servers, moderate the chat in channels, auto post content, and more.
It’s a really useful tool to have if you’re looking to maintain your Discord server but haven’t got the time to physically sit down and do it yourself.
How to Make a Discord Bot
Below, is an extensive guide on exactly how to make a discord bot, how to input some commands and how to test it afterward.
Let’s waste no further time and dive straight it!
STEP 1: DOWNLOAD NODE.JS AND SET UP A DISCORD ACCOUNT IF YOU HAVEN’T
Once both applications have been installed, restart your PC and move onto the next step.
Side Note – You will also need some form of a text editor such as Notepad to which will allow you to code with.
STEP 2: CREATE YOUR BOT
After you have installed both programs, the first step towards making a discord bot is to, well, create it.
This is a fairly easy process. It requires you to access the applications tab in Discord. You can follow this link to do so. The aim here is to get an authorization token for the bot so that Discord recognizes your code and adds it to the bot when in servers.
Once you’ve opened the link above, hit the “New application” tab. Give the bot a name and click create.
On the left-hand side, you will see a menu, select the “Bot” tab. Inside this tab, you then need to select the “Add a bot” button.
Select the application you just made and click next.
STEP 3: GET YOUR BOT’S AUTHORIZATION TOKEN
Now that we’ve created the bot, we need to get its authorization token. This allows you to code your bot and feed it the commands it needs to run as you would like.
The token is unique to your bot, so don’t give the code to anyone else. Not unless you want them changing the bot’s behavior.
To generate the token you need to stay in the “Bot” tab and find the token section, usually located in the build-a-bot section under the username.
Once found, select the “Click to reveal token” link, which will generate your token immediately.
STEP 4: SEND YOUR BOT TO YOUR SERVER
We now need to send the bot you created, in our case, Jeffrey, to the required server.
There are a couple of steps required here, and it’s probably the hardest part of the process, so follow the steps precisely.
Start by finding the applications “General Information” tab. Under the name, you should see CLIENT ID and a long number underneath.
COPY THE CLIENT ID
Now, take the link below:
and replace the word “CLIENTID” with the application’s client ID we copied a moment ago.
The new URL should look something like this:
Copy this link into your browser and click enter. The window that opens up should ask you to log into your account. Once you’ve logged in, you will see your bot and some options for adding the bot to selective servers you have the correct permissions in.
Once you have selected the server you wish to add the bot to, click authorize. You will know if it worked when you join the Discord server. You will be able to see your bot on the right-hand side, in the user’s list.
Once the bot has been added to your server, its good practice to create a folder on your Windows desktop for that bot. All the bot’s files will be stored here, I recommend calling it DiscordBot, or something as catchy.
STEP 5: CREATE A “BOT” FOLDER ON YOUR COMPUTER
This next section is where we start to create the bot’s files. You’re going to start by opening notepad and typing in the following text:
“token”:”YOUR BOT’S TOKEN GOES HERE“
You’re going to need to find your bot’s token, from step 3, and copy it into the text where it says “YOUR BOT’S TOKEN GOES HERE”
It should look something like this.
Once you’ve done this, save the file as “Auth.json.” It must be a .JSON file and not .TXT. Your bot will not work if you use .JSON.
Next, make a new file and put in the following text:
“name”: “Legendary bot”,
“description”: “Jeffrey the Bot”,
“author”: “Your Name”,
Replace any information you feel fit in this section, the name should be the BOT’s name. The description can be anything you want as well. Change the author to your name if you wish.
Once completed, save this file as package.json in your Discord bot folder.
STEP 6: OPEN YOUR TEXT EDITOR AND MAKE YOUR BOT’S FILES
Open up notepad, and copy the following text:
STEP 7: DEFINE YOUR BOT’S CODE
The code above is specifically designed to respond to text questions that start with “!”. In this case, when a user types !hello, the bot will respond with “Hello Friendos, welcome to the channel.” It’s a very simple command, but one that will get your bot started along the right tracks.
STEP 8: OPEN YOUR COMPUTER’S “COMMAND PROMPT” AND NAVIGATE TO YOUR DISCORD BOT FOLDER
We now need to access your bot within Windows command prompt. The easiest way of doing this is by right-clicking a blank area within the bot’s folder whilst holding shift. Then click on open in command prompt.
Alternatively, press Windows key + R, then type CMD in the field and click enter.
You will then have to type “cd” followed the path for the bot’s folder.
STEP 9: USE THE COMMAND PROMPT TO INSTALL YOUR BOT’S DEPENDENCIES
This is where we make use of the Node.js you installed earlier. In the command prompt next to the discord bot folder pathway, type in “npm install discord.io winston – save”. This will automatically install the necessary files you need directly into the bot folder.
STEP 10: RUN THE BOT
And that’s pretty much it. If you want to try running your bot then type “node bot.js” in the command prompt. Make sure you’re still within the discord bot folder path way.
After which you will want to head back to your Discord server and try testing your bot by typing the commands !hello in chat. If everything worked as it should of done. At this stage you will enjoy the bot’s great responding message.
There you have the basics to making a Discord bot. I know we didn’t go into too much detail on the coding side of things, but don’t worry, we’re working on an article which will go into some cooler features very shortly.
For now, though, this is everything you need to get started. Have a little play with the Discord bot and see if you can get some command’s going. If not, come back when our Discord coding article goes live, it’ll have everything in there!