diff --git a/config/keywords.json b/config/keywords.json index 6424f66..6becb06 100644 --- a/config/keywords.json +++ b/config/keywords.json @@ -1,7 +1,7 @@ { "sections": { "18+": { - "threshold": 3, + "threshold": 4, "requiredKeywords": [ "sex", "nude", @@ -14,37 +14,38 @@ "pay", "pal", "buy", "sell", + "on", "message", "meet", "check", - "card" + "card", + "discord" ] }, "Investment": { - "threshold": 4, + "threshold": 3, "requiredKeywords": [ - "tg", "t.me/", - "invest", - "crypto", "market", + "crypto", "profit", "my commission", - "cashout", "cash out", - "million", + "tg", "t.me", "cash.app", "l.wl.co/", ".app.link/" ], "keywords": [ "earn", "earning", "make", "making", "made", - "buy", - "send", + "buy", "invest", + "cashout", "cash out", + "send", "market", "interested", "btc", "bitcoin", "eth", "ethereum", "etherium", "$", "usd", + "million", "asking me how", - "cash", "whats", "app", - "tele", "gram", + "cash", "whatsapp", + "telegram", "👇", "👆️" ] } diff --git a/src/debug.rs b/src/debug.rs index ac3b0f7..856cff6 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -3,8 +3,7 @@ use matrix_sdk::{ ruma::events::room::message::RoomMessageEventContent, }; use crate::{ - judge::{Judgement, JudgementResult}, - keywords::KeywordSection, + judge::Judgement, CONFIG, }; @@ -16,24 +15,14 @@ impl Debug { let mut result_report: Vec<(String, String)> = vec![]; - let res: (JudgementResult, Option) = (|| { - for section in sections { - let (hits, hit_required) = section.1.find(judge.text.to_owned()); - - result_report.push(( - format!("\"{}\": \"{hits}\", {hit_required} ", section.0), - format!("{}: {hits}, {hit_required}", section.0) - )); - - if hit_required && hits >= section.1.threshold { - return (JudgementResult::LikelyScam, Some(section.1)) - } else if hits >= section.1.threshold { - return (JudgementResult::MaybeScam, Some(section.1)) - } - } - - (JudgementResult::Ok, None) - })(); + for section in sections { + let (hits, hit_required) = section.1.find(judge.text.to_owned()); + + result_report.push(( + format!("\"{}\": \"{hits}\", {hit_required} ", section.0), + format!("{}: {hits}, {hit_required}", section.0) + )); + } let mut full_report: (String, String) = ("".to_string(), "".to_string());