Skip to content

Commit

Permalink
Merge pull request #113 from MujyKun/master
Browse files Browse the repository at this point in the history
When replacing a Track, the Player will now display the proper track
  • Loading branch information
EvieePy authored Jul 13, 2021
2 parents eda26c8 + dfc4f58 commit 85c68e4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion wavelink/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ def __init__(self, bot: Union[commands.Bot, commands.AutoShardedBot], guild_id:
self._equalizer = Equalizer.flat()
self.channel_id = None

self._new_track = False

@property
def equalizer(self):
"""The currently applied Equalizer."""
Expand Down Expand Up @@ -239,8 +241,9 @@ async def _dispatch_voice_update(self) -> None:
await self.node._send(op='voiceUpdate', guildId=str(self.guild_id), **self._voice_state)

async def hook(self, event) -> None:
if isinstance(event, TrackEnd):
if isinstance(event, TrackEnd) and not self._new_track:
self.current = None
self._new_track = False

def _get_shard_socket(self, shard_id: int) -> Optional[DiscordWebSocket]:
if isinstance(self.bot, commands.AutoShardedBot):
Expand Down Expand Up @@ -316,6 +319,9 @@ async def play(self, track: Track, *, replace: bool = True, start: int = 0, end:

no_replace = not replace

if self.current:
self._new_track = True

self.current = track

payload = {'op': 'play',
Expand Down

0 comments on commit 85c68e4

Please sign in to comment.