33 lines
1.1 KiB
Go
33 lines
1.1 KiB
Go
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
|
|
OnVoiceProcessed(player *Player, data *VoiceProcessingData, hotword, override bool) error
|
|
}
|
|
|
|
// 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
|
|
}
|
|
|
|
func (d DummyEventHandler) OnVoiceProcessed(player *Player, file string, hotword, override bool) error {
|
|
return nil
|
|
}
|