feature: add pause state, expose position on player
This commit is contained in:
parent
d3a75d1dab
commit
25d8b0f862
12
player.go
12
player.go
|
@ -12,6 +12,7 @@ type Player struct {
|
|||
guildID string
|
||||
time int
|
||||
position int
|
||||
paused bool
|
||||
manager *Lavalink
|
||||
node *Node
|
||||
handler EventHandler
|
||||
|
@ -60,6 +61,7 @@ func (player *Player) Stop() error {
|
|||
|
||||
// Pause will pause or resume the player, depending on the pause parameter
|
||||
func (player *Player) Pause(pause bool) error {
|
||||
player.paused = pause
|
||||
msg := message{
|
||||
Op: opPause,
|
||||
GuildID: player.guildID,
|
||||
|
@ -73,6 +75,11 @@ func (player *Player) Pause(pause bool) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// Paused returns whether or not the player is currently paused
|
||||
func (player *Player) Paused() bool {
|
||||
return player.paused
|
||||
}
|
||||
|
||||
// Seek will seek the player to the speicifed position, in millis
|
||||
func (player *Player) Seek(position int) error {
|
||||
msg := message{
|
||||
|
@ -88,6 +95,11 @@ func (player *Player) Seek(position int) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// Position returns the player's position, as reported by Lavalink
|
||||
func (player *Player) Position() int {
|
||||
return player.position
|
||||
}
|
||||
|
||||
// Volume will set the player's volume to the specified value
|
||||
//
|
||||
// volume must be within [0, 1000]
|
||||
|
|
Loading…
Reference in New Issue