joshiki
joshiki

Reputation: 177

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.

Upvotes: 1

Views: 1707

Answers (1)

MrSpaar
MrSpaar

Reputation: 3994

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:

enter image description here

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)

Upvotes: 3

Related Questions