diff --git a/backend/src/services/WbotServices/wbotMessageListener.ts b/backend/src/services/WbotServices/wbotMessageListener.ts index c85e2ab..b6b0a8e 100644 --- a/backend/src/services/WbotServices/wbotMessageListener.ts +++ b/backend/src/services/WbotServices/wbotMessageListener.ts @@ -452,6 +452,19 @@ const handleMessage = async (msg: any, wbot: any): Promise => { // 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 => { 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