chore: update filtering

This commit is contained in:
Jelson Stoelben Rodrigues
2025-09-25 10:35:41 -03:00
parent 3f1cc3334f
commit 324af05c54

View File

@@ -1,8 +1,6 @@
use std::ffi::OsStr;
use std::{any::Any, env, fmt::format, iter, time::Duration};
// use http::{self, response};
use chrono::{self, Timelike};
use dotenv;
use ipaddress;
@@ -291,6 +289,16 @@ fn main() -> anyhow::Result<()> {
if network_sector_mentioned.is_some() {return None;}
// Password change ticket
let password_change_keywords = ["trocar a senha", "troca de senha", "troca senha", "alterar senha", "altera senha"];
let password_change_identified = talk_histories.as_array().expect("Wrong message type received from talk histories").into_iter().any(|message_object|{
let message = message_object["message"].as_str().expect("Failed to decode message as string");
let found = password_change_keywords.iter().any(|keyword|{message.to_uppercase().find(&keyword.to_uppercase()).is_some()});
found
});
if password_change_identified {return None;}
// Filter Bot finished chats
if json["agent"]["user"]["name"].as_str().unwrap_or("unknown_user") == "PipeBot" {return None;}