Discord.py
discord.py is a modern, easy-to-use, feature-rich, and async-ready API wrapper for Discord, written in Python. It simplifies interacting with the Discord API by handling rate limits and providing an intuitive async interface. It is intended for Python developers building Discord bots or integrations.
✨ Key features
- Modern Pythonic API using async and await
- Proper rate limit handling
- Optimized in both speed and memory
- Supports voice via optional PyNaCl
- Includes commands extension for bot creation
🎯 Use cases
- Create Discord bots that respond to messages
- Build bots with command prefixes using discord.ext.commands
- Integrate Discord features into Python applications
- Handle voice channel operations with voice support
📦 Installation
🧰 Requirements: Python 3.8 or higher; for voice support, PyNaCl and system packages (libffi-dev, python-dev) are required.
python3 -m pip install -U discord.pypy -3 -m pip install -U discord.pyFor voice support:
python3 -m pip install -U "discord.py[voice]"py -3 -m pip install -U discord.py[voice]To install the development version:
$ git clone https://github.com/Rapptz/discord.py
$ cd discord.py
$ python3 -m pip install -U .[voice]
🚀 Usage
import discord
class MyClient(discord.Client):
async def on_ready(self):
print('Logged on as', self.user)
async def on_message(self, message):
if message.author == self.user:
return
if message.content == 'ping':
await message.channel.send('pong')
intents = discord.Intents.default()
intents.message_content = True
client = MyClient(intents=intents)
client.run('token')
❓ FAQ
What Python version is required?
Python 3.8 or higher is required.
How do I install voice support?
Install with pip install -U "discord.py[voice]" and ensure PyNaCl is installed. On Linux, you also need libffi-dev and python-dev packages.
How do I enable message content intents?
Set intents.message_content = True on your intents object, as shown in the examples.
Where can I find more examples?
More examples are available in the examples directory of the repository.
📊 Repository
🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.