working on #7

This commit is contained in:
Logan Cusano
2025-07-14 20:37:12 -04:00
parent 042495cde2
commit b5191ef4d0
2 changed files with 6 additions and 5 deletions

View File

@@ -135,10 +135,7 @@ class NoiseGate(AudioStream):
if error:
LOGGER.warning(error)
while not voice_connection.is_connected():
time.sleep(.2)
if not voice_connection.is_playing():
if voice_connection.is_connected() and not voice_connection.is_playing():
LOGGER.debug("Playing stream to discord")
voice_connection.play(self.NGStream, after=self.core)
@@ -187,7 +184,7 @@ class NoiseGateStream(discord.AudioSource):
if curr_buffer:
return bytes(curr_buffer)
except OSError as e:
except Exception as e:
LOGGER.warning(e)
pass

View File

@@ -47,6 +47,10 @@ class DiscordBotManager:
print(f"{member.name} joined voice channel {after.channel.name}")
self._voice_ready_event.set()
@self.bot.event
async def on_disconnect():
LOGGER.warning("Bot has been disconnected from Discord.")
# Load Opus for the current CPU
await self.load_opus()