【发布时间】:2021-05-08 07:51:08
【问题描述】:
所以我查看了许多消息来源说on_guild_leave 是它的使用方式,但我无法让它工作。这是我的代码:
@client.event
async def on_guild_join(guild): # noqa
try:
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"{len(client.guilds)} Servers | !help"))
except Exception as e:
print(e)
@client.event
async def on_guild_leave(guild): # noqa
try:
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"{len(client.guilds)} Servers | !help"))
except Exception as e:
print(e)
有人可以帮忙吗?
on_guild_join 有效,但 on_guild_leave 无效。
【问题讨论】:
-
出现任何错误?
-
@hardlander 不,没有错误,我什至让 Exception 打印异常,但它从来没有放一个,但从来没有为
on_guild_leave工作
标签: python python-3.x discord bots discord.py