How to Make a Discord Bot

How to Make a Discord Bot

Discord bills itself as “where the world talks, hangs out, and builds relationships with their communities and friends.” What started out as a user-friendly VoIP (voice over internet protocol) and instant messaging platform for gamers quickly evolved into the perfect place to host an online community for businesses and hobbyists alike.

If you’ve ever joined or run a Discord server, chances are you’re familiar with Discord bots, those helpful autonomous agents that can do things like:

  • Welcome new members
  • Moderate communities
  • Set reminders
  • Perform polls
  • Measure statistics and produce reports on demand

Discord bots have become something of a key differentiator for the platform, allowing community owners to take engagement, moderation, and interactivity within their communities to the next level.

Eager to harness the power of Discord bots for your own community? In this article we’ll walk you through the steps needed to create your own Discord bot.

Different types of Discord bots

While you can manage Discord channels and servers manually, bots can help boost engagement and increase your productivity by performing a variety of tasks automatically. Here are some cool ideas for Discord bots you can make and add to a server.

  • Translation bot. This type of bot can help you translate different languages. It can be incredibly useful when dealing with a community of users from across the globe.
  • Moderation bot. With this bot, you can monitor all communication happening in a channel and delete messages that violate certain terms.
  • Statistics bot. This bot can help analyze data on a Discord server, allowing you to gain crucial insight on key metrics.
  • Voice command bot. This bot allows you to perform certain functions on a server using Discord bots.
  • Music bot. As the name suggests, this type of bot can play music on a Discord channel automatically.

Creating a Discord bot

From setting up a Discord account to setting permissions and adding the bot to a Discord server, here are steps for creating a custom Discord bot.

1. Create a Discord account and server

You can’t create a Discord bot without having an account and setting up your own server. Go to and create one with your email address and date of birth.

Once you’ve created a Discord account, proceed and log in. You will be directed to the following page.

Create a Discord channel

To create a server, click on the Add a Server button, highlighted below.

Add a server

Pressing the Add a Server button directs you to a popup screen—with options to either create a custom server or one from templates like gaming, school club, and study group—will appear.

Create a server

In this example, we will be creating a custom server, so go ahead and click on the Create My Own button.

You will be directed to another popup window where you have to choose whether the server is just for a few friends or a bigger community.

Tell Us More About The Server

In our case, we will select the For a club or community option.

Once you’ve made a selection, you’re directed to the following popup window—where you can add your server’s name and image icon. Proceed and add your server details and click the create button to proceed. Note the image icon is optional.

Customize your server

And with that, you’ve created a Discord server. You can invite friends to join the server, as well as personalize it further by adding channels and an icon.

Art World

2. Click “Applications”

In the previous step, we set up a Discord account and created a custom server. Now, we can dive into the fun stuff—creating a Discord bot.

Start by navigating to the Discord developer portal in your browser and selecting the “Applications” tab. You can also manually search the portal by typing “Discord developer portal” in your search engine.

Click Applications

3. Name your application

Click on the “New Application” button and add a name for your Discord application in the popup window. Finally, accept Discord’s terms and conditions—and press the “Create” button to add the bot.

Name Your Application

4. Select “Bot”

Once you’ve named the bot, you are directed to the following page containing general information about the bot and other settings.

Select Bot

Navigate to the “Bot” tab on the page to access the authorization flow settings and privilege gateway intents.

Bot tab

It’s a good idea to make sure “Public Bot” under the “Authorization Flow” section is switched on if you want public users to be able to invite your bot to their servers. That “Requires OAuth2 Code Grant” that is switched off unless the service you are developing specifically requires it.

Authorization flow

5. Copy the bot’s token

The bot’s client ID and Discord API token will be displayed as soon as you create it. Be sure to copy the token, as it can only be viewed once when generated. If you forget or lose access to your token, you will need to regenerate a new one.

You can find your bot’s token in the red, blurred-out section.

Build a bot

6. Navigate to the OAuth2 URL Generator tab

The next step is to add the scopes and bot permissions. First, expand the OAuth2 tab and select the “URL Generator” sub tab.

