-
Enable the server members intent near the bottom of the Bot tab of your Discord Developer Portal:
-
Change the line
client = discord.Client()
to this:intents = discord.Intents.default() intents.members = True client = discord.Client(intents=intents)
This makes your bot request the “members” gateway intent.
What are gateway intents? Intents allow you to subscribe to certain events. For example, if you set intents.typing = False
your bot won’t be sent typing events which can save resources.
What are privileged intents? Privileged intents (like members and presences) are considered sensitive and require verification by Discord for bots in over 100 servers. For bots that are in less than 100 servers you just need to opt-in at the page shown above.