How to Make a Discord Bot

Featured Create Discord Bot

Creating a custom Discord bot is a fun and engaging way to sustain the interest of your community server. When you invite your friends over to your channel, the bot will manage their interactions in your absence. For example, if a user is misbehaving, the bot can kick him or her out.

To do that, you have to acquaint yourself with some programming and steps to create your bot and add it to your server. The following guide simplifies what has to be done with easy-to-understand screenshots.

Creating Discord Bot on Developer Portal

Log in to your Discord account and go to the developer portal. Here, you can create a new bot “application.”

Create Discord Bot New Application Press 1

Give your application a desired name and click “Create.”

Create Discord Bot New Application Enter Name 1

In the next step fill in some details regarding what this application is all about. You can choose an app icon. Remember to save the changes.

Create Discord Bot Application Name

Now add a bot using the “build-a-bot” feature of the portal.

Create Discord Bot Build New Bot

Give your consent to adding a bot to the app. The action is irrevocable.

Create Discord Bot Permission

After you complete the above steps, a wild bot is created. However, it is not ready to be shared yet. For that, you need to provide additional information.

Create Discord Bot Wild Bot Has Appeared

Make a checklist of what your bot can do. You should not give it administrator privileges, as then it can control your server. Feel free to let it mute or ban members, prioritize speakers, add reactions, embed links, manage nicknames, and much more. Each level of permission provided by you has its own unique ID you can see on the dashboard itself.

Create Discord Bot List Of Permissions

Creating the Code for Your Discord Bot

If you are a programmer, you will want to modify the bot’s functions quite a bit. This demonstration uses node.js, a JavaScript runtime environment. Once installed for Windows, you may want to install “additional tools,” which can be done directly from the command terminal. It will install Chocolatey, Visual Studio, and other programs in Windows Powershell.

Create Discord Bot Install Chocolatey

Download and install Node.js for Windows x64 and then run the following specific program from the Start menu. It’s a Node.js command prompt. (Don’t run the other Node.js application file, as it has a different use.)

Create Discord Bot Nodejs Command Promptjpg

Once the environment has been set up for using Node.js, you will have to install “discord.js with voice support” using the following code.

npm install discord.js @discordjs/opus
Create Discord Bot Install Discord.js On Npm

You should see a success status for the number of packages created.

Create Discord Bot Installed Discord.js

Install nodemon as shown below.

npm i -g nodemon
Create Discord Bot Add Nodemon Code

Go back to your Discord bot on your developer portal webpage. Click the icon for “click to reveal token,” and it will display an alphanumeric key, which is your private Admin. Don’t share the token with anyone, as it is easily hackable.

Create Discord Bot Token

Check the code example shown at the official Discord site.

const Discord = require('discord.js');
const client = new Discord.Client();
client.on('ready', () => {
    console.log(`Logged in as ${client.user.tag}!`);
client.on('message', msg => {
    if (msg.content === 'ping') {

Instead of a token in the last line of code, copy-paste your own Discord bot token.

Create Discord Bot Add Token Atom Editor

Save the file as “Index.js” in any folder which is directly accessible from the Command prompt. It can have any name as long as it is a .js file.

Create Discord Bot Add Save Indexjs File

Now, to run the bot, enter the following code.

nodemon --inspect "file name".js

When it’s ready, the Node.js will then log you into your Discord API. There is also an editor mode in Node.js which you can access from .help option. This is where you can introduce further edits to your bot.

Create Discord Bot Logging In As Bot

Adding the Bot to Your Server

Once your bot has been created, you will want to add it to your Discord server. For that, you will need a link such as the following:

The “client ID” is found in General information under the Application where you have saved the bot.

Create Discord Bot Go To Applications

In the below screen, you can see the client ID for the bot that was created in the first section.

Create Discord Bot Client Id

Open a browser and enter the link shared above. Simply replace the client ID with yours. You can choose the server where you can add the bot.

Create Discord Bot Add Bot To Server

If the bot is successfully created, you will see an “authorized” message which shows the app has been connected to your Discord server. If you have the Discord server installed for Windows, you should see an alert in the system tray as shown here.

Create Discord Bot Bot Added To Server

The created bot has been successfully added to the Discord server.

Create Discord Bot Bot Visible In Server

Discord bots are an interactive means to build interest in your server. For more information on working with custom Discord bots, refer to this official manual.

Have you created your own Discord bot? What was its purpose? Please share your ideas in the comments.

Sayak Boral
Sayak Boral

Sayak Boral is a technology writer with over eleven years of experience working in different industries including semiconductors, IoT, enterprise IT, telecommunications OSS/BSS, and network security. He has been writing for MakeTechEasier on a wide range of technical topics including Windows, Android, Internet, Hardware Guides, Browsers, Software Tools, and Product Reviews.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox