Creating a basic Discord bot in Python

Dylan Cox
5 min readMay 31, 2022

I’ve been enthralled with making Discord bots for the past several months — fairly basic ones to ones that make API calls (for a Hackathon I competed in).

I’ll go through the steps of creating a simple Discord bot in Python, using the Pycord (a more modern wrapper for Discord.py) that let’s you create custom slash commands to display a gif.

Firstly, I’ll be using Visual Studio Code, but feel free to use any other Python IDE (Sublime, Notepad++, etc.)

First we want to make sure we have the latest version of Python installed on our PC. Open up your command prompt and type

python --version

The latest version of Python as of writing is 3.10.4

If you do not have Python downloaded, head over to https://www.python.org/downloads/ to get the latest version.

Next we will need to download Pycord. Within your code editor or command prompt, copy and paste the following:

pip install git+https://github.com/Pycord-Development/pycord

After we’ve got our Python prerequisites installed we can begin setting up our bot on Discord’s developer portal. You will want to create an account at https://discord.com/developers , afterwards from https://discord.com/developers/applications you can create a new application for your bot.

Give it a name. In this example we’ll name the application Gif Commander (this is not the name of your bot — just…

--

--

No responses yet