From 872bbf2965e57b539d0f34cf89e21a9743763489 Mon Sep 17 00:00:00 2001 From: Logan Cusano Date: Fri, 2 May 2025 22:18:16 -0400 Subject: [PATCH] Ignore reconnection logic when disconnecting --- app/internal/bot_manager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/internal/bot_manager.py b/app/internal/bot_manager.py index c5b7a38..3dc14fc 100644 --- a/app/internal/bot_manager.py +++ b/app/internal/bot_manager.py @@ -46,6 +46,9 @@ class DiscordBotManager: # Check if the bot was disconnected if member == self.bot.user and after.channel is None: guild_id = before.channel.guild.id + if not self.voice_clients.get(guild_id): + LOGGER.info("Bot has left channel, reconnection ignored.") + return LOGGER.info(f"Bot was disconnected from channel in guild {guild_id}. Attempting to reconnect...") try: await self.leave_voice_channel(guild_id) @@ -129,7 +132,6 @@ class DiscordBotManager: except asyncio.TimeoutError: LOGGER.error("Timeout waiting for bot to join voice.") raise RuntimeError("Bot failed to join voice within timeout.") - async def leave_voice_channel(self, guild_id: int): if not self.bot: