1
0
Fork 0
mirror of synced 2024-05-19 20:12:30 +12:00

Reorder a few things in the next_song method too ensure we set the song

This commit is contained in:
Phxntxm 2017-06-11 14:28:58 -05:00
parent 14d6cc5e20
commit 0f2f9b628a

View file

@ -109,7 +109,7 @@ class VoiceState:
async def next_song(self):
if not self.user_queue:
song = await self.songs.get_next_entry()
self.current = await self.songs.get_next_entry()
else:
try:
dj = self.djs.popleft()
@ -118,22 +118,22 @@ class VoiceState:
self.dj = None
else:
song = await dj.get_next_entry()
# Add an extra check here in case in the very short period of time possible, someone has queued a
# song while we are downloading the next...which caused 2 play calls to be done
# The 2nd may be called while the first has already started playing...this check is for that 2nd one
# If this rare case does happen, we want to insert this dj back into the deque at the front
# Also rotate their songs back, since it shouldn't have been retrieved
if self.playing:
self.djs.insert(0, dj)
dj.entries.rotate()
return
if song is None:
return await self.next_song()
else:
song.requester = dj.member
# Add an extra check here in case in the very short period of time possible, someone has queued a
# song while we are downloading the next
if not self.playing:
self.dj = dj
# If this rare case does happen, we want to insert this dj back into the deque at the front
else:
self.djs.insert(0, dj)
if not self.playing:
self.current = song
self.current = current
class Music: