Discord.py: on_member_join suddenly stopped working

I have the following code that I am trying out:

@bot.event
async def on_member_join(member):
    print("works")
    for channel in member.guild.text_channels:
        if channel.name == 'general':
            await channel.send("Welcome to " + member.guild.name + ", " + member + "!")

My previous on_member_join event worked fine, but for some reason it doesn’t anymore. I have tried updating to discord.py 1.5. Any help would be greatly appreciated.

I am getting no errors.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

discord.py 1.5.0 now supports discord API’s Privileged Gateway Intents. In order to be able to exploit server data, you need to:

Discord.py: on_member_join suddenly stopped working

intents = Intents.all()

#If you use commands.Bot()
bot = commands.Bot(command_prefix="!", intents=intents)

#If you use discord.Client()
client = discord.Client(intents=intents)


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x