Correção do bug que envia 2 uras quando o usuario digita 0 após ser transferido para uma fila

pull/20/head
adriano 2022-11-25 10:51:06 -03:00
parent 991d958f20
commit ddf026a168
1 changed files with 6 additions and 8 deletions

View File

@ -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) { if (!response) {
@ -447,7 +447,7 @@ async function sendDelayedMessages(wbot: Session, ticket: Ticket, contact: Conta
await itsm_response('\n\n') await itsm_response('\n\n')
if (endPointResponse.data.categoria == 'INFRAESTRUTURA' && endPointResponse.data.subcategoria == 'INTERNET' && centro_de_custo) { 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._') 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') await itsm_response('\n\n')
if (endPointResponse.data.categoria == 'INFRAESTRUTURA' && endPointResponse.data.subcategoria == 'INTERNET' && centro_de_custo) { 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') 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); 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({ await UpdateTicketService({
ticketData: { status: 'open', userId: botInfo.userIdBot, queueId: choosenQueue.id }, ticketData: { status: 'open', userId: botInfo.userIdBot, queueId: choosenQueue.id },
ticketId: ticket.id ticketId: ticket.id
}); });