Discord Bot Basics: Making Your Own Bot

Discord Bot Basics: Making Your Own Bot

In this Discord Bot Basics post, Caelan explains how to make a simple bot in discord.js, featuring a config.json file and app.js file.

How to make your own bot (for starters):

Step 1: Enter Discord Applications ( https://discordapp.com/developers/applications/me )

Step 2: Open “My Apps” and click “New App”

Step 3: Type your bots name in “App name” and enter what you want your bots pfp to be in “App Icon”

Step 4: Click “Create App”

Step 5: Click “Create a Bot User”

Step 6: Create a File on your PC

Step 7: Create a Test Discord server

Step 8: Under your bot App, Click “Generate OAuth2 URL” and and add the bot to a test server

Step 9: Download Node.js, Discord.js and Visual Studio (optional). https://code.visualstudio.com/download https://nodejs.org/en/download/ “npm install discord.js” (in command prompt after downloading node.js)

Step 10: Create two files, “app.js” and “config.json”

Step 11: in “config.json” open the window with notepad or Visual Studio and enter “

[code language=”javascript”]

{ “token” : “,<Input the Client Token found in bot app>”, “prefix” : “!” }

[/code]

Step 12: In app.js enter bot scripts for commands with visual studio or notepad, include

[code language=”javascript”]

“client.login(config.token);”

[/code]

at the end

Step 13: Create a file called start.bat and open it Now your bot should be online and functional with the scripts you enetered in app.js Example scripts for commands will be listed in another article

  1. const Discord = require(“discord.js”);
  2. const client = new Discord.Client();
  3. client.login(“SuperSecretBotToken”);
  4. client.on(“ready”, () => {
  5. console.log(“I am ready!”);
  6. });
  7. client.on(“message”, (message) => {
  8. if (message.content.startsWith(“ping”)) {
  9. message.channel.send(“pong!”);
  10. }
  11. });