chore: add some more filters

This commit is contained in:
Jelson Stoelben Rodrigues
2025-08-28 10:55:34 -03:00
parent 9d017f7b80
commit 3df038972a
2 changed files with 46 additions and 6 deletions

View File

@@ -250,6 +250,24 @@ fn main() -> anyhow::Result<()> {
if found_stop_notification.is_some() {return None;}
// Filter lack of dialogue
let lack_of_dialogue = talk_histories.as_array().expect("Wrong message type received from talk histories").into_iter().find(|message_object|{
let message = message_object["message"].as_str().expect("Failed to decode message as string");
let found = message.to_uppercase().find(&"Esse atendimento está sendo encerrado devido a inexistência de diálogo".to_uppercase());
found.is_some()
});
if lack_of_dialogue.is_some() {return None;}
// Filter is portal access
let portal_link_offer = talk_histories.as_array().expect("Wrong message type received from talk histories").into_iter().find(|message_object|{
let message = message_object["message"].as_str().expect("Failed to decode message as string");
let found = message.to_uppercase().find(&"https://novanet.portal.7az.com.br/login".to_uppercase());
found.is_some()
});
if portal_link_offer.is_some() {return None;}
// Filter Bot finished chats
if json["agent"]["user"]["name"].as_str().unwrap_or("unknown_user") == "PipeBot" {return None;}