Move standard startup to externally pokable method

This commit is contained in:
Lucy Bladen 2021-11-19 23:37:59 +00:00
parent 819feef76b
commit b1d0927ff0
1 changed files with 8 additions and 4 deletions

View File

@ -20,11 +20,8 @@ impl Handler {
timer_running: AtomicBool::from(false) timer_running: AtomicBool::from(false)
} }
} }
}
#[async_trait] pub async fn standard_startup(ctx: Context, data_about_bot: Ready) {
impl EventHandler for Handler {
async fn ready(&self, ctx: Context, data_about_bot: Ready) {
let data = ctx.data.read().await; let data = ctx.data.read().await;
let config = match data.get::<ManifoldConfig>() { let config = match data.get::<ManifoldConfig>() {
Some(c) => c.lock().await, Some(c) => c.lock().await,
@ -55,3 +52,10 @@ impl EventHandler for Handler {
channel.say(&ctx, greeting).await.expect("Couldn't message log channel!"); channel.say(&ctx, greeting).await.expect("Couldn't message log channel!");
} }
} }
#[async_trait]
impl EventHandler for Handler {
async fn ready(&self, ctx: Context, data_about_bot: Ready) {
Handler::standard_startup(ctx, data_about_bot).await;
}
}