feature: add pause state, expose position on player
This commit is contained in:
parent
d3a75d1dab
commit
25d8b0f862
12
player.go
12
player.go
|
@ -12,6 +12,7 @@ type Player struct {
|
||||||
guildID string
|
guildID string
|
||||||
time int
|
time int
|
||||||
position int
|
position int
|
||||||
|
paused bool
|
||||||
manager *Lavalink
|
manager *Lavalink
|
||||||
node *Node
|
node *Node
|
||||||
handler EventHandler
|
handler EventHandler
|
||||||
|
@ -60,6 +61,7 @@ func (player *Player) Stop() error {
|
||||||
|
|
||||||
// Pause will pause or resume the player, depending on the pause parameter
|
// Pause will pause or resume the player, depending on the pause parameter
|
||||||
func (player *Player) Pause(pause bool) error {
|
func (player *Player) Pause(pause bool) error {
|
||||||
|
player.paused = pause
|
||||||
msg := message{
|
msg := message{
|
||||||
Op: opPause,
|
Op: opPause,
|
||||||
GuildID: player.guildID,
|
GuildID: player.guildID,
|
||||||
|
@ -73,6 +75,11 @@ func (player *Player) Pause(pause bool) error {
|
||||||
return err
|
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
|
// Seek will seek the player to the speicifed position, in millis
|
||||||
func (player *Player) Seek(position int) error {
|
func (player *Player) Seek(position int) error {
|
||||||
msg := message{
|
msg := message{
|
||||||
|
@ -88,6 +95,11 @@ func (player *Player) Seek(position int) error {
|
||||||
return err
|
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 will set the player's volume to the specified value
|
||||||
//
|
//
|
||||||
// volume must be within [0, 1000]
|
// volume must be within [0, 1000]
|
||||||
|
|
Loading…
Reference in New Issue