Making a Discord Bot with Python
Prerequisites
- Python 3.10+
- Some magic gizmos for getting on Discord
Setting up the Bot
To make a Discord bot, you first need to register a Discord app:
Applying for a Bot token
Log in to Discord Developer Portal — My Applications
Create an app by following these steps:


Once you click Create, the app is created. There should be some way to see the bot token directly at this point, but for some reason it wasn't showing up for me, so go to the app page, click the Bot option on the left, and click Reset Token to reset the bot token.
After you click it, the bot token is shown once and then never again, so keep it somewhere safe.

If these three aren't enabled, you'll run into problems when registering slash commands.
Granting permissions
Next you need to create a Discord server (skip this if you already have one), then invite the Bot in.

Once the Bot is in, the Discord-side prep is done.
Writing the code
I'll use the Python discord-py-interactions library here.
The library's Github repo: Github
Tutorial & API docs: Guide
First install the library (requires Python 3.10+):
pip install -U discord-py-interactions
Code:
import interactions
bot.start(TOKEN)
And that's the simplest possible Discord bot skeleton set up. I'll keep adding features going forward.
