How do I get the discord.py intents to work?
intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix=',', intents=intents)
You also have to enable privileged intents in the developer portal
A Primer Gateway to Intents
Enable intents for discord.py bot
intents were introduced in 1.5.0
so I don't think they were working before, but answering your question
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(..., intents=intents)
Also remember to enable privileged member intents in the developer portal
How to enable privigeled intents
Python discord bot doesn't answer to any commands
To improve privacy bots now need a special intent in order to be able to read messages. The "new" commands (which i would recommend you to switch to) are slash commands as they are fully supported by Discord. You can find more information on how to set up slash commands here.
If you want to stick with the old method, here is he to activate the intent: First go to your Developer Portal, select your application and activate the Message Content Intent. Next you need to activate the intent in your code like this:
intents = discord.Intents.default()
intents.messages = True
bot = commands.Bot(command_prefix='!', help_command=None, case_insensitive=True, intents=intents)
Note that if your bot is on 100 or more servers it needs to be verified in order to access intents. More information on that can be found here.
Discord.py Priveleged Intents stopping on_message and commands from working
I'm guessing that using intents = discord.Intents()
has all intents set to False
.
You can either use intents.messages = True
or intents.all()
.
Related Topics
Including Non-Python Files with Setup.Py
Insert a Row to Pandas Dataframe
How to Get First Element in a List of Tuples
Python Sharing a Lock Between Processes
Generating a List of Random Numbers, Summing to 1
Finding Median of List in Python
Running Selenium with Headless Chrome Webdriver
Python: JSON.Loads Returns Items Prefixing with 'U'
Most Recent Previous Business Day in Python
Finding Multiple Occurrences of a String Within a String in Python
How to Find All the Subsets of a Set, with Exactly N Elements
Convert Unix Time to Readable Date in Pandas Dataframe
How to Validate a Url in Python? (Malformed or Not)
How to Print Unicode Character in Python
Given a Url to a Text File, What Is the Simplest Way to Read the Contents of the Text File
Attributeerror: Module 'Time' Has No Attribute 'Clock' in Python 3.8
How to Manually Install a Pypi Module Without Pip/Easy_Install