小编PGi*_*ner的帖子

Python Discord,检查会员状态

我想在我的不和谐机器人中实现一个功能,检查是否有任何成员离线,然后执行以下功能。我已经阅读了 API 参考页面,但不太明白如何去做,像这样的东西会起作用吗?

client = discord.Client()

@client.event
async def on_member_update(before, after):
    if before == online:
        if after == offline:
            print("{} has gone offline.".format(member))
Run Code Online (Sandbox Code Playgroud)

我不认为代码会按预期工作,但它可能会为我的目标提供一些指导。

python discord discord.py

2
推荐指数
1
解决办法
9145
查看次数

标签 统计

discord ×1

discord.py ×1

python ×1