|
|
|
@ -12,7 +12,6 @@ use serenity::{ |
|
|
|
|
prelude::*, |
|
|
|
|
}; |
|
|
|
|
use std::fs::read_to_string; |
|
|
|
|
use std::process::exit; |
|
|
|
|
use std::sync::Arc; |
|
|
|
|
use std::time::Duration; |
|
|
|
|
|
|
|
|
@ -82,7 +81,7 @@ async fn interval_loop(ctx: Arc<Context>) { |
|
|
|
|
let channel_id = ctx.data.read().await.get::<ChanId>().unwrap().clone(); |
|
|
|
|
loop { |
|
|
|
|
let sentence = ctx.data.read().await.get::<TextGenerator>().unwrap().generate(); |
|
|
|
|
channel_id.say(&ctx.http, sentence).await; |
|
|
|
|
channel_id.say(&ctx.http, sentence).await.unwrap(); |
|
|
|
|
tokio::time::delay_for(Duration::from_secs(*ctx.data.read().await.get::<Interval>().unwrap())).await; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -92,7 +91,7 @@ impl EventHandler for Handler { |
|
|
|
|
async fn message(&self, ctx: Context, msg: Message) { |
|
|
|
|
if mentions_me(&ctx, &msg).await { |
|
|
|
|
let sentence = ctx.data.read().await.get::<TextGenerator>().unwrap().generate(); |
|
|
|
|
msg.channel_id.say(&ctx.http, sentence).await; |
|
|
|
|
msg.channel_id.say(&ctx.http, sentence).await.unwrap(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -136,7 +135,7 @@ async fn main() { |
|
|
|
|
data.insert::<ChanId>(config.channel_id); |
|
|
|
|
data.insert::<LoopStatus>(false); |
|
|
|
|
} |
|
|
|
|
client.start().await; |
|
|
|
|
client.start().await.unwrap(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|