Discord.py

Tools & Infrastructure 💻 Python ⚖️ MIT 🟢 Actively maintained
16.2k stars

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.

Linux/macOS
python3 -m pip install -U discord.py
Windows
py -3 -m pip install -U discord.py

For voice support:

Linux/macOS
python3 -m pip install -U "discord.py[voice]"
Windows
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

Stars★ 16,168
Forks🍴 3,923
Open issues🐛 163
Last commit🕒 Sep 1, 2026
Created📅 Aug 2015
Language💻 Python
License⚖️ MIT

🤖 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.