Modify keywords; cleanup debug.rs

This commit is contained in:
0xf8 2023-04-16 21:10:39 -04:00
parent d94095e8d9
commit 36860c9314
Signed by: 0xf8
GPG Key ID: 446580D758689584
2 changed files with 22 additions and 32 deletions

View File

@ -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",
"👇", "👆️"
]
}

View File

@ -3,8 +3,7 @@ use matrix_sdk::{
ruma::events::room::message::RoomMessageEventContent,
};
use crate::{
judge::{Judgement, JudgementResult},
keywords::KeywordSection,
judge::Judgement,
CONFIG,
};
@ -16,7 +15,6 @@ impl Debug {
let mut result_report: Vec<(String, String)> = vec![];
let res: (JudgementResult, Option<KeywordSection>) = (|| {
for section in sections {
let (hits, hit_required) = section.1.find(judge.text.to_owned());
@ -24,16 +22,7 @@ impl Debug {
format!("\"{}\": \"{hits}\", {hit_required} ", section.0),
format!("<code>{}</code>: <code>{hits}</code>, <code>{hit_required}</code>", 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)
})();
let mut full_report: (String, String) = ("".to_string(), "".to_string());