简体   繁体   中英

Member Leave Message - Discord.py

I've looked and all the posts I could find reference an older version of discord.py when it comes to sending member leave messages. The code below doesn't give an error, yet also doesn't send a message when a member leaves a server. Am I missing something? I've looked at the documentation and this makes sense...

async def on_member_remove(member):
    channel = client.get_channel(762921541787975686)
    await channel.send(f"{member} quit on the 1 yard line (left the server).")

I had a stroke and forgot to add @client.event above it -_- Working code:

@client.event
async def on_member_remove(member):
    channel = client.get_channel(762921541787975686)
    await channel.send(f"{member} quit on the 1 yard line (left the server).")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM