From 2fd6d25b7bf3ffa94f5d5ea023a7ec66bf9241c6 Mon Sep 17 00:00:00 2001
From: Christopher F <foxbot@protonmail.com>
Date: Sat, 25 Aug 2018 22:24:56 -0400
Subject: [PATCH] feature: add volume cache to player

---
 node.go   | 1 +
 player.go | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/node.go b/node.go
index f973cb5..d134154 100644
--- a/node.go
+++ b/node.go
@@ -158,6 +158,7 @@ func (node *Node) CreatePlayer(guildID string, sessionID string, event VoiceServ
 		manager: node.manager,
 		node:    node,
 		handler: handler,
+		vol:     100,
 	}
 	node.manager.players[guildID] = player
 	return player, nil
diff --git a/player.go b/player.go
index ad57881..e3da9c7 100644
--- a/player.go
+++ b/player.go
@@ -13,6 +13,7 @@ type Player struct {
 	time     int
 	position int
 	paused   bool
+	vol      int
 	manager  *Lavalink
 	node     *Node
 	handler  EventHandler
@@ -111,6 +112,8 @@ func (player *Player) Volume(volume int) error {
 		return errVolumeOutOfRange
 	}
 
+	player.vol = volume
+
 	msg := message{
 		Op:      opVolume,
 		GuildID: player.guildID,
@@ -124,6 +127,11 @@ func (player *Player) Volume(volume int) error {
 	return err
 }
 
+// GetVolume gets the player's volume level
+func (player *Player) GetVolume() int {
+	return player.vol
+}
+
 // Forward will forward a new VOICE_SERVER_UPDATE to a Lavalink node for
 // this player.
 //