From fcc035fae423a601cafc0267aa7abd88b4a4e259 Mon Sep 17 00:00:00 2001 From: adriano Date: Wed, 19 Jan 2022 13:08:36 -0300 Subject: [PATCH] =?UTF-8?q?=20Modifica=C3=A7=C3=A3o=20para=20que=20o=20sis?= =?UTF-8?q?tema=20possa=20ter=20ura=20com=20op=C3=A7=C3=B5es=20e=20sem=20o?= =?UTF-8?q?p=C3=A7=C3=A3o.=20No=20caso=20da=20ura=20sem=20op=C3=A7=C3=A3o,?= =?UTF-8?q?=20=C3=A9=20a=20ura=20que=20s=C3=B3=20tem=20a=20mensagem=20de?= =?UTF-8?q?=20boas=20vindas=20no=20primeiro=20envio=20de=20mensagem=20do?= =?UTF-8?q?=20cliente,=20no=20caso=20da=20ura=20com=20op=C3=A7=C3=B5es,=20?= =?UTF-8?q?=C3=A9=20a=20ura=20que=20al=C3=A9m=20da=20mensagem=20de=20boas?= =?UTF-8?q?=20vindas,=20tem=20as=20op=C3=A7oes=20definidas=20na=20fila=20p?= =?UTF-8?q?ara=20que=20o=20usu=C3=A1rio=20ecolha=20um=20n=C3=BAmero=20nas?= =?UTF-8?q?=20op=C3=A7=C3=B5es.=20Para=20ura=20sem=20op=C3=A7=C3=B5es=20?= =?UTF-8?q?=C3=A9=20necess=C3=A1rio=20que=20haja=20apenas=20uma=20fila=20a?= =?UTF-8?q?dicionada=20a=20conex=C3=A3o=20do=20whatssap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WbotServices/wbotMessageListener.ts | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/backend/src/services/WbotServices/wbotMessageListener.ts b/backend/src/services/WbotServices/wbotMessageListener.ts index 2c74edd..ecdf457 100644 --- a/backend/src/services/WbotServices/wbotMessageListener.ts +++ b/backend/src/services/WbotServices/wbotMessageListener.ts @@ -143,23 +143,33 @@ const verifyQueue = async ( const { queues, greetingMessage } = await ShowWhatsAppService(wbot.id!); - if (queues.length === 1) { + //ativar esse + /*if (queues.length === 1) { await UpdateTicketService({ ticketData: { queueId: queues[0].id }, ticketId: ticket.id }); return; - } + }*/ console.log('queues.lengthqueues.lengthqueues.lengthqueues.lengthqueues.length: ',queues.length) - const selectedOption = msg.body; - const choosenQueue = queues[+selectedOption - 1]; - - //apagar essa gambiarra e ativar as 2 linhas acima thuanny - //const selectedOption = 1; + //const selectedOption = msg.body; //const choosenQueue = queues[+selectedOption - 1]; + let selectedOption; + let choosenQueue; + + //apagar essa gambiarra e ativar as 2 linhas acima thuanny + if (queues.length === 1){ + selectedOption = 1; + choosenQueue = queues[+selectedOption - 1]; + } + else{ + selectedOption = msg.body; + choosenQueue = queues[+selectedOption - 1]; + } + if (choosenQueue) { await UpdateTicketService({