tangled
alpha
login
or
join now
isabelroses.com
/
blahaj
1
fork
atom
silly goober bot
1
fork
atom
overview
issues
pulls
pipelines
feat: blahaj bomb?
isabelroses.com
8 months ago
426ff1f7
a87606f6
+7
-3
1 changed file
expand all
collapse all
unified
split
src
event_handler
blahaj_is_this_true.rs
+7
-3
src/event_handler/blahaj_is_this_true.rs
···
19
pub 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 regex = Regex::new(r"is this true(\?)?").unwrap();
23
-
if regex.is_match(&new_message.content) {
24
let select = rand::rng().random_range(0..=REPLIES.len());
25
let response = REPLIES[select];
0
0
26
27
-
// Reply with the response
0
0
28
let _ = new_message.reply(&ctx.http, response).await;
29
}
30
}
···
19
pub 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
}