chore: filter no comercial agent available chats
This commit is contained in:
@@ -268,6 +268,15 @@ fn main() -> anyhow::Result<()> {
|
|||||||
|
|
||||||
if portal_link_offer.is_some() {return None;}
|
if portal_link_offer.is_some() {return None;}
|
||||||
|
|
||||||
|
// Filter no comercial agent available
|
||||||
|
let comercial_agents_unavailable = 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(&"Transbordo automático para a fila [NovaNet -> Atendimento -> Suporte], pois não havia agentes disponíveis na fila [NovaNet -> Atendimento -> Comercial]".to_uppercase());
|
||||||
|
found.is_some()
|
||||||
|
});
|
||||||
|
|
||||||
|
if comercial_agents_unavailable.is_some() {return None;}
|
||||||
|
|
||||||
// Filter Bot finished chats
|
// Filter Bot finished chats
|
||||||
if json["agent"]["user"]["name"].as_str().unwrap_or("unknown_user") == "PipeBot" {return None;}
|
if json["agent"]["user"]["name"].as_str().unwrap_or("unknown_user") == "PipeBot" {return None;}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user