Skip to content

How to create a Discord bot?

  • by
  • 5 min read

Since its launch in 2015, Discord has come a long way from its humble beginnings as a gaming voice chat application. Now the application is packed with features not only for gamers but just about anyone who wants an app where a number of people can communicate.

One of the most useful features of Discord is the insane number of bots available to download and use, which can do anything from sending memes to playing music inside voice channels, among other things.

If the exhaustive bot library at your disposal isn’t enough, you can always code your own bot and that’s exactly what we’re going to do in this article.

Making a Discord bot consists of three major steps and Each part requires its own prerequisites and technical know-how.

  • Making a Bot account
  • Coding and Testing a bot
  • Deploying it on a server

Also read: How to add friends in Discord?

Making a Bot account on Discord

Before we start making our bot, we need to create a bot account and get a token so our bot is authorised and identified on the Discord servers. 

Log-in to your account on the Discord website and follow the steps mentioned below to create abot.

Step 1: Head over to the Applications Page and click on the New Application button.

How to create a Discord bot? | Candid.Technology

Step 2: Enter an application name for your bot.

Step 3: Click on the Bot option on the left side.

Step 4: Click on the Add Bot button.

Step 5: Click on Yes, do it! in the pop-up confirmation box to continue.

Step 6: Click on the Copy button to copy your token. 

Also read: How to add friends in Discord?

Coding and testing your bot

Before we jump into actual code, there are a bunch of programming languages that you can choose to code your bot. You can pick from Python, Java, JavaScript and C#.

For the purpose of this article, we’re going forward with Python as it’s the most beginner-friendly language on the list. We’ll be using the wonderful library to write our bot’s code

Once you’ve got Python3 and the library installed, simply pop open any empty text file on a text editor and start writing your bot’s code.

Here’s an example to get you started. Create a file name and type in the following code. 

import discord

client = discord.Client()

async def on_ready():
print('We have logged in as {0.user}'.format(client))

async def on_message(message):

if == client.user:

if message.content.startswith('$hello'):
await'Hello!')'your token here')

Make sure you put your token in the”) command. 

The code above is for a simple text bot that responds ‘Hello’ to any message sent on the server, which starts with hello.

Now to run the bot, simply run the Python script like any other script you would. 

If you’re on Windows

py -3

If you’re on Linux


Also read: How to screen share on Discord?

Adding a bot to your Discord server

If you haven’t already made a test server, now is a good time to do so. Now head back over to the Discord Application Page and follow these steps to get an invite URL for your new bot. 

Step 1: Head over to the OAuth2 tab on your bot page.

Step 2: Scroll down and tick bot under scopes.

Step 3: Scroll down more and tick all the permissions your bot needs to function properly.

Step 4: Once you’re done, the resulting URL can be used to invite your bot to your server of choice.

There you go. You have your very own Discord bot up and running. 

Also read: How to add a music bot to Discord?

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here:

Exit mobile version