diff options
Diffstat (limited to 'src/handler/mod.rs')
| -rw-r--r-- | src/handler/mod.rs | 34 |
1 files changed, 34 insertions, 0 deletions
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") + } +} |
