1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
use crate::{ client::Context, error::KahootError, message::{ GetReadyMessage, StartQuestionMessage, UsernameAcceptedMessage, }, }; #[crate::async_trait] pub trait Handler: Send + Sync { async fn on_login(&self, _ctx: Context) {} async fn on_username_accepted(&self, _ctx: Context, _msg: UsernameAcceptedMessage) {} async fn on_get_ready(&self, _ctx: Context, _msg: GetReadyMessage) {} async fn on_start_question(&self, _ctx: Context, _msg: StartQuestionMessage) {} async fn on_error(&self, _ctx: Context, _e: KahootError) {} } pub struct DefaultHandler; #[crate::async_trait] impl Handler for DefaultHandler {}