diff --git a/src/main.rs b/src/main.rs index 5202559..863beb7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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;}