diff --git a/backend/src/services/WbotServices/wbotMessageListener.ts b/backend/src/services/WbotServices/wbotMessageListener.ts index 530e892..bfbb80c 100644 --- a/backend/src/services/WbotServices/wbotMessageListener.ts +++ b/backend/src/services/WbotServices/wbotMessageListener.ts @@ -242,7 +242,7 @@ const queryEndPointHit = async (centro_de_custo: string) => { } -const monitoramento_response2 = async (response: any | null, wbot: any, contact: any, ticket: any, centro_de_custo: any, final_message:string='', send_empty_incident?:boolean) => { +const monitoramento_response2 = async (response: any | null, wbot: any, contact: any, ticket: any, centro_de_custo: any, final_message: string = '', send_empty_incident?: boolean) => { if (!response) { @@ -447,7 +447,7 @@ async function sendDelayedMessages(wbot: Session, ticket: Ticket, contact: Conta await itsm_response('\n\n') if (endPointResponse.data.categoria == 'INFRAESTRUTURA' && endPointResponse.data.subcategoria == 'INTERNET' && centro_de_custo) { - await monitoramento_response2(msg_endpoint2,wbot,contact,ticket, centro_de_custo,'\n\n _Digite *0* para voltar ao menu principal._',true) + await monitoramento_response2(msg_endpoint2, wbot, contact, ticket, centro_de_custo, '\n\n _Digite *0* para voltar ao menu principal._', true) } await sendMessageBot('Se deseja solicitar atendimento de urgência, digite *1*!', '\n\n _Digite *0* para voltar ao menu principal._') @@ -460,7 +460,7 @@ async function sendDelayedMessages(wbot: Session, ticket: Ticket, contact: Conta await itsm_response('\n\n') if (endPointResponse.data.categoria == 'INFRAESTRUTURA' && endPointResponse.data.subcategoria == 'INTERNET' && centro_de_custo) { - await monitoramento_response2(msg_endpoint2,wbot,contact,ticket, centro_de_custo,'\n\n _Digite *0* para voltar ao menu principal._',true) + await monitoramento_response2(msg_endpoint2, wbot, contact, ticket, centro_de_custo, '\n\n _Digite *0* para voltar ao menu principal._', true) } await sendMessageBot('Acompanhe a evolução do atendimento através do SOS') @@ -1002,14 +1002,12 @@ const handleMessage = async ( await sendDialogflowAwswer(wbot, ticket, msg, contact, chat); } - else if (botInfo.isOnQueue && !msg.fromMe && msg.body=='0' && ticket.status == 'pending'){ + else if (botInfo.isOnQueue && !msg.fromMe && msg.body == '0' && ticket.status == 'pending' && ticket.queueId ) { - console.log('Entrou onde não devia..........') - - let choosenQueue = await ShowQueueService(botInfo.botQueueId); + let choosenQueue = await ShowQueueService(botInfo.botQueueId); await UpdateTicketService({ - ticketData: { status: 'open', userId: botInfo.userIdBot, queueId: choosenQueue.id }, + ticketData: { status: 'open', userId: botInfo.userIdBot, queueId: choosenQueue.id }, ticketId: ticket.id });