Someone
Someone

Reputation: 84

On_member_join and on_member_leave not working discord.py

I've got on_member_joion and on_member_leave code, and it's not working, this is my code:

intents = discord.Intents.default()
intents.members = True
botprefix = ","
bot = commands.Bot(command_prefix = botprefix, case_insensitive=True, intents = intents)

@bot.event
async def on_mmember_join(member):
  channel = bot.get_channel(803616331835899934)
  await channel.send(f"Witaj {member.mention} na serwerze **Pogaduszki!**")

@bot.event
async def on_member_leave(member):
  channel = bot.get_channel(803616331835899934)
  await channel.send(f"Żegnamy {member.mention}, mamy nadzieję że do nas wrócisz")

And this code is not working, there are no errors, can anyone help please?? PS: I'm using https://replit.com

Upvotes: 0

Views: 332

Answers (1)

Dominik
Dominik

Reputation: 3592

You have an error with your join event. It should be on_member_join and not on_mmember_join.

Also, you should consider not using on_member_leave but on_member_remove.

Your full code:

@bot.event
async def on_member_join(member):
  channel = bot.get_channel(803616331835899934)
  await channel.send(f "Witaj {member.mention} na serwerze **Pogaduszki!**")

@bot.event
async def on_member_remove(member):
  channel = bot.get_channel(803616331835899934)
  await channel.send(f "Żegnamy {member.mention}, mamy nadzieję że do nas wrócisz")

Also have a look at the docs for more: on_member_remove()

Upvotes: 2

Related Questions