Fix join listeners

This commit is contained in:
Choco
2023-03-20 11:01:21 +08:00
parent c94c65e404
commit 08985db659

View File

@@ -51,17 +51,27 @@ class Nodes(commands.Cog):
if member.bot: if member.bot:
return return
is_joined = True if before.channel == after.channel:
if before.channel and after.channel: return
guild = after.channel.guild.id
elif not before.channel and after.channel: player: voicelink.Player = member.guild.voice_client
guild = after.channel.guild.id if not player:
return
guild = member.guild.id
is_joined = True
if not before.channel and after.channel:
if after.channel.id != player.channel.id:
return
elif before.channel and not after.channel: elif before.channel and not after.channel:
guild = before.channel.guild.id
is_joined = False is_joined = False
elif before.channel and after.channel:
if after.channel.id != player.channel.id:
is_joined = False
await self.bot.ipc.send({ await self.bot.ipc.send({
"op": "updateGuild", "op": "updateGuild",
"user": { "user": {