【问题标题】:Member Leave Message - Discord.py会员留言 - Discord.py
【发布时间】:2021-02-03 18:35:50
【问题描述】:

在发送会员留言时,我查看了所有我能找到的帖子都引用了旧版本的 discord.py。下面的代码不会给出错误,但也不会在成员离开服务器时发送消息。我错过了什么吗?我查看了文档,这是有道理的......

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).")

【问题讨论】:

    标签: python python-3.x discord discord.py


    【解决方案1】:

    我中风了,忘记在上面添加@client.event -_- 工作代码:

    @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).")
    

    【讨论】:

      猜你喜欢
      • 2021-02-13
      • 2021-08-13
      • 1970-01-01
      • 2020-03-18
      • 2021-12-17
      • 2021-02-27
      • 2021-03-14
      • 2022-06-30
      • 2021-06-06
      相关资源
      最近更新 更多