Skip to content Skip to sidebar Skip to footer

Discord.py On_member_join Not Working Even Though The Bot Is In The Server And Online

I have been trying to make a discord bot but I am facing problems with the on_member_join function. The bot has been given admin permissions and I face no error in the console eith

Solution 1:

You need to pass intents in the Client() initializer

Below is the revised code:

import discord
intents = discord.Intents.default()
intents.members = True
client = discord.Client(intents=intents)

@client.eventasyncdefon_ready():
    print(f'We have logged in as {client.user}')


@client.eventasyncdefon_member_join(member):
    await member.send('welcome !')

client.run('TOKEN')

Solution 2:

Try using intents. With this version you will need to use intents.

https://discordpy.readthedocs.io/en/latest/api.html?highlight=intents#discord.Intents

Intents are the new features required in discord.py version 1.5.0 + If your bot doesn't use intents and you're using events such as on_member_join() it wont work!

import discord
from discord.ext import commands

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

Post a Comment for "Discord.py On_member_join Not Working Even Though The Bot Is In The Server And Online"