Install & Compatibility
Where this runs
tested against v2.8.0 · 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.940 runs
installs and imports cleanly · install 0.0s · import 0.957s · 42.6MB
glibcpy 3.10–3.940 runs
installs and imports cleanly · install 4.6s · import 0.854s · 44MB
42MB installed
● package 42MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Bot
✓ from discord import Bot
The primary class for creating a Discord bot with command handling capabilities.
Client
✓ from discord import Client
A lower-level alternative to Bot, often used for simple event-driven bots without command framework needs.
Intents
✓ from discord import Intents
Required for specifying which events your bot will receive from Discord.
ApplicationContext
✓ from discord import ApplicationContext
The context object passed to application commands (e.g., slash commands).
This quickstart demonstrates a basic Pycord bot that comes online and responds to a slash command '/hello'. It highlights the use of `discord.Bot`, `Intents`, and retrieving the bot token from an environment variable for security. Remember to enable the 'Message Content' privileged intent in your bot's Discord Developer Portal settings for `intents.message_content = True` to function correctly.
import discord
import os
# Enable necessary intents. message_content is privileged for text commands.
intents = discord.Intents.default()
intents.message_content = True # Required for reading message content in commands or on_message events
bot = discord.Bot(intents=intents)
@bot.event
async def on_ready():
print(f"{bot.user} is ready and online!")
@bot.slash_command(name="hello", description="Say hello to the bot")
async def hello(ctx: discord.ApplicationContext, name: str = None):
"""Says hello to the user or a specified name."""
name = name or ctx.author.name
await ctx.respond(f"Hello {name}!")
# Run the bot with the token from environment variables
# Make sure to set a 'TOKEN' environment variable with your bot's token
bot.run(os.environ.get('TOKEN'))
Debug
Known issues
breakingPycord v2.7.0 dropped support for Python 3.8 and 3.9. Python 3.7 and below were dropped in v2.0. The library currently requires Python >=3.10 and <3.14.fixUpgrade your Python environment to version 3.10 or higher (up to 3.13) to ensure compatibility.
affects: >=2.7.0 (for 3.8/3.9), >=2.0 (for 3.7 and below)
breakingGateway Intents are now explicitly required when initializing `discord.Client` or `discord.Bot`. Additionally, `Intents.message_content`, `Intents.members`, and `Intents.presences` are 'privileged intents' and must be manually enabled in your bot's Discord Developer Portal settings.fixInitialize your bot with `intents = discord.Intents.default()` (or specific intents) and pass them to the bot constructor (`bot = discord.Bot(intents=intents)`). For privileged intents, also enable them in the Discord Developer Portal under your bot's settings.
affects: >=2.0
breakingMigrating from py-cord v1.x to v2.x involves significant breaking changes, including a new `discord.Bot` class for application commands, redesigned UI components, removal of user account support, and changes to webhook handling. Old `discord.py` code may require substantial updates.fixRefer to the official 'Migrating to v2.0' guide in the Pycord documentation for a comprehensive list of changes and migration steps.
affects: >=2.0
gotchaA `KeyError` could occur when fetching application information or checking ownership (`is_owner`) due to `read_only` team members not being considered owners. This was a recent fix.fixUpgrade Pycord to version 2.7.2 or later to include the fix.
affects: <2.7.2, <2.8.0rc2
Upgrade
Version history
2.8.0latest on PyPI · released May 18, 2026
Audit
Dependencies
PyNaCloptionalRequired for voice support.
aiodns, brotlipy, cchardetoptionalOptional speedups for aiohttp.
msgspecoptionalOptional speedup for JSON processing.