diff --git a/backend/src/services/WbotServices/wbotMessageListener.ts b/backend/src/services/WbotServices/wbotMessageListener.ts index a85e356..b0618db 100644 --- a/backend/src/services/WbotServices/wbotMessageListener.ts +++ b/backend/src/services/WbotServices/wbotMessageListener.ts @@ -160,13 +160,18 @@ const verifyQueue = async ( choosenQueue = queues[+selectedOption - 1]; } else{ + selectedOption = msg.body; + + //////////////// EXTRAIR APENAS O NÚMERO /////////////////// + selectedOption = selectedOption.replace(/[^1-9]/g, '') + /////////////////////////////////// + choosenQueue = queues[+selectedOption - 1]; } // const selectedOption = msg.body; - // const choosenQueue = queues[+selectedOption - 1]; - + // const choosenQueue = queues[+selectedOption - 1]; if (choosenQueue) { await UpdateTicketService({ @@ -190,10 +195,7 @@ const verifyQueue = async ( const debouncedSentMessage = debounce( async () => { - const sentMessage = await wbot.sendMessage( - `${contact.number}@c.us`, - body - ); + const sentMessage = await wbot.sendMessage(`${contact.number}@c.us`, body); verifyMessage(sentMessage, ticket, contact); }, 3000,