summaryrefslogtreecommitdiff
path: root/src/handler/mod.rs
diff options
context:
space:
mode:
authorseth <[email protected]>2023-07-10 00:18:36 -0400
committerseth <[email protected]>2023-11-16 00:35:07 +0000
commita4a9353e1c8f902b7d7b3cf74e3e5b129c214330 (patch)
treeb58da1d30af52e97c0251e0d6882cd0ccdfeb20a /src/handler/mod.rs
parent5e9ec7f008e01d25c0b7f782c5ae043bc9ca0933 (diff)
start using poise
Diffstat (limited to 'src/handler/mod.rs')
-rw-r--r--src/handler/mod.rs34
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")
+ }
+}