Merge pull request #36 from NiceAesth/position-hotfix
fix: clean up `Player.position()`
This commit is contained in:
commit
5aea4bcaf2
|
|
@ -165,10 +165,12 @@ class Player(VoiceProtocol):
|
||||||
@property
|
@property
|
||||||
def position(self) -> float:
|
def position(self) -> float:
|
||||||
"""Property which returns the player's position in a track in milliseconds"""
|
"""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
|
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:
|
if self.is_paused:
|
||||||
return min(self._last_position, current.length)
|
return min(self._last_position, current.length)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue