From fa56e49d94740c4715c0330cbf351007a2d8c4f0 Mon Sep 17 00:00:00 2001 From: Alexander Terry Date: Mon, 11 Sep 2023 19:48:17 -0800 Subject: [PATCH] leave channel on quit --- alexBot/cogs/voiceTTS.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/alexBot/cogs/voiceTTS.py b/alexBot/cogs/voiceTTS.py index e544aa0..fbdd69c 100644 --- a/alexBot/cogs/voiceTTS.py +++ b/alexBot/cogs/voiceTTS.py @@ -193,6 +193,9 @@ async def vc_tts(self, interaction: discord.Interaction, model: str): if interaction.user.id in self.runningTTS[interaction.guild_id].users and model == "QUIT": del self.runningTTS[interaction.guild_id].users[interaction.user.id] await interaction.response.send_message("ended your voice tts session.", ephemeral=True) + if len(self.runningTTS[interaction.guild_id].users) == 0: + await self.runningTTS[interaction.guild_id].voiceClient.disconnect() + del self.runningTTS[interaction.guild_id] return if interaction.user.voice.channel.id != self.runningTTS[interaction.guild_id].voiceClient.channel.id: await interaction.response.send_message(