Fixed channels logic

This commit is contained in:
Profitroll 2023-05-02 16:13:11 +02:00
parent 740c6a1464
commit 91eecb4b0b

View File

@ -40,26 +40,18 @@ class CogChannel(commands.Cog):
vc_from = before.channel
vc_to = after.channel
category = member.guild.get_channel(guildConfGet(member.guild, "category"))
# If user left vc
if after.channel is None and before.channel.category == category and len(before.channel.members) == 0:
if before.channel is not None and len(before.channel.members) == 0:
if isUserVoice(vc_from):
if isVoiceOfUser(vc_from, member):
await removeUserVoice(vc_from)
return
else:
if loadJson("config.json")["enable_nomic"]:
await changeNomicPerms("deny", vc_from, member)
# If user joined vc
if after.channel is not None and after.channel.id == guildConfGet(member.guild, "channel"):
if isUserVoice(vc_from):
if isVoiceOfUser(vc_from, member):
await removeUserVoice(vc_from)
else:
if loadJson("config.json")["enable_nomic"]:
await changeNomicPerms("deny", vc_from, member)
if isUserVoice(vc_to):
if loadJson("config.json")["enable_nomic"]:
await changeNomicPerms("allow", vc_to, member)