From a4a9353e1c8f902b7d7b3cf74e3e5b129c214330 Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 10 Jul 2023 00:18:36 -0400 Subject: start using poise --- src/handler/mod.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/handler/mod.rs (limited to 'src/handler/mod.rs') diff --git a/src/handler/mod.rs b/src/handler/mod.rs new file mode 100644 index 0000000..7f7c881 --- /dev/null +++ b/src/handler/mod.rs @@ -0,0 +1,34 @@ +use crate::utils; +use crate::{consts, Data}; +use log::*; + +use poise::serenity_prelude::Message; + +mod events; + +pub struct Handler { + data: Data, +} + +impl Handler { + pub fn new(data: Data) -> Self { + Self { data } + } + + fn should_echo(&self, msg: &Message) -> bool { + let gid = msg.guild_id.unwrap_or_default(); + if msg.author.id == self.data.bot || !utils::is_guild_allowed(gid) { + info!("not running copypasta command in {gid}"); + return false; + } + + let content = &msg.content; + + content == "🗿" + || consts::TEAMOJIS.contains(&content.as_str()) + || content.to_ascii_lowercase() == "moyai" + || content + .to_ascii_lowercase() + .contains("twitter's recommendation algorithm") + } +} -- cgit v1.2.3