Install & Compatibility
Where this runs
tested against v2.7.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.822s · 42.6MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 4.7s · import 0.776s · 43MB
42MB installed
● package 42MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Client
✓ import discord
client = discord.Client(intents=...)
✗ client = discord.Client()
As of v2.0, `intents` are a required keyword argument for `discord.Client` and its subclasses.
Bot
✓ from discord.ext import commands
bot = commands.Bot(command_prefix='!', intents=...)
✗ bot = commands.Bot(command_prefix='!')
As of v2.0, `intents` are a required keyword argument for `commands.Bot`.
Intents
✓ intents = discord.Intents.default()
intents.message_content = True
✗ intents = discord.Intents.all() # Or not enabling specific privileged intents
`message_content` is a privileged intent and must be explicitly enabled in both code and the Discord Developer Portal if your bot processes message content.
This quickstart demonstrates a minimal Discord bot that responds to a '$hello' message. It highlights the explicit requirement for `discord.Intents` and enabling the `message_content` privileged intent, which is crucial for bots interacting with message content in v2.0 and newer.
import os
import discord
intents = discord.Intents.default()
intents.message_content = True # Required for on_message to access message.content
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print(f'We have logged in as {client.user}')
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('$hello'):
await message.channel.send('Hello!')
# Replace 'YOUR_BOT_TOKEN' with your actual bot token, ideally from environment variables.
# Ensure DISCORD_TOKEN is set in your environment for production.
client.run(os.environ.get('DISCORD_TOKEN', 'YOUR_BOT_TOKEN'))
Upgrade
Version history
2.7.1latest on PyPI · released Mar 3, 2026
Audit
Dependencies
PythonrequiredRequires Python 3.8 or higher.
libffi-devoptionalRequired for voice support on Linux/macOS.
python-devoptionalRequired for voice support on Linux/macOS (e.g., python3.8-dev).