Channel will terminate when the last user quit
This commit is contained in:
36
functions.py
36
functions.py
@@ -253,31 +253,45 @@ async def removeUserVoice(vc: VoiceChannel) -> None:
|
||||
nomic_channel = utils.get(vc.guild.channels, id=vc_conf["nomic"])
|
||||
|
||||
remove(vc_file)
|
||||
|
||||
await needed_channel.delete()
|
||||
if debug:
|
||||
appendLog(
|
||||
f"Removed voice channel '{needed_channel}' ({str(needed_channel.id)}) of user with id {str(vc_conf['ownerid'])}",
|
||||
guild=vc.guild,
|
||||
)
|
||||
else:
|
||||
|
||||
if needed_channel is None:
|
||||
appendLog(
|
||||
f"Removed voice channel '{needed_channel}' of user with id {str(vc_conf['ownerid'])}",
|
||||
guild=vc.guild,
|
||||
)
|
||||
else:
|
||||
await needed_channel.delete()
|
||||
|
||||
if loadJson("config.json")["enable_nomic"]:
|
||||
await nomic_channel.delete()
|
||||
if debug:
|
||||
appendLog(
|
||||
f"Removed nomic channel {nomic_channel} ({str(nomic_channel.id)}) of channel with id {str(needed_channel.id)}",
|
||||
f"Removed voice channel '{needed_channel}' ({str(needed_channel.id)}) of user with id {str(vc_conf['ownerid'])}",
|
||||
guild=vc.guild,
|
||||
)
|
||||
else:
|
||||
appendLog(
|
||||
f"Removed voice channel '{needed_channel}' of user with id {str(vc_conf['ownerid'])}",
|
||||
guild=vc.guild,
|
||||
)
|
||||
|
||||
if loadJson("config.json")["enable_nomic"]:
|
||||
if nomic_channel is None:
|
||||
appendLog(
|
||||
f"Removed nomic channel '{nomic_channel}' of channel with id {str(needed_channel.id)}",
|
||||
guild=vc.guild,
|
||||
)
|
||||
else:
|
||||
await nomic_channel.delete()
|
||||
|
||||
if debug:
|
||||
appendLog(
|
||||
f"Removed nomic channel '{nomic_channel}' ({str(nomic_channel.id)}) of channel with id {str(needed_channel.id)}",
|
||||
guild=vc.guild,
|
||||
)
|
||||
else:
|
||||
appendLog(
|
||||
f"Removed nomic channel '{nomic_channel}' of channel with id {str(needed_channel.id)}",
|
||||
guild=vc.guild,
|
||||
)
|
||||
else:
|
||||
return
|
||||
|
||||
|
Reference in New Issue
Block a user