From bce9abd10ad400ddb32c266b6f1152cf44a70654 Mon Sep 17 00:00:00 2001 From: norohind <60548839+norohind@users.noreply.github.com> Date: Sun, 22 May 2022 22:27:32 +0300 Subject: [PATCH] Don't connect if synth message from user from another voice channel, fix q drop --- cogs/TTSCore.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cogs/TTSCore.py b/cogs/TTSCore.py index 42bf4f6..bd68a8c 100644 --- a/cogs/TTSCore.py +++ b/cogs/TTSCore.py @@ -85,6 +85,10 @@ class TTSCore(commands.Cog, Observ.Observer): if voice_client is None: voice_client: discord.VoiceClient = await user_voice_state.channel.connect() + if user_voice_state.channel.id != voice_client.channel.id: + await message.channel.send('We are in different voice channels') + return + speaker: Speakers = self.speakers_adapter.get_speaker(message.guild.id, message.author.id) # check if message will fail on synthesis @@ -123,6 +127,9 @@ class TTSCore(commands.Cog, Observ.Observer): def queue_player(self, message: discord.Message): for sound_source in self.tts_queues[message.guild.id]: + if len(self.tts_queues[message.guild.id]) == 0: + return + voice_client: Optional[discord.VoiceClient] = message.guild.voice_client if voice_client is None: # don't play anything and clear queue for whole guild