Home › Discord Bots › discord.py
What is discord.py? the Python API wrapper for building Discord bots
discord.py is a modern, easy to use, feature-rich and async-ready API wrapper for Discord, written in Python. If you can write a little Python, you can build a bot that answers commands, moderates a server, or plays voice — with no framework of your own to invent.
discord.py in one paragraph
discord.py (github.com/Rapptz/discord.py) is the long-running Python library for talking to the Discord API. It wraps the API in a modern Pythonic interface built on async and await, with proper rate-limit handling and an eye on speed and memory. It has been around since August 2015, passed 16,200 GitHub stars by December 2026, and is still actively maintained — its most recent push at the time of writing was September 2026.
It is released under the MIT licence, so anyone can use it in a free or commercial bot. You need Python 3.8 or higher, and you install it with one pip command (python3 -m pip install -U discord.py). Voice support is an optional extra (discord.py[voice]), and the documentation lives at discordpy.readthedocs.io. It is a library, not a finished bot: you write the bot, discord.py does the talking to Discord.
What discord.py actually does
discord.py gives you the pieces every Discord bot needs, and stays out of the way of the rest.
1. An async API that feels like Python
Everything is built on async and await, so a bot that waits on messages, reactions or voice never blocks the rest of the bot while it waits. Rate limits are handled for you, and the library is optimised for both speed and memory — the two things that matter once a bot is in more than one server.
2. A commands framework included
The discord.ext.commands extension turns chat messages into commands with almost no boilerplate: define a function, decorate it, and it answers. The README’s own example is a ping command that answers pong in a handful of lines, and there is a full examples directory in the repo for more.
3. Voice support when you need it
Install with the [voice] extra and add PyNaCl, and the same bot can join voice channels. On Linux you also need the system packages libffi-dev and python-dev installed first — the README says so plainly, so there are no surprises at install time.
4. Events and intents, done properly
Your bot reacts to events like on_ready and on_message, and you declare what it may see with intents — the README’s examples use Intents.default() with message_content switched on. A virtual environment is recommended for the install, especially on Linux where the system Python restricts what you can install.
Download and setup
Install it with pip: python3 -m pip install -U discord.py on Linux and macOS, or py -3 -m pip install -U discord.py on Windows. Python 3.8 or higher is required. For voice, install discord.py[voice] instead, and on Linux install libffi-dev and python-dev through your package manager first. To run the development version, clone the repo and install it with python3 -m pip install -U .[voice].
What it costs
discord.py itself is free — MIT licensed, no subscription, no per-bot fee. The only costs are the ones around it: a machine or host to run your bot on, which you arrange yourself, and your own Discord bot token, which the bot needs to log in (the README’s examples pass the token to client.run()). There is nothing to buy from the project itself.
Who discord.py is for
Python developers building a Discord bot
You know a little Python and want a bot that does exactly what your server needs. discord.py is the standard way to write one, and the quick-start example gets a bot replying in minutes.
Server owners who want a custom bot
Off-the-shelf bots never quite fit. With discord.py, your bot can enforce your rules, run your economy, or answer your commands — instead of bending your server around someone else’s bot.
Beginners learning async Python
The library is a gentle way into async and await: real, working examples, a short path from install to a bot that replies, and documentation that starts with the basics.
Teams replacing a bot they outgrew
If a hosted bot is too limited or too expensive, discord.py lets you own the code, the hosting and the data — and change any of them whenever you like.
discord.py at a glance
- Project: Rapptz/discord.py — “An API wrapper for Discord written in Python.”
- Licence: MIT — free and open source, commercial use allowed
- Popularity: over 16,200 GitHub stars by December 2026 (created August 2015)
- Language: Python
- Requirements: Python 3.8 or higher; a virtual environment is recommended
- Voice: optional
discord.py[voice]install with PyNaCl; Linux also needslibffi-devandpython-dev - Docs: discordpy.readthedocs.io, with examples in the repo
Honest limits
discord.py is a library, not a finished bot — you write the code, host the bot and keep it running yourself, and there is no hosted version to fall back on. Voice support is an extra install with extra system packages on Linux, and the bot only sees what its intents allow, so a bot that reads message content needs the message-content intent switched on. It is Python-only, so a team that does not write Python will be starting from scratch.
Want a Discord bot without doing the setup?
discord.py is the library behind our Discord bot service: we build your bot on discord.py, host it, and hand over a bot that already works in your server. Discord bot builds from £149, with larger community bots at £349 and £599. You bring the idea for what the bot should do; we do the code, the hosting and the setup.
Have a game idea?
Tell us the idea — a sentence is enough. We will tell you what it takes and what it costs, honestly.