gavalink/event.go

33 lines
1.1 KiB
Go
Raw Normal View History

2018-08-24 01:24:20 +00:00
package gavalink
// EventHandler defines events that Lavalink may send to a player
type EventHandler interface {
OnTrackEnd(player *Player, track string, reason string) error
OnTrackException(player *Player, track string, reason string) error
OnTrackStuck(player *Player, track string, threshold int) error
2019-02-04 00:31:53 +00:00
OnVoiceProcessed(player *Player, data *VoiceProcessingData, hotword, override bool) error
2018-08-24 01:24:20 +00:00
}
// DummyEventHandler provides an empty event handler for users who
// wish to drop events outright. This is not recommended.
type DummyEventHandler struct{}
// OnTrackEnd is raised when a track ends
func (d DummyEventHandler) OnTrackEnd(player *Player, track string, reason string) error {
return nil
}
// OnTrackException is raised when a track throws an exception
func (d DummyEventHandler) OnTrackException(player *Player, track string, reason string) error {
return nil
}
// OnTrackStuck is raised when a track gets stuck
func (d DummyEventHandler) OnTrackStuck(player *Player, track string, threshold int) error {
return nil
}
2019-02-04 00:31:53 +00:00
2019-10-13 01:13:23 +00:00
func (d DummyEventHandler) OnVoiceProcessed(player *Player, data *VoiceProcessingData, hotword, override bool) error {
2019-02-04 00:31:53 +00:00
return nil
}