#๐Ÿ”’ send a message when user joins server

18 messages ยท Page 1 of 1 (latest)

tulip prawn
#
@bot.event
async def on_member_join(mb):
    channelv0 = discord.utils.get(mb.guild.channels, name = ":wave:wellcome-goodbye")
    await channelv0.send(f"Welcome to server, <@{mb.id}>")```

it doesnt gives any error but doesnt sends anything, the bot has admin role
prime hemlockBOT
#

@tulip prawn

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

narrow echo
#

Have you enabled member intents?

#

both in the code in dev portal

tulip prawn
#

yes

#

i have all intents enabled on both

narrow echo
#

then try and put a print statement in there

#

check what does channelv0 returns

tulip prawn
#

hmm

narrow echo
#

!d discord.on_member_join

prime hemlockBOT
#

discord.on_member_join(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member) joins a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild).

This requires [`Intents.members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.members) to be enabled.
tulip prawn
#

oh nvm

#

it works now

#

thanks

remote phoenix
tulip prawn
#

!close

prime hemlockBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.