diff options
| author | seth <[email protected]> | 2023-09-03 14:59:38 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2023-09-03 15:18:59 -0400 |
| commit | 41a17b7b3757351d3679093c075acc08a72a8bf0 (patch) | |
| tree | 36d3758260ea259b51ead2e0e17f57bea5d895df | |
| parent | 5d63f4b750a5982724982c302c66294552b1fe9c (diff) | |
fix: don't use regex for moyai
| -rw-r--r-- | Cargo.lock | 39 | ||||
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rw-r--r-- | src/main.rs | 6 |
3 files changed, 1 insertions, 45 deletions
@@ -18,15 +18,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] -name = "aho-corasick" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" -dependencies = [ - "memchr", -] - -[[package]] name = "android_system_properties" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1015,35 +1006,6 @@ dependencies = [ ] [[package]] -name = "regex" -version = "1.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" - -[[package]] name = "reqwest" version = "0.11.20" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1365,7 +1327,6 @@ dependencies = [ "include_dir", "once_cell", "rand 0.8.5", - "regex", "reqwest", "serde", "serenity", @@ -10,7 +10,6 @@ bottomify = "1.2.0" include_dir = "0.7.3" once_cell = "1.18.0" rand = "0.8.5" -regex = "1.9.4" reqwest = { version = "0.11.20", default-features = false, features = ["rustls-tls", "json"] } serde = "1.0.188" serenity = "0.11.6" diff --git a/src/main.rs b/src/main.rs index a3e165e..8a3aa94 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,4 @@ use once_cell::sync::Lazy; -use regex::Regex; use serenity::async_trait; use serenity::framework::standard::macros::{command, group}; use serenity::framework::standard::{CommandResult, StandardFramework}; @@ -48,9 +47,6 @@ impl Handler { Self { bot, pin_board } } fn should_echo(&self, msg: &Message) -> bool { - static MOYAI_REGEX: Lazy<Regex> = - Lazy::new(|| Regex::new(r"^<a?:\w*moy?ai\w*:\d+>$").unwrap()); - // Don't echo to anything we posted ourselves, and don't echo at all unless on certain // servers if msg.author.id == self.bot || !is_guild_allowed(msg.guild_id.unwrap_or_default()) { @@ -61,7 +57,7 @@ impl Handler { content == "🗿" || consts::TEAMOJIS.contains(&content.as_str()) - || MOYAI_REGEX.is_match(content) + || content.to_ascii_lowercase() == "moyai" || content .to_ascii_lowercase() .contains("twitter's recommendation algorithm") |
