Correção para evitar que o ticket expiration gere um novo ticket

pull/20/head
adriano 2023-08-08 12:31:25 -03:00
parent c8ea53a4bc
commit f778a928c8
1 changed files with 13 additions and 15 deletions

View File

@ -452,6 +452,19 @@ const handleMessage = async (msg: any, wbot: any): Promise<void> => {
// let groupContact: Contact | undefined;
if (msg.fromMe) {
const ticketExpiration = await SettingTicket.findOne({
where: { key: "ticketExpiration" }
});
if (
ticketExpiration &&
ticketExpiration.value == "enabled" &&
ticketExpiration?.message.trim() == msg.body.trim()
) {
console.log("*********** TICKET EXPIRATION");
return;
}
// console.log('FROM ME: ', msg.fromMe, ' | /\u200e/.test(msg.body[0]: ', (/\u200e/.test(msg.body[0])))
// messages sent automatically by wbot have a special character in front of it
@ -579,21 +592,6 @@ const handleMessage = async (msg: any, wbot: any): Promise<void> => {
await verifyQueue(wbot, msg, ticket, contact);
}
if (msg.fromMe) {
const ticketExpiration = await SettingTicket.findOne({
where: { key: "ticketExpiration" }
});
if (
ticketExpiration &&
ticketExpiration.value == "enabled" &&
ticketExpiration?.message.trim() == msg.body.trim()
) {
console.log("*********** TICKET EXPIRATION");
return;
}
}
// O bot interage com o cliente e encaminha o atendimento para fila de atendende quando o usuário escolhe a opção falar com atendente
//Habilitar esse caso queira usar o bot