Fixed autoplay with empty queue
This commit addresses the issue where autoplay was being activated even when the history queue had no tracks. The problem has been resolved to ensure smooth user experience
This commit is contained in:
@@ -704,11 +704,14 @@ class Player(VoiceProtocol):
|
||||
async def get_recommendations(self, *, track: Track = None) -> bool:
|
||||
"""Get recommendations from Youtube or Spotify."""
|
||||
if not track:
|
||||
track = choice(self.queue.history(incTrack=True)[-5:])
|
||||
|
||||
try:
|
||||
track = choice(self.queue.history(incTrack=True)[-5:])
|
||||
except IndexError:
|
||||
return False
|
||||
|
||||
if track.spotify:
|
||||
spotify_tracks = await self._node._spotify_client.similar_track(seed_tracks=track.identifier)
|
||||
|
||||
|
||||
tracks = [
|
||||
Track(
|
||||
track_id=None,
|
||||
|
||||
Reference in New Issue
Block a user