所以基本上,我有一个频道,名称是服务器的成员数。现在,无论何时有人加入或离开,它都会将名称更新为“成员数:guild.member_count”。 On_member_join工作正常,但是on_member_remove会在有人加入时调用,但永远不会结束,即使加入和删除的代码基本相同
@client.event
async def on_member_remove(member):
print('on_member_remove called')
count_channel = client.get_channel(ID)
await count_channel.edit(name = 'Member count: {}'.format(count_channel.guild.member_count))
print('on_member_remove finished')
在这一步中,on_member_remove完成不会打印,并且在on_member_join时一切正常 on_member_join的代码:
@client.event
async def on_member_join(member):
print('on_member_joim called')
count_channel = client.get_channel(ID)
await count_channel.edit(name = 'Member count: {}'.format(count_channel.guild.member_count))
print('on_member_join finished')