Navigate URL Generator Tab

7. Tick the “bot” checkbox under “scopes”

Find the “bot” checkbox and ensure that it's checked.

Tick the bot checkbox

8. Set bot permissions and copy the generated URL

Scroll to the bottom to tick the permissions required for your bot to function. You can also grant all permissions by checking the “Administrator” checkbox—but you have to be careful since it could lead to security vulnerabilities.

Set bot permissions

The invite URL will be auto generated depending on the permissions you select. Currently, our link appears as shown below.

Invite URL

If the Bot URL is not autogenerating, return to the “Authorization Flow” section of the “Bot” tab and make sure that “Requires OAuth2 Code Grant” is switched off.

Requires grant

9. Paste the bot’s URL into a browser and invite it to your server

In step one, we created a custom server. We can now add the bot to the server by navigating to the URL generated in the above step.

If you have multiple servers, they will appear in the dropdown window. In our case, we are adding the bot to the “Art World” server.

Once you choose a server, click the “Continue” button to proceed.

Paste bots URL

You will be given an opportunity to confirm the permissions you previously selected. If everything looks good, click “Authorize.”

Also, you may have to confirm you’re a human to finalize the process.

Finalize process

Congratulations! You have successfully created a bot and added it to your server.

Popular Discord bots

Whether it's welcoming new users, replying to certain messages, providing general information about the server, or banning individuals violating certain terms, bots bring powerful functionality to Discord. Here are popular examples of Discord bots.

  • ProBot: This bot lets you welcome new members, react to messages, assign roles to users, and reward the most active users. ProBot can also be used for moderation, including detecting offensive messages and banning users.
  • This bot helps businesses manage tickets, create staff accounts, and control their permissions. It's also capable of automatic language translation, enabling organizations to target audiences in different regions.
  • Dank Memer: It helps you boost your community’s engagement by generating and posting memes on various servers.
  • Arcane: If leveling and community roles are vital to your channel, Arcane is the general-purpose Discord server management bot for your needs.  
  • Community Hubs: This bot allows members to post content in specific channels or hubs, making it easy for other users to find whatever they’re looking for.
  • Mee6: This is the gold standard for Discord server management bots. It welcomes new users, enforces server rules, and adds levels, XP, and roles.
  • Midjourney: This bot enables users to generate images using Midjourney’s text-to-image AI from within the Discord environment. However, free users can have a limit on the number of images they can generate.

How to add bots to Discord servers

Adding bots to Discord servers typically follows the same process. You have to invite the bot to your server, set permissions, and provide necessary authorization. We’ll demonstrate how this process works by adding the Dank Memer bot to a Discord server.

Navigate to the Dank Memer website

In your browser, navigate to the Dank Memer website, shown below.

Navigate Dank Memer website

Click on the “Invite Now” button to invite the bot to your Discord server.

Invite the Discord bot to server

Invite the Discord bot to the server

Clicking on the “Invite Now” button directs you to the following page where you select the server you wish to add the Dank Memer bot to.

Invite Discord bot to server

Press on the “Select a server” dropdown button and choose your desired Discord server as demonstrated below. In this case, we will be adding the bot to the “Art World” server.

Select a server

After selecting a server, click on the “Continue” button to proceed.

Grant necessary permissions

Clicking on the “Continue” button directs you to the following page where you have to grant permissions to the bot.

Grant necessary permission

In this case, the Dank Memer bot requires the checked permissions to work. Meaning, revoking some of the permissions may cause the bot not to function as expected.

Leave the default permissions as they are and scroll down the page. Click on the “Authorize” button—at the bottom of the page—to complete the authorization process.

Default permissions

Check the Discord server

Now that we have invited the Dank Memer bot to our server, let’s check if the integration was successful.

Open the Discord application and then navigate to the server where you added the Dank Memer bot. You should see the following page if the bot was added successfully.

Check Discord Server

You can use different commands to interact with the Dank Memer bot. For instance, the “/clap” command allows the bot to add “clapping hands” emojis to your message.

Dank Memer bot

Different ways to develop Discord bots

