1 回答

TA貢獻(xiàn)1873條經(jīng)驗 獲得超9個贊
您有 2 個名為:“on_voice_state_update”的“def”,因此當(dāng)此事件發(fā)生時,機器人不知道他必須調(diào)用哪一個。刪除 2 個“def”之一,并僅在一個名為“on_voice_state_update”的“def”中執(zhí)行您想要的操作。
@client.event
async def on_voice_state_update(member, before, after):
if before.channel is None and after.channel is not None:
if after.channel.id == [""Channel ID 1""] or after.channel.id == [""Channel ID 2""]:
await client.change_presence(status=discord.Status.online, activity=discord.Activity(type=discord.ActivityType.listening, name="users | Ready to mute"))
print("Bot done0")
print(member, "joined")
elif before.channel is not None and after.channel is None:
if before.channel.id == [""Channel ID 1""] or before.channel.id == [""Channel ID 2""]:
await client.change_presence(status=discord.Status.offline)
print("Bot done1")
print(member, "left")
添加回答
舉報