How To Make A Bot On Discord For Free?

If you are looking for the solution of how to make a Discord bot then here is the solution for you. Popularly known as a messaging app for the gaming community across the world, the number of Discord users is growing rapidly.

This app has been designed for creating groups and communities in the field of gaming, business, and education where one can communicate via texts, audio, or video chats.

Discord bot is a feature that is exclusive to this particular app and is also considered one of its coolest features. With the help of Discord bots, one has the ability to bring into existence of automated or robotized users to execute different functions in this app. This particular feature is what sets Discord apart from other messaging apps out there. Encoded in JavaScript, these bots mainly function as the server moderator, or robotized music players also help in viewing information regarding your Discord user or server and in creating new features for one’s Discord room, etc.

Also read: How To Fix Discord Update Failed Loop?

Steps to make a Discord Bot:

Now there are certain steps one needs to keep in mind while creating a bot and these are the following:

Step no 1: Firstly, you must download Node.js to make the bot function. Then go to Discordapp.com and create an account, if you happen to not have one. Now, if you already have an account, login & open the particular server in which you want your bot to inhabit.

Step No 2: Next you need to create an application on Discord to get permission for the bot, in order to enable the app to recognize the code & add it to its servers. Then go to discordapp.com/developers/applications/me and click on the “New Application” button. Now, give your bot any name and then click on “Save Changes”.

Step no 3: Go to the “Bot” tab and click on “Add Bot”, and then click on “Yes, do it” to continue.

Step no 4: Go to the box marked as App Bot User and search for the words Token: Click to reveal. Now click on that link & you will reveal sequence of text. That happens to be the authorization token for your bot which is not to be shared as anyone who has the code can gain access to your bot and control or misuse it. However, you can very easily create a new token by clicking on “Generate a new token.”

Step no 5: Now, go to the “App Details” option and there you can find the “Client ID”. Now, copy the ID number and add it to the following URL. http://discordapp.com/oauth2/authorize?&client_id=CLIENTID&scope=bot&permissions=8

Replace the word CLIENTID in the URL with your Client ID.

You are also allowed to make a folder to store all of your bot’s files and rename it as per your preference which will make it easier for you to locate your files.

Step no 6: Now from text editor, create three files. Paste the code:

{

“token”: “Your Bot Token”

}

Then, with the specific token you created earlier, replace “Your Bot Token” and save this file. After that create a new file & paste the code given below:

                                  {

“name”:”greeter-bot”’,

“version”:”1.0.0”,

“description”: “ My First Discord Bot”,

“main”:”bot.js”,

“author”: “Your Name”,

“dependencies”: {}

}

If you want, you can also make some preferable changes like replacing your author name with yours or changing the “description” from ‘’My First Discord Bot” to something else. Now, save this file in your Discord Folder.

Step no 7: The last text that you need to make is the most crucial one as that will determine the way your bot behaves. One needs to be well acquainted with the JavaScript in order to really have control and a clear understanding of your bot. However, as a new or inexperienced with coding, what you can do is copy & paste the following code:

var Discord = require(‘discord.io’);

var logger = require(‘winston’);

var auth = require(‘./auth.json’);

// Configure logger settings

logger.remove(logger.transports.Console);

logger.add(new logger.transports.Console, {

colorize: true

});

logger.level = ‘debug’;

// Initialize Discord Bot

var bot = new Discord.Client({

token: auth.token,

autorun: true

});

bot.on(‘ready’, function (evt) {

logger.info(‘Connected’);

logger.info(‘Logged in as: ‘);

logger.info(bot.username + ‘ – (‘ + bot.id + ‘)’);

});

bot.on(‘message’, function (user, userID, channelID, message, evt) {

// Our bot needs to know if it will execute a command

// It will listen for messages that will start with `!`

if (message.substring(0, 1) == ‘!’) {

var args = message.substring(1).split(‘ ‘);

var cmd = args[0];

 

args = args.splice(1);

switch(cmd) {

// !ping

case ‘ping’:

bot.sendMessage({

to: channelID,

message: ‘Pong!’

});

break;

// Just add any case commands if you want to..

}

}

});

After you enter this code, a Discord bot will be set up which will answer certain messages

Step no 8: Click on the given Windows icon & type “Command Prompt”. After it opens, type “cd” & the command should appear like this on the My Computer: ”cdUsersPhil’sDesktoptoDesktopDiscordBot”. This will change that command prompt line to confine the file path to your folder.

Type “npm insta;; discord.io Winston-save.”. It will provide all the files that you might require.

Now type “node bot.js” in the Command Prompt and go back to your Discord server to check the bot. If all goes well, your bot will instantly return the coded message.

Conclusion:

That’s it! You have successfully learned how to make a discord bot. Now you can control group chats or perform monotonous tasks easily. I know there are some codes required to do the task but following the above mentioned it will become easier. In case you have any questions or doubts then do comment below and let me know.

Leave a Comment