silly goober bot
1use color_eyre::eyre::Result;
2use poise::serenity_prelude::{Context, FullEvent};
3use rand::Rng;
4use regex::Regex;
5
6use crate::types::Data;
7
8const REPLIES: &[&str] = &[
9 "Yes, absolutely!",
10 "No, that's not true.",
11 "Maybe, it depends on the context.",
12 "Definitely not!",
13 "Of course, it's true!",
14 "I wouldn't bet on it.",
15 "It's a possibility.",
16 "Only if you believe it.",
17];
18
19pub async fn handle(ctx: &Context, event: &FullEvent, _data: &Data) -> Result<()> {
20 if let FullEvent::Message { new_message } = event {
21 if new_message.mentions_user(&ctx.cache.current_user()) {
22 let is_this = Regex::new(r"is this true(\?)?").unwrap();
23 if is_this.is_match(&new_message.content) {
24 let select = rand::rng().random_range(0..=REPLIES.len());
25 let response = REPLIES[select];
26 let _ = new_message.reply(&ctx.http, response).await;
27 }
28
29 let bomb = Regex::new(r"how.(to|do).*bomb").unwrap();
30 if bomb.is_match(&new_message.content) {
31 let response = "very carefully";
32 let _ = new_message.reply(&ctx.http, response).await;
33 }
34 }
35 }
36
37 Ok(())
38}