M
M
Maruf2021-08-31 14:44:01
Python
Maruf, 2021-08-31 14:44:01

How to make the bot send a message when logged into the server?

Person1 entered the server at the invitation of Person2. how to implement it? I don't understand.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Mokhovikov, 2021-08-31
@Maruf995

Let it be through the asynchronous function on_member_join( member )
Documentation
Well, to be more precise, here is the code:

@client.event
async def on_member_join(member):
    guild = channel.get_guild(ID сервера)
    channel = guild.get_channel(ID канала с уведомлениями)
    await channel.send(f'Пользователь {member.mention} зашел на сервер!')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question