Finish refactoring
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use twilight_model::gateway::payload::incoming::Ready;
|
||||
|
||||
use crate::{
|
||||
framework::{
|
||||
events::traits::{EventResult, OnReadyHandler, OnReconnectHandler},
|
||||
runtime::Runtime,
|
||||
},
|
||||
state::State,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ReadyHandler;
|
||||
|
||||
#[async_trait]
|
||||
impl OnReadyHandler<State> for ReadyHandler {
|
||||
async fn on_ready(&self, event: &Ready, _: Arc<Runtime<State>>) -> EventResult {
|
||||
log::info!(
|
||||
"Ready! Logged in as {}#{:>04}",
|
||||
event.user.name,
|
||||
event.user.discriminator
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ReconnectHandler;
|
||||
|
||||
#[async_trait]
|
||||
impl OnReconnectHandler<State> for ReconnectHandler {
|
||||
async fn on_reconnect(&self, _: Arc<Runtime<State>>) -> EventResult {
|
||||
log::info!("The gateway asked for a reconnection");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
pub mod events;
|
||||
Reference in New Issue
Block a user