@client.event async def on_member_leave(member): print("member has left a server.")
Here is what the above code is Doing:
1. We’re importing the discord.py library.
2. We’re creating a new client object.
3. We’re defining a function that will be called when the bot is ready.
4. We’re defining a function that will be called when a member leaves a server.
5. We’re running the client object.