working on #7
This commit is contained in:
@@ -135,10 +135,7 @@ class NoiseGate(AudioStream):
|
|||||||
if error:
|
if error:
|
||||||
LOGGER.warning(error)
|
LOGGER.warning(error)
|
||||||
|
|
||||||
while not voice_connection.is_connected():
|
if voice_connection.is_connected() and not voice_connection.is_playing():
|
||||||
time.sleep(.2)
|
|
||||||
|
|
||||||
if not voice_connection.is_playing():
|
|
||||||
LOGGER.debug("Playing stream to discord")
|
LOGGER.debug("Playing stream to discord")
|
||||||
voice_connection.play(self.NGStream, after=self.core)
|
voice_connection.play(self.NGStream, after=self.core)
|
||||||
|
|
||||||
@@ -187,7 +184,7 @@ class NoiseGateStream(discord.AudioSource):
|
|||||||
if curr_buffer:
|
if curr_buffer:
|
||||||
return bytes(curr_buffer)
|
return bytes(curr_buffer)
|
||||||
|
|
||||||
except OSError as e:
|
except Exception as e:
|
||||||
LOGGER.warning(e)
|
LOGGER.warning(e)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ class DiscordBotManager:
|
|||||||
print(f"{member.name} joined voice channel {after.channel.name}")
|
print(f"{member.name} joined voice channel {after.channel.name}")
|
||||||
self._voice_ready_event.set()
|
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
|
# Load Opus for the current CPU
|
||||||
await self.load_opus()
|
await self.load_opus()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user