// Code generated by "eventhandlers"; DO NOT EDIT // See events.go package gavalink // Following are all the event types. // Event type values are used to match the events returned by Lavalink. const ( trackEndEventType = "TrackEndEvent" trackExceptionEventType = "TrackExceptionEvent" trackStartEventType = "TrackStartEvent" trackStuckEventType = "TrackStuckEvent" voiceProcessedEventType = "VoiceProcessedEvent" webSocketClosedEventType = "WebSocketClosedEvent" ) // trackEndEventHandler is an event handler for TrackEnd events. type trackEndEventHandler func(*Player, *TrackEnd) // Type returns the event type for TrackEnd events. func (eh trackEndEventHandler) Type() string { return trackEndEventType } // New returns a new instance of TrackEnd. func (eh trackEndEventHandler) New() interface{} { return &TrackEnd{} } // Handle is the handler for TrackEnd events. func (eh trackEndEventHandler) Handle(p *Player, i interface{}) { if t, ok := i.(*TrackEnd); ok { eh(p, t) } } // trackExceptionEventHandler is an event handler for TrackException events. type trackExceptionEventHandler func(*Player, *TrackException) // Type returns the event type for TrackException events. func (eh trackExceptionEventHandler) Type() string { return trackExceptionEventType } // New returns a new instance of TrackException. func (eh trackExceptionEventHandler) New() interface{} { return &TrackException{} } // Handle is the handler for TrackException events. func (eh trackExceptionEventHandler) Handle(p *Player, i interface{}) { if t, ok := i.(*TrackException); ok { eh(p, t) } } // trackStartEventHandler is an event handler for TrackStart events. type trackStartEventHandler func(*Player, *TrackStart) // Type returns the event type for TrackStart events. func (eh trackStartEventHandler) Type() string { return trackStartEventType } // New returns a new instance of TrackStart. func (eh trackStartEventHandler) New() interface{} { return &TrackStart{} } // Handle is the handler for TrackStart events. func (eh trackStartEventHandler) Handle(p *Player, i interface{}) { if t, ok := i.(*TrackStart); ok { eh(p, t) } } // trackStuckEventHandler is an event handler for TrackStuck events. type trackStuckEventHandler func(*Player, *TrackStuck) // Type returns the event type for TrackStuck events. func (eh trackStuckEventHandler) Type() string { return trackStuckEventType } // New returns a new instance of TrackStuck. func (eh trackStuckEventHandler) New() interface{} { return &TrackStuck{} } // Handle is the handler for TrackStuck events. func (eh trackStuckEventHandler) Handle(p *Player, i interface{}) { if t, ok := i.(*TrackStuck); ok { eh(p, t) } } // voiceProcessedEventHandler is an event handler for VoiceProcessed events. type voiceProcessedEventHandler func(*Player, *VoiceProcessed) // Type returns the event type for VoiceProcessed events. func (eh voiceProcessedEventHandler) Type() string { return voiceProcessedEventType } // New returns a new instance of VoiceProcessed. func (eh voiceProcessedEventHandler) New() interface{} { return &VoiceProcessed{} } // Handle is the handler for VoiceProcessed events. func (eh voiceProcessedEventHandler) Handle(p *Player, i interface{}) { if t, ok := i.(*VoiceProcessed); ok { eh(p, t) } } // webSocketClosedEventHandler is an event handler for WebSocketClosed events. type webSocketClosedEventHandler func(*Player, *WebSocketClosed) // Type returns the event type for WebSocketClosed events. func (eh webSocketClosedEventHandler) Type() string { return webSocketClosedEventType } // New returns a new instance of WebSocketClosed. func (eh webSocketClosedEventHandler) New() interface{} { return &WebSocketClosed{} } // Handle is the handler for WebSocketClosed events. func (eh webSocketClosedEventHandler) Handle(p *Player, i interface{}) { if t, ok := i.(*WebSocketClosed); ok { eh(p, t) } } func handlerForInterface(handler interface{}) EventHandler { switch v := handler.(type) { case func(*Player, interface{}): return interfaceEventHandler(v) case func(*Player, *TrackEnd): return trackEndEventHandler(v) case func(*Player, *TrackException): return trackExceptionEventHandler(v) case func(*Player, *TrackStart): return trackStartEventHandler(v) case func(*Player, *TrackStuck): return trackStuckEventHandler(v) case func(*Player, *VoiceProcessed): return voiceProcessedEventHandler(v) case func(*Player, *WebSocketClosed): return webSocketClosedEventHandler(v) } return nil } func init() { registerInterfaceProvider(trackEndEventHandler(nil)) registerInterfaceProvider(trackExceptionEventHandler(nil)) registerInterfaceProvider(trackStartEventHandler(nil)) registerInterfaceProvider(trackStuckEventHandler(nil)) registerInterfaceProvider(voiceProcessedEventHandler(nil)) registerInterfaceProvider(webSocketClosedEventHandler(nil)) }