blob: 3b11a482055a83dd3e77dc30c168292b2220fcf2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
mod labwatch;
use serenity::{
all::{ChannelId, Context, EventHandler, Ready},
async_trait,
};
use std::{path::PathBuf, sync::Arc};
pub struct Handler(Arc<HandlerConfig>);
impl From<HandlerConfig> for Handler {
fn from(config: HandlerConfig) -> Handler {
Handler(Arc::new(config))
}
}
pub struct HandlerConfig {
pub db_dir: PathBuf,
pub labwatch_channel_id: ChannelId,
}
#[async_trait]
impl EventHandler for Handler {
async fn ready(&self, ctx: Context, _data_about_bot: Ready) {
tokio::spawn(labwatch::start(self.0.clone(), ctx));
}
}
|