Skip to content
This repository was archived by the owner on Apr 5, 2025. It is now read-only.

Commit 88428df

Browse files
authored
Ensure current returns 0 position if None
1 parent fdbaead commit 88428df

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

wavelink/player.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ def position(self):
125125
if not self.is_playing:
126126
return 0
127127

128+
if not self.current:
129+
return 0
130+
128131
if self.paused:
129132
return min(self.last_position, self.current.duration)
130133

@@ -223,9 +226,9 @@ async def play(self, track: Track, *, replace: bool=True):
223226

224227
no_replace = not replace
225228

229+
self.current = track
226230
await self.node._send(op='play', guildId=str(self.guild_id), track=track.id, noReplace=no_replace)
227231
__log__.debug(f'PLAYER | Started playing track:: {str(track)} ({self.channel_id})')
228-
self.current = track
229232

230233
async def stop(self):
231234
"""|coro|

0 commit comments

Comments
 (0)