Skip to content

Commit

Permalink
Added start parameter to player.play.
Browse files Browse the repository at this point in the history
Bumped version.
  • Loading branch information
EvieePy committed Feb 3, 2020
1 parent e1b40a8 commit a1bd184
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 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 (c) EvieePy'
__version__ = '0.3.05'
__version__ = '0.3.06'

from .client import Client
from .errors import *
Expand Down
10 changes: 8 additions & 2 deletions wavelink/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ async def disconnect(self):
self.channel_id = None
await self._get_shard_socket(guild.shard_id).voice_state(self.guild_id, None)

async def play(self, track: Track, *, replace: bool=True):
async def play(self, track: Track, *, replace: bool = True, start: int = 0):
"""|coro|
Play a WaveLink Track.
Expand All @@ -218,6 +218,8 @@ async def play(self, track: Track, *, replace: bool=True):
The :class:`Track` to initiate playing.
replace: bool
Whether or not the current track, if there is one, should be replaced or not. Defaults to True.
start: int
The position to start the player from in milliseconds
"""
self.last_update = 0
self.last_position = 0
Expand All @@ -227,7 +229,11 @@ async def play(self, track: Track, *, replace: bool=True):
no_replace = not replace

self.current = track
await self.node._send(op='play', guildId=str(self.guild_id), track=track.id, noReplace=no_replace)
await self.node._send(op='play',
guildId=str(self.guild_id),
track=track.id,
noReplace=no_replace,
startTime=str(start))
__log__.debug(f'PLAYER | Started playing track:: {str(track)} ({self.channel_id})')

async def stop(self):
Expand Down

0 comments on commit a1bd184

Please sign in to comment.