Merge pull request #36 from NiceAesth/position-hotfix

fix: clean up `Player.position()`
This commit is contained in:
Clxud 2023-03-11 11:27:19 -05:00 committed by GitHub
commit 5aea4bcaf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -165,10 +165,12 @@ class Player(VoiceProtocol):
@property
def position(self) -> float:
"""Property which returns the player's position in a track in milliseconds"""
if not self.is_playing or not self._current:
if not self.is_playing:
return 0
current = getattr(self._current, "original", self._current)
current: Track = self._current # type: ignore
if current.original:
current = current.original
if self.is_paused:
return min(self._last_position, current.length)