From 1af7ddfd8e60fe4860b15c375884f6e38e782bea Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 1 Oct 2025 17:18:12 +0200 Subject: try except statement for vclogs --- cogs/vclogs.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'cogs') diff --git a/cogs/vclogs.py b/cogs/vclogs.py index 7bf179c..01297a6 100644 --- a/cogs/vclogs.py +++ b/cogs/vclogs.py @@ -70,14 +70,10 @@ 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) - 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() + if not isinstance(voice_client, discord.VoiceClient): + voice_client = await channel.connect() + elif voice_client.channel != channel: + await voice_client.move_to(channel) # Play the TTS audio if not voice_client.is_playing(): @@ -147,4 +143,4 @@ class VcLogs(commands.Cog): def setup(bot): - bot.add_cog(VcLogs(bot)) + bot.add_cog(VcLogs(bot)) \ No newline at end of file -- cgit v1.2.3