Skip to content

Commit

Permalink
Fix a bug with player.is_playing returning True when there is no Tr…
Browse files Browse the repository at this point in the history
…ack.

`player.play(track=..., replace=False)` should no longer effect internals when there is a current track playing.
  • Loading branch information
EvieePy committed Feb 5, 2020
1 parent 2355a8c commit 50c0403
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions wavelink/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

from .errors import *
from .eqs import *
from .events import TrackStart
from .events import *


__log__ = logging.getLogger(__name__)
Expand Down Expand Up @@ -168,7 +168,8 @@ async def _dispatch_voice_update(self):
await self.node._send(op='voiceUpdate', guildId=str(self.guild_id), **self._voice_state)

async def hook(self, event):
pass
if isinstance(event, (TrackEnd, TrackException, TrackStuck)):
self.current = None

def _get_shard_socket(self, shard_id: int) -> Optional[DiscordWebSocket]:
if isinstance(self.bot, commands.AutoShardedBot):
Expand Down Expand Up @@ -225,10 +226,13 @@ async def play(self, track: Track, *, replace: bool = True, start: int = 0, end:
The position to end the track on in milliseconds. By default this always allows the current
song to finish playing.
"""
self.last_update = 0
self.last_position = 0
self.position_timestamp = 0
self.paused = False
if replace or not self.is_playing:
self.last_update = 0
self.last_position = 0
self.position_timestamp = 0
self.paused = False
else:
return

no_replace = not replace

Expand Down

0 comments on commit 50c0403

Please sign in to comment.