Skip to content

Commit

Permalink
Ensure player.position returns 0 at track start
Browse files Browse the repository at this point in the history
Bump version 0,7,2
  • Loading branch information
EvieePy committed May 16, 2020
1 parent 181fef7 commit a04a779
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion wavelink/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__author__ = 'EvieePy'
__license__ = 'MIT'
__copyright__ = 'Copyright 2019-2020 (c) PythonistaGuild'
__version__ = '0.7.1'
__version__ = '0.7.2'

from .client import Client
from .errors import *
Expand Down
7 changes: 6 additions & 1 deletion wavelink/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,12 @@ def position(self):
return min(self.last_position, self.current.duration)

difference = (time.time() * 1000) - self.last_update
return min(self.last_position + difference, self.current.duration)
position = self.last_position + difference

if position > self.current.duration:
return 0

return min(position, self.current.duration)

async def update_state(self, state: dict) -> None:
state = state['state']
Expand Down

0 comments on commit a04a779

Please sign in to comment.