From 746f26291f13c59e86e299da9330f1a83c0eb9a2 Mon Sep 17 00:00:00 2001 From: Christopher F Date: Thu, 23 Aug 2018 21:20:54 -0400 Subject: [PATCH] fix: pause, position, volume should be ptrs prevents encoding/json from omitting these values when set to falsy real data (false, 0) --- model.go | 6 +++--- player.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/model.go b/model.go index 66d722d..98221cb 100644 --- a/model.go +++ b/model.go @@ -76,9 +76,9 @@ type message struct { Track string `json:"track,omitempty"` StartTime string `json:"startTime,omitempty"` EndTime string `json:"endTime,omitempty"` - Pause bool `json:"pause,omitempty"` - Position int `json:"position,omitempty"` - Volume int `json:"volume,omitempty"` + Pause *bool `json:"pause,omitempty"` + Position *int `json:"position,omitempty"` + Volume *int `json:"volume,omitempty"` State *state `json:"state,omitempty"` Type string `json:"type,omitempty"` Reason string `json:"reason,omitempty"` diff --git a/player.go b/player.go index 9200dde..57520cd 100644 --- a/player.go +++ b/player.go @@ -65,7 +65,7 @@ func (player *Player) Pause(pause bool) error { msg := message{ Op: opPause, GuildID: player.guildID, - Pause: pause, + Pause: &pause, } data, err := json.Marshal(msg) if err != nil { @@ -85,7 +85,7 @@ func (player *Player) Seek(position int) error { msg := message{ Op: opSeek, GuildID: player.guildID, - Position: position, + Position: &position, } data, err := json.Marshal(msg) if err != nil { @@ -111,7 +111,7 @@ func (player *Player) Volume(volume int) error { msg := message{ Op: opVolume, GuildID: player.guildID, - Volume: volume, + Volume: &volume, } data, err := json.Marshal(msg) if err != nil {