Adição de código para extrair numero

pull/1/head
adriano 2022-03-16 20:44:10 -03:00
parent 0f3a0cdc0e
commit 9f3183f8ce
1 changed files with 8 additions and 6 deletions

View File

@ -160,14 +160,19 @@ const verifyQueue = async (
choosenQueue = queues[+selectedOption - 1]; choosenQueue = queues[+selectedOption - 1];
} }
else{ else{
selectedOption = msg.body; selectedOption = msg.body;
//////////////// EXTRAIR APENAS O NÚMERO ///////////////////
selectedOption = selectedOption.replace(/[^1-9]/g, '')
///////////////////////////////////
choosenQueue = queues[+selectedOption - 1]; choosenQueue = queues[+selectedOption - 1];
} }
// const selectedOption = msg.body; // const selectedOption = msg.body;
// const choosenQueue = queues[+selectedOption - 1]; // const choosenQueue = queues[+selectedOption - 1];
if (choosenQueue) { if (choosenQueue) {
await UpdateTicketService({ await UpdateTicketService({
ticketData: { queueId: choosenQueue.id }, ticketData: { queueId: choosenQueue.id },
@ -190,10 +195,7 @@ const verifyQueue = async (
const debouncedSentMessage = debounce( const debouncedSentMessage = debounce(
async () => { async () => {
const sentMessage = await wbot.sendMessage( const sentMessage = await wbot.sendMessage(`${contact.number}@c.us`, body);
`${contact.number}@c.us`,
body
);
verifyMessage(sentMessage, ticket, contact); verifyMessage(sentMessage, ticket, contact);
}, },
3000, 3000,