diff --git a/ari/player.py b/ari/player.py index 957d3c8..f09a1ab 100644 --- a/ari/player.py +++ b/ari/player.py @@ -48,6 +48,8 @@ class Player: async def run(self): logger.info(f"{hash(self)} running player") self._running = True + + timeout = 60 while not self.queue.empty() and self.voice.is_connected() and self._running: music = self.queue.pop() if self._skip > 0: @@ -77,6 +79,13 @@ class Player: self.voice.stop() self._skip -= 1 break + if len(self.voice.channel.members) < 2: + timeout -= 1 + if timeout == 0: + logger.debug("player inactivity timeout") + self.stop() + else: + timeout = 60 await asyncio.sleep(1) except CacheError: await self.add_error(music)