From 25d8b0f862d230d75bdf0cdce727dfd9e9014066 Mon Sep 17 00:00:00 2001 From: Christopher F Date: Thu, 23 Aug 2018 18:40:36 -0400 Subject: [PATCH] feature: add pause state, expose position on player --- player.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/player.go b/player.go index affa9eb..c916815 100644 --- a/player.go +++ b/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]