-
Notifications
You must be signed in to change notification settings - Fork 1
/
play_params.go
49 lines (39 loc) · 1.21 KB
/
play_params.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package waterlink
import (
"strconv"
"time"
)
// PlayParams contains optional parameters of the Guild.Play() method.
type PlayParams struct {
// StartTime is the time in milliseconds to start playing the track at.
StartTime time.Duration `json:"startTime,omitempty"`
// EndTime is the time in milliseconds to end playing the track at.
EndTime time.Duration `json:"endTime,omitempty"`
// Volume is the new volume of the player. The value must be between 0 and
// 1000. Defaults to 100.
Volume uint8 `json:"volume,omitempty"`
// NoReplace is the optional flag to not replace the current track.
NoReplace bool `json:"noReplace,omitempty"`
// Pause is the optional flag to pause the playback.
Pause bool `json:"pause,omitempty"`
}
// defaultPlayParams are the default PlayParams for the Guild.Play() method.
var defaultPlayParams = PlayParams{}
func (p PlayParams) startTime() string {
if p.StartTime == 0 {
return ""
}
return strconv.Itoa(int(p.StartTime.Milliseconds()))
}
func (p PlayParams) endTime() string {
if p.EndTime == 0 {
return ""
}
return strconv.Itoa(int(p.EndTime.Milliseconds()))
}
func (p PlayParams) volume() string {
if p.Volume == 0 {
return ""
}
return strconv.Itoa(int(p.Volume))
}