summaryrefslogtreecommitdiff
path: root/src/handler/mod.rs
blob: 7f7c881f751870a8c5e595e672eeb73bf4ad7256 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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")
	}
}