Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the discord.py intents to work?

I am trying to make a bot that welcomes people to the server that it's in and all of the code works except for the on_member_join event because it utilizes the new intents. I googled on how to work with the intents and tried everything but it still isn't working.

intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix=',', intents = intents)

How do I fix this?

like image 534
hevn Avatar asked Nov 14 '20 04:11

hevn


Video Answer


2 Answers

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

like image 98
Łukasz Kwieciński Avatar answered Oct 18 '22 01:10

Łukasz Kwieciński


This code will help.

intents = discord.Intents().all()
client = commands.Bot(command_prefix=',', intents=intents)

EDIT
WARN: the code above will use ALL intents avaliable

like image 7
aph Avatar answered Oct 18 '22 01:10

aph