I’m making a Discord Bot but I am new. Can you help me?

Erin Skidds
2 min readDec 19, 2020
Photo by Marc Noorman on Unsplash

Sure! First you need to make sure you download & install a few things:

  • Node.js: You can download it from here: their website. Once you download it, you will need to install it.
  • An IDE. I use Visual Studio Code, personally but really any editor where you can see the code clearly will work.
  • Discord.JS: this is a software that goes on top of Node.JS that helps run your bot. I’ll explain how to install this in a moment.

Next, you need to create a folder for your bot. I recommend just creating it on your desktop. Name it whatever you’d like.
Now open the folder and hold down the SHIFT key (on Windows) or COMMAND key (on Mac) and right click and open Command Line or Powershell in this folder.

Now, navigate to Discord’s Developer Portal to create your discord bot. You can name it whatever and get whatever image you want. These can all be changed later.

Once you have command prompt or powershell open and your bot created, you will need to install the dependencies for your bot, which is Discord.JS. To do that, just write this code in your command prompt or power shell:

npm install discord.js

Once that is completed, you need to create your first file. Create a new file and name it index.js. Open that file in your selected IDE and add the following text:

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 (message.content === 'ping') {
message.channel.send('Pong!');
}
});
client.login('token');

Once that is there, replace token with your bot’s token at the end. Then add the bot to your server, run the file by typing node index.js in the command line and try to ping it, it should reply Pong!

--

--