What you will build
- A bot that responds to a text command, like replying with a message when someone types !ping
- A bot that reacts to a message event, such as auto-replying or flagging a keyword for moderation
- A bot connected to Discord's Gateway that stays online at no cost on a free-tier host
The path, stage by stage
Work through these free courses in order. Each stage links to the full course details, its platform, and what you walk away able to do.
| Stage | Course | Platform | Hours | What you gain |
|---|---|---|---|---|
| 1. Learn Python fundamentals | Intro to Python Programming | Khan Academy | 15 | Khan Academy's Intro to Python Programming gets you to the building blocks a bot runs on: variables, functions, loops, and conditionals. That is exactly the logic you write inside a bot's command and event handlers, so by the end you can read and write the Python that discord.py expects you to fill in. |
| 2. Work with APIs, JSON, and web data | Python for Everybody Specialization | Coursera | 120 | The Python for Everybody Specialization, and its Using Python to Access Web Data course in particular, teaches you to call web APIs and parse JSON responses. A Discord bot is nothing but API calls under the hood: discord.py wraps Discord's REST and WebSocket API, so this is the direct skill that turns bot code from copy-paste into something you understand and can debug. |
Why these courses, not the alternatives
We start with Khan Academy's Intro to Python Programming because it is genuinely beginner-first and free with no account paywall, so you write real Python from the first lesson instead of stalling on setup. We hand the second stage to Coursera's Python for Everybody, and specifically its Using Python to Access Web Data course, because that is the catalog's best free treatment of calling APIs and parsing JSON in Python, which is the one skill a Discord bot depends on most. Being honest: our catalog does not have a bot-specific course yet, so this is fundamentals plus APIs, and you learn the discord.py library itself from Discord's free official docs. That is the same route most working developers actually take, and these two courses cover everything underneath it.
Before you start
None. This is a true from-zero path that starts with Python from scratch.
What you walk away with
A Python Discord bot that responds to commands, reacts to message events, and stays online for free.
Start with the first course
Apply it with a code-along tutorial
Frequently asked questions
Do I need to know Python before building a Discord bot?
No. This path starts from zero with Khan Academy's Intro to Python Programming. You do want the basics (variables, functions, loops) before you touch bot code, which is exactly what the first stage covers, and the API skills from the second stage are what make the bot's code make sense.
Where do I run a Discord bot for free 24/7?
A bot has to stay running to respond, so you host it somewhere always on. Free options include Railway's free tier, Fly.io's free allowance, and Oracle Cloud's always-free small VPS. Replit can keep a bot alive too, though its free plan sleeps, so a small always-on VPS or Railway is more reliable for a bot that needs to be online around the clock.
Do I need Discord Nitro or a paid Discord plan to make a bot?
No. Creating a bot is completely free. You register an application and add a bot user at the Discord Developer Portal (discord.com/developers), grab its token, and invite it to a server you manage. Nitro is a cosmetic subscription for users and has nothing to do with building bots.
What is the difference between discord.py and discord.js?
They are the same idea in two languages. discord.py is the Python library, which is what this path sets you up for, and discord.js is the JavaScript/Node option. If you already know Node or TypeScript, discord.js is a fine choice, and we have a full code-along for it: Build a Discord Bot with TypeScript and discord.js at /tutorials/build-discord-bot-typescript-discordjs. Since this route teaches Python, discord.py is the natural fit and has excellent free docs.
Keep going on FreeCodingCourses
Where this build leads
Related builds