add param for play noReplace
This commit is contained in:
parent
5d6c50f11e
commit
db9f1cfba3
|
|
@ -209,7 +209,13 @@ class Player(VoiceProtocol):
|
||||||
await self.disconnect()
|
await self.disconnect()
|
||||||
await self._node.send(op="destroy", guildId=str(self.guild.id))
|
await self._node.send(op="destroy", guildId=str(self.guild.id))
|
||||||
|
|
||||||
async def play(self, track: Track, *, start_position: int = 0) -> Track:
|
async def play(
|
||||||
|
self,
|
||||||
|
track: Track,
|
||||||
|
*,
|
||||||
|
start_position: int = 0,
|
||||||
|
ignore_if_playing: bool = False
|
||||||
|
) -> Track:
|
||||||
"""Plays a track. If a Spotify track is passed in, it will be handled accordingly."""
|
"""Plays a track. If a Spotify track is passed in, it will be handled accordingly."""
|
||||||
if track.spotify:
|
if track.spotify:
|
||||||
search: Track = (await self._node.get_tracks(
|
search: Track = (await self._node.get_tracks(
|
||||||
|
|
@ -224,7 +230,7 @@ class Player(VoiceProtocol):
|
||||||
track=search.track_id,
|
track=search.track_id,
|
||||||
startTime=start_position,
|
startTime=start_position,
|
||||||
endTime=search.length,
|
endTime=search.length,
|
||||||
noReplace=False
|
noReplace=ignore_if_playing
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
await self._node.send(
|
await self._node.send(
|
||||||
|
|
@ -233,7 +239,7 @@ class Player(VoiceProtocol):
|
||||||
track=track.track_id,
|
track=track.track_id,
|
||||||
startTime=start_position,
|
startTime=start_position,
|
||||||
endTime=track.length,
|
endTime=track.length,
|
||||||
noReplace=False
|
noReplace=ignore_if_playing
|
||||||
)
|
)
|
||||||
self._current = track
|
self._current = track
|
||||||
return self._current
|
return self._current
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue