add reeeee

This commit is contained in:
Edward Shen 2020-05-02 03:06:32 -04:00
parent b7bb17a42c
commit ea414b0577
Signed by: edward
GPG key ID: 19182661E818369F
2 changed files with 31 additions and 0 deletions

View file

@ -1,6 +1,7 @@
use ahhhh::YellResponder;
use best_doctor::BestDoctorResponder;
use fufufu::FufufuResponder;
use reee::ReeeResponder;
use serenity::async_trait;
use serenity::model::channel::Message;
use serenity::prelude::{Context, EventHandler};
@ -8,6 +9,7 @@ use serenity::prelude::{Context, EventHandler};
mod ahhhh;
mod best_doctor;
mod fufufu;
mod reee;
pub(crate) struct Handler {
responders: Vec<Box<dyn EventHandler>>,
@ -20,6 +22,7 @@ impl Default for Handler {
Box::new(BestDoctorResponder),
Box::new(FufufuResponder),
Box::new(YellResponder),
Box::new(ReeeResponder),
],
}
}

28
src/passive/reee.rs Normal file
View file

@ -0,0 +1,28 @@
use lazy_static::lazy_static;
use regex::Regex;
use serenity::async_trait;
use serenity::model::channel::Message;
use serenity::prelude::{Context, EventHandler};
lazy_static! {
static ref REGEX: Regex = Regex::new("RE{5,}").unwrap();
}
pub(crate) struct ReeeResponder;
#[async_trait]
impl EventHandler for ReeeResponder {
async fn message(&self, ctx: Context, message: Message) {
if REGEX.is_match(&message.content_safe(ctx.clone()).await) {
if let Some(guild_id) = message.guild_id {
if guild_id == 679888177951277102 {
message
.channel_id
.say(ctx, "<:texaspat:680231475928498217>")
.await
.unwrap();
}
}
}
}
}