Add some character to your Discord servers

Image for post

Photo by the author.

So you use Discord as a messaging application and you think to yourself, “Hey, maybe I should make me a bot…” Hopefully, this tutorial will get you started on the right path to building your own Discord bot using Python.


Table of Contents

  • Step 1: Install discord.py.
  • Step 2: Create a Discord application and bot.
  • Step 3: Create a Discord guild (server).
  • Step 4: Add the bot into the server.
  • Step 5: Code the bot.

1. Install discord.py

There are several libraries out there to hit Discord’s API, each with their own traits, but ultimately they all achieve the same thing. Since we are focusing on Python, discord.py is probably the most popular wrapper for Python.

Assuming you already have Python and pip installed, you’re going to want to run this command:

pip install discord.py

discord.py has some requirements that will automatically be installed if your machine doesn’t already have them. Once you have run this command, you should see something along the lines of this:

Installing collected packages: discord.py
Successfully installed discord.py-[version-number]

Success! You now have access to Discord’s API. Before we get into coding a Discord bot’s version of “Hello World,” we need to set up a few other things first.


2. Create a Discord Application and Bot

Before getting into the code, we need to create a “Discord application.” This is essentially an application that holds a bot. It can be accessed on Discord.

If you don’t have a Discord account, then you’re going to want to create one. But if you don’t have a Discord account, I don’t see why you would even look at this type of tutorial in the first place.

The page should look something like this:

Image for post

Once you are on this page, you’re going to want to go to the “New Application” button:

Image for post

After you click on the button, you’ll be prompted to name your application:

Image for post

#python3 #software-development #discord #programming #python

Build a Discord Bot With Python
3.30 GEEK