Skip to content

Commit

Permalink
Merge pull request #61 from Zenrac/start_time
Browse files Browse the repository at this point in the history
Start time
  • Loading branch information
devoxin committed Dec 10, 2018
2 parents a9be831 + a6c67b0 commit 7beb8d6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lavalink/models.py
Expand Up @@ -190,13 +190,16 @@ def add(self, requester: int, track: dict, index: int = None):
else:
self.queue.insert(index, AudioTrack.build(track, requester))

async def play(self, track: AudioTrack = None):
async def play(self, track: AudioTrack = None, start_time: int = 0):
"""
Plays the given track.
----------
:param track:
The track to play. If left unspecified, this will default
to the first track in the queue.
:param start_time:
Setting that determines the number of milliseconds to offset the track by.
If left unspecified, it will start the track at its beginning.
"""
if self.repeat and self.current:
self.queue.append(self.current)
Expand All @@ -219,7 +222,7 @@ async def play(self, track: AudioTrack = None):
track = self.queue.pop(0)

self.current = track
await self.node._send(op='play', guildId=self.guild_id, track=track.track)
await self.node._send(op='play', guildId=self.guild_id, track=track.track, startTime=start_time)
await self.node._dispatch_event(TrackStartEvent(self, track))

async def stop(self):
Expand Down

0 comments on commit 7beb8d6

Please sign in to comment.