Skip to content

Commit

Permalink
Change logic in play (AutoPlay)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvieePy committed Feb 7, 2024
1 parent c32d867 commit c2a04db
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions wavelink/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,15 @@ async def _search(query: str | None) -> T_a:

logger.debug(f'Player "{self.guild.id}" added "{added}" tracks to the auto_queue via AutoPlay.')

if not self._current and self.auto_queue:
now: Playable = self.auto_queue.get()
self.auto_queue.history.put(now)
if not self._current:
try:
now: Playable = self.auto_queue.get()
self.auto_queue.history.put(now)

await self.play(now, add_history=False)
else:
logger.info(f'Player "{self.guild.id}" could not load any songs via AutoPlay.')
self._inactivity_start()
await self.play(now, add_history=False)
except wavelink.QueueEmpty:
logger.info(f'Player "{self.guild.id}" could not load any songs via AutoPlay.')
self._inactivity_start()

@property
def inactive_timeout(self) -> int | None:
Expand Down

0 comments on commit c2a04db

Please sign in to comment.