Modify keywords; cleanup debug.rs
This commit is contained in:
parent
d94095e8d9
commit
36860c9314
@ -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",
|
||||
"👇", "👆️"
|
||||
]
|
||||
}
|
||||
|
29
src/debug.rs
29
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<KeywordSection>) = (|| {
|
||||
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!("<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)
|
||||
})();
|
||||
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!("<code>{}</code>: <code>{hits}</code>, <code>{hit_required}</code>", section.0)
|
||||
));
|
||||
}
|
||||
|
||||
let mut full_report: (String, String) = ("".to_string(), "".to_string());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user