Wait for the bot to connect before playing audio

This commit is contained in:
Logan Cusano
2022-03-31 22:52:10 -04:00
parent d3a18c2421
commit 25ad3b076c

View File

@@ -133,10 +133,13 @@ class NoiseGate(AudioStream):
def core(self, error=None):
if error:
LOGGER.warning(error)
if voice_connection.is_connected():
if not voice_connection.is_playing():
LOGGER.debug(f"Playing stream to discord")
voice_connection.play(self.NGStream, after=self.core)
while not voice_connection.is_connected():
time.sleep(.2)
if not voice_connection.is_playing():
LOGGER.debug(f"Playing stream to discord")
voice_connection.play(self.NGStream, after=self.core)
async def close(self):
LOGGER.debug(f"Closing")