From 77ce63b863989ce7dbef84752e2808a8e100bde7 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 24 Sep 2025 11:18:16 +0200 Subject: another vc fix --- cogs/vclogs.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cogs/vclogs.py b/cogs/vclogs.py index 01297a6..7bf179c 100644 --- a/cogs/vclogs.py +++ b/cogs/vclogs.py @@ -70,10 +70,14 @@ class VcLogs(commands.Cog): # Connect to the voice channel if not already connected voice_client = discord.utils.get(self.bot.voice_clients, guild=channel.guild) - if not isinstance(voice_client, discord.VoiceClient): - voice_client = await channel.connect() - elif voice_client.channel != channel: - await voice_client.move_to(channel) + try: + if not isinstance(voice_client, discord.VoiceClient): + voice_client = await channel.connect() + elif voice_client.channel != channel: + await voice_client.move_to(channel) + except discord.errors.ClientException as e: + if str(e) == "Not connected to voice.": + voice_client = await channel.connect() # Play the TTS audio if not voice_client.is_playing(): @@ -143,4 +147,4 @@ class VcLogs(commands.Cog): def setup(bot): - bot.add_cog(VcLogs(bot)) \ No newline at end of file + bot.add_cog(VcLogs(bot)) -- cgit v1.2.3