fix: pause, position, volume should be ptrs

prevents encoding/json from omitting these values when
set to falsy real data (false, 0)
This commit is contained in:
Christopher F 2018-08-23 21:20:54 -04:00
parent 59811adafe
commit 746f26291f
2 changed files with 6 additions and 6 deletions

View File

@ -76,9 +76,9 @@ type message struct {
Track string `json:"track,omitempty"` Track string `json:"track,omitempty"`
StartTime string `json:"startTime,omitempty"` StartTime string `json:"startTime,omitempty"`
EndTime string `json:"endTime,omitempty"` EndTime string `json:"endTime,omitempty"`
Pause bool `json:"pause,omitempty"` Pause *bool `json:"pause,omitempty"`
Position int `json:"position,omitempty"` Position *int `json:"position,omitempty"`
Volume int `json:"volume,omitempty"` Volume *int `json:"volume,omitempty"`
State *state `json:"state,omitempty"` State *state `json:"state,omitempty"`
Type string `json:"type,omitempty"` Type string `json:"type,omitempty"`
Reason string `json:"reason,omitempty"` Reason string `json:"reason,omitempty"`

View File

@ -65,7 +65,7 @@ func (player *Player) Pause(pause bool) error {
msg := message{ msg := message{
Op: opPause, Op: opPause,
GuildID: player.guildID, GuildID: player.guildID,
Pause: pause, Pause: &pause,
} }
data, err := json.Marshal(msg) data, err := json.Marshal(msg)
if err != nil { if err != nil {
@ -85,7 +85,7 @@ func (player *Player) Seek(position int) error {
msg := message{ msg := message{
Op: opSeek, Op: opSeek,
GuildID: player.guildID, GuildID: player.guildID,
Position: position, Position: &position,
} }
data, err := json.Marshal(msg) data, err := json.Marshal(msg)
if err != nil { if err != nil {
@ -111,7 +111,7 @@ func (player *Player) Volume(volume int) error {
msg := message{ msg := message{
Op: opVolume, Op: opVolume,
GuildID: player.guildID, GuildID: player.guildID,
Volume: volume, Volume: &volume,
} }
data, err := json.Marshal(msg) data, err := json.Marshal(msg)
if err != nil { if err != nil {