Discord.py bot-the on member join method does not work

intents = discord.Intents.all()
client = discord.Client(intents=intents)

bot = commands.Bot(command_prefix='$')

@bot.event
async def on_member_join(member):
    //код

Neither @bot.event nor @client.event work. SERVER MEMBERS INTENT is enabled. What could be the problem?

Author: Alex, 2020-10-01

3 answers

bot = commands.Bot(command_prefix = '$', intents=intents)

 1
Author: Kindane, 2020-10-14 05:12:04

Enable them on the discord developer site in the bot tab. Here is a link to the documentation: https://discordpy.readthedocs.io/en/latest/intents.html 12

 1
Author: Dm1triy, 2020-11-01 21:31:50

I also suffered from this problem for a long time, it is connected with the update of the discord API, so that the event works, it is enough to write this at the beginning: (I am from the phone, so for some reason you can not add the code) intents = discord.Intents.all()

It should turn out like this: client = commands.Bot(command_prefix = "!", intents = discord.Intents.all())

Everything worked for me right away

 0
Author: Dfil8, 2020-10-14 04:07:01