Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I get current guild ID in on_member_join

I'm making bot that will be on 3~4 servers,

and I was working on welcome messages.

I saw this post : Discord.py welcome message for multiple servers and doing that way but there were some errors, I'm doing my way.

but eventually i stuck to a problem that I can't get guild id in on_member_joined.

using discord.py 1.4.2

please help me.

any suggestion appreciated.

like image 613
weinus Avatar asked Dec 31 '25 08:12

weinus


1 Answers

The Member object has a guild attribute use that to get the `id.

@bot.event
async def on_member_join(member):
    print(member.guild.id)
    print(member.guild.name)

Docs:

  • Member.guild
  • on_member_join
like image 136
Abdulaziz Avatar answered Jan 02 '26 21:01

Abdulaziz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!