working on #7
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user