How to Make a Discord Bot: Overview and Tutorial

calendar_today Jan 31, 2023| schedule 15 MIN READ


Discord bot is an AI-powered tool for automating tasks on the Discord server. It makes it much easier to create a fully involved community and may be used to regulate the server.

Discord markets itself as an "all-in-one voice and text chat for gamers.


"Discord has undergone rapid development and has become incredibly common even among individuals with very little interest in video games, thanks to its clean layout, simplicity of use, and numerous functionality. Its user base grew from 45 million to over 130 million users between May 2017 and May 2018, with as many regular visitors as Slack.


With the rise of the Discord bot, a standard chat and voice application among gamers, it's become trendy for Internet users to spend time on "Dissension servers" discussing various topics. The fact that you can create your accessible server, use it with different channels, and invite everyone you need to join it is extraordinary.


One of Discord's best features is the ability to create automated clients (bots) that can do various tasks. Those bots are written in JavaScript and might be challenging to understand. They do tasks like playing music for customers on a server and greeting new clients whenever they arrive.

Discord server

Discord servers are virtual spaces—specific communities and friend groups. The overwhelming majority of servers are modest and only accessible via invitation. Some of the larger servers are open to the public. Any user can create a new server and ask their friends to join it for free.

Discord API

Discord's user interface resembles a mix of Skype and Slack. It is accessible as a web, mobile, and desktop application and is free to use. Users may construct their Discord servers and utilize them to host secret, password-protected, or public channels.

The WebSocket API

The WebSocket API is a cutting-edge technology that allows multiple interactive communication sessions between users' browsers and servers. You may use this API to deliver emails to a server and receive event-driven answers instead of polling the server for a 


How to create a Discord Bot

Step 1: Get Node.js installed and create a Discord account.

Node.js is an open-source JavaScript runtime that you'll need to make your bot operate. Before you begin working on anything else, go to and download and install it.

You must have a Discord account and your server to test your bot. Go to and register one if you haven't already. If you already have one, log in and select the server wherever you want your bot to operate.

To code, you'll need a text editing tool, such as Notepad++ on Windows.

Step 2: To enable your program to run, you'll need to establish a Discord application.

 It is not challenging, but it does require some effort. The aim is to obtain an authentication token for the bot, which will allow Discord to identify your code and add it to the bot's servers.

Go to to get started. You must sign in with your profile to be sent immediately to your application list. To begin, select New Application. Give your bot a handle, then click the Save Changes button.

Select bot from the right-hand menu. Click Add Bot under the Build-a-Bot option once you're in the new menu. It should immediately display if you have one application – the one we just created.

Step 3: Search for the terms Token: 

Click to Reveal in the box labeled App Bot User. When you click the link, a string of data appears. It is the authorization token for your bot, which allows users to send it code. Please don't give it out to anybody since it lets whoever has it write bot code, which means they can command your bot. If you believe the token is not sound, then the Produce a New Token option allows you to generate a new one quickly. Make a note of your token. It'll come in handy right away.

Step 4: Finding Client ID

Find the Client ID, a lengthy number, under the box labeled App Details. Copy that number and paste it in place of the term CLIENT ID in this URL.

The final URL should resemble this, but with the client ID number instead of this fictitious one.

In your browser, paste the URL that contains the client ID number. It will lead you to a page where you may tell Discord where You should send your bot. If you run Discord in an app or the browser & navigate to your server, you'll know it worked. The channel will announce that a bot has joined the room, and you'll notice it under the list of online members on the right side menu.

Step 5: Make A folder. 

While you're doing it, make a folder inside an easily accessible location on your computer to keep all of your bot's data. So you know what it is, call it something basic like "DiscordBot" or "MyBot."

Step 6: You'll use a text editor to make three files for your bot. First, paste the code:

Replace "Your Bot Token" with the token you created on the application page for your Bot. Ensure that the token is in quotation marks. Then save the file as "auth.json" into the Discord bot folder on your desktop. It's important not to keep it as an a.txt file since it won't function.

If you like, change the author's name to your own. You may also alter the descriptions to something more relevant to what you're producing, which will help you remember what your bot intends to accomplish.

Save this file to your Discord bot folder as "package.json."

Step 7: There's one more text file to make, and it'll control how your bot behaves.

 You'll need to be familiar with JavaScript to completely regulate and understand your bot. If you're new to coding and want to build anything, copy and paste the code into a file to create a simple bot that will greet you on your server.

code creates a Discord bot that responds to particular messages, specifically those that begin with the letter "!" We've coded the bot to respond to the command "!If someone places that on the server whenever the bot is there, the bot will reply with a pre-written text. "Greetings!" we typed in the message's code." Greetings!" we wrote in our code for the message. Hello and welcome to the server!" You may change the prompt and response messages by modifying them in the coding provided. Just make sure the messages are in single quote marks.

Save the last text file to the Discord bot folder as "bot.js."

Step 8: Selecting Command Prompt on a Windows PC

You may access the Command Prompt on a Windows PC by selecting the Windows icon and entering "Command Prompt" in the field. Type "cd" followed by the file path of your folder once it's open. "c: DesktopDesktopDiscordBot" UsersPhil's is the command we used on our test machine. The command prompt line should also include the directory structure of your folder.

You may also go to your folder in Windows and right-click on a vacant area in the folder while holding Shift, then pick Open Command Prompt.

Step 9:it's time to put Node.js to work

Now it's time to put Node.js to work. "npm install Winston –save" at the Command Prompt, with the Discord bot folder inside the file path line. It will install the files you require for your Discord bot right into the folder.

To install extra dependencies, use the below command line prompt: v6 npm install

That should give you all of the files you require.

Step 10:You're all set to go now. 

Type "node bot.js" at the Command Prompt to test running your bot (make sure you're still in the Discord bot folder).

Return to your Discord server and type "!intro" or "!" to test your bot's performance, along with the prompt text you created in your "bot.js" file. If users coded the bot correctly, this command would force your bot to respond with the message you specified.

You are the proud inventor of a Discord bot, so congrats.

Discord bot benefits

Discord chatbot on Irc makes it easy to build a vibrant community. You can use them to greet new members to the server, control member interactions, and ban users who do not follow the rules.


With the rise of Discord, a typical chat and voice application among gamers, it's become viral for Internet users to spend time on "Dissension Servers" Discord API. Discord's user interface resembles a mix of Skype and Slack. The WebSocket API allows multiple interactive communication sessions between a user's browser and a server.

The aim is to obtain an authentication token for the bot, which will allow Discord to identify your code and add it to the bot's servers. It takes some effort, but it's not complicated. If you're new to coding, you'll need to be comfortable with JavaScript. It will help you create a simple bot that will welcome you into your server. We hope this blog will help you find the way to create a discord bot. 


Like the AI functionality of Discord? Meet BotPenguin! A Powerful no-code chatbot builder that helps you set up chatbots in no time. What's the best part? You Don't need to pay anything!