You can add many third-party bots to your Discord server. But if you want extra features and more control over what the bot does, consider developing a custom bot from scratch. Programming languages like JavaScript, Python, and C++ have numerous built-in libraries you can use to create Discord bots.

Read on to learn how to build a Discord bot using Python.

Developing a Discord bot using Python

Python is a powerful language with a wide variety of open source dependencies you can use to create Discord bots. To illustrate, we will create a simple bot that can reply to limited user messages.

Installing Discord library

Start by installing the Discord Python library on your computer using the following command.

Create a new project

On your desktop, create a new folder and give it any name. Inside the folder, add two new files: and

Create a new project

Add logic to the file

Open the file in your code editor. This file will contain all the bot’s logic.

Start by importing the Discord library at the top of the file, with the following line of code.

--CODE language-markup--
Import discord

Next, let’s add a function that will store the bot’s feedback. In this simple example, the bot will only be replying “Hi there” or “Hello user. Welcome” to user inputs. So, the function will look like this:

--CODE language-markup--
def handle_user_messages(msg) ->str:
    message = msg.lower() #Converts all inputs to lower case
    if(message == 'hi'):
        return 'Hi there'
    if(message ==’hello’):
        Return ‘Hello user. Welcome’

Next, we write the following function to handle communication between the user and the bot. This function checks the user’s input and sends a reply to a channel. It also handles errors that may occur when processing messages.

--CODE language-markup--
async def processMessage(message, user_message):
        botfeedback = handle_user_messages(user_message)
    except Exception as error:

Finally, we create the main (runBot) function to control our bot. The function contains your bot token, which is required for authorization. You can get a Discord token from your bot’s application page. It’s always a good idea to store the token in a separate .env file for privacy—but in this example, we’re aiming for simplicity.

The runBot function also has nested methods (on_ready and on_message) that are triggered when the bot is online and when a new message is detected.

--CODE language-markup--
def runBot():
    discord_token = 'MTE0MjAyNTYyNDkzMjg0MzU5MA.GAvF0I.ZRAgSRHz6YlEaIek2y5dyvybJJTc7Jhr10hI2E'
    client = discord.Client(intents=discord.Intents.default())

    async def on_ready():
        print({client.user}, 'is live')

    async def on_message(message):
        if == client.user:
        await processMessage(message, 'hi')

Adding main method

We can add the main method required to execute the program in the file, as follows.

--CODE language-markup--
import artbot
if __name__ =='__main__':


Now that we’ve created a bot, we can start it up and then add it to a server.

If you followed the above steps correctly, you should see the above outputs when you run your bot application.

Bot application

The Artbot bot should also reply to messages in any server it’s added to. As shown below, the Art bot generates a new Discord message when the user types “hi” in a channel.

Artbot Discord

With this setup, the bot goes offline when you switch off your computer. Consider saving the bot code on GitHub or host the application on a web server for continued performance.

Overall, are Discord bots hard to make?

Generally, making Discord bots depends on your level of expertise and experience with programming languages like Python and C++. If you’re familiar with the Discord development environment and have some coding skills, you can find making Discord bots relatively simple.

In case you lack the necessary technical knowledge, you can still make Discord bots using third-party tools with drag-and-drop user interfaces. Numerous online tutorials and learning resources on platforms like Udemy can help you create a Discord bot.

Hire a bot developer for best results

In this article we covered how to make a Discord bot along with some of the more popular Discord bots already out there. While creating a simple Discord bot is relatively easy, building something custom that’s as powerful as some of the more popular bots available to the public will require programming skills in languages like Python, the language used for coding Discord bots.

Not a developer but need expert programming help to bring your bot idea to life? Hire a bot developer on Upwork today.


Projects related to this article:
No items found.

Author Spotlight

How to Make a Discord Bot
The Upwork Team

Upwork is the world’s work marketplace that connects businesses with independent talent from across the globe. We serve everyone from one-person startups to large, Fortune 100 enterprises with a powerful, trust-driven platform that enables companies and talent to work together in new ways that unlock their potential.

Get This Article as a PDF

For easy printing, reading, and sharing.

Download PDF

Latest articles

X Icon