When you build a Discord bot in Python, you might notice some events never fire. Your bot might not see member joins, message content, or presence updates. This happens because Discord requires explicit permission called intents. Without enabling the right intents, your bot misses key data. This article explains what intents are, why they exist, and how to set them up correctly in Python using the discord.py library.
Key Takeaways: Enabling Discord Bot Intents in Python
- Discord Developer Portal > Bot > Privileged Gateway Intents: Enables server members intent, message content intent, and presence intent for your bot application.
- discord.Intents.default() and discord.Intents.all(): Two methods to create an intents object with standard or all permissions in discord.py.
- client = discord.Client(intents=intents): Pass the intents object when initializing your bot client to activate event subscriptions.
What Are Discord Bot Intents and Why Do They Matter
Intents are permission flags that tell Discord which events your bot wants to receive. Discord introduced intents in 2020 to reduce unnecessary data sent to bots. Before intents, every bot received all events, even if it did not need them. This caused performance issues for large bots and privacy concerns for server members.
There are three privileged intents that require explicit enabling:
Server Members Intent
This intent lets your bot receive on_member_join, on_member_remove, and on_member_update events. Without it, your bot cannot see when someone joins or leaves a server. If your bot manages welcome messages or role assignments, you need this intent.
Message Content Intent
This intent allows your bot to read the text content of messages. Without it, your bot can still receive message events but the message.content field will be empty. This intent is required for any bot that parses commands or filters text. Discord made this intent privileged to protect user privacy and reduce spam.
Presence Intent
This intent lets your bot see member status updates such as online, idle, or do not disturb. It also includes custom status text and game activity. Most bots do not need this intent unless they track availability or display rich presence features.
Non-privileged intents like guilds, messages (without content), and voice_states are enabled by default. You only need to enable the privileged ones manually.
Steps to Enable Bot Intents in Python with discord.py
Follow these steps to configure intents for your Discord bot. You will need a Discord application already created at the Discord Developer Portal and Python 3.8 or later installed.
- Enable intents in the Discord Developer Portal
Go to https://discord.com/developers/applications. Select your bot application. In the left menu, click Bot. Scroll down to Privileged Gateway Intents. Toggle on Server Members Intent, Message Content Intent, and Presence Intent as needed. Click Save Changes. - Install or update discord.py
Open a terminal. Runpip install -U discord.py. This ensures you have the latest version that supports intents fully. - Create an intents object in your Python code
Import discord. Create an intents object. Usediscord.Intents.default()to start with standard non-privileged intents, then enable specific ones. Example:intents = discord.Intents.default()intents.members = Trueintents.message_content = Trueintents.presences = True - Pass the intents object to your client
When creating your bot client, include the intents parameter:client = discord.Client(intents=intents)
If you use commands.Bot, do the same:bot = commands.Bot(command_prefix='!', intents=intents) - Test your bot
Run your bot script. Check that events likeon_member_joinfire correctly. Print message content inon_messageto confirm the Message Content Intent works.
Alternative: Use discord.Intents.all()
If you want every possible intent enabled, use intents = discord.Intents.all(). This is convenient for testing but not recommended for production. Unnecessary intents increase memory usage and event processing overhead.
Common Mistakes When Using Bot Intents
Bot Does Not Receive Member Join Events
The most common cause is the Server Members Intent not enabled in the Developer Portal. Even if you set intents.members = True in code, the portal setting overrides it. Double-check the toggle is on. Also ensure your bot has the guilds intent, which is enabled by default with discord.Intents.default().
Message Content Is Empty in on_message
If message.content returns an empty string, the Message Content Intent is missing. Enable it in the Developer Portal and set intents.message_content = True in your code. Note that messages from other bots will still have empty content for privacy reasons.
Bot Shows Offline or Does Not Respond
This is usually not an intent issue. Check your bot token, internet connection, and that your Python script runs without errors. Intents do not affect basic connectivity.
Presence Events Not Firing
Enable the Presence Intent in the Developer Portal and set intents.presences = True. Also set intents.members = True because presence updates are often tied to member objects. Without both, you may see incomplete data.
Discord Bot Intent Levels: Default vs Privileged
| Intent Type | Default (non-privileged) | Privileged (requires portal toggle) |
|---|---|---|
| guilds | Yes | No |
| messages (without content) | Yes | No |
| voice_states | Yes | No |
| message_content | No | Yes |
| members | No | Yes |
| presences | No | Yes |
Non-privileged intents are safe to enable for any bot. Privileged intents require approval from Discord if your bot is in more than 100 servers. For smaller bots, you can toggle them freely in the Developer Portal.
Now you can configure Discord bot intents correctly in Python. Start by enabling only the intents your bot actually needs. For a moderation bot, enable Message Content and Server Members. For a music bot, you might only need default intents plus voice_states. Use discord.Intents.default() as a base and add specific flags. This approach keeps your bot efficient and compliant with Discord’s privacy guidelines.