commit test

pull/20/head
adriano 2022-09-22 15:34:12 -03:00
parent 728c5b580e
commit 12c497f65b
3 changed files with 18 additions and 22 deletions

View File

@ -36,23 +36,23 @@ const monitor = async () => {
try { try {
const { schedulingNotifies, count, hasMore } = await ListSchedulingNotifyService({ searchParam: dateParm, pageNumber: "1" }); // const { schedulingNotifies, count, hasMore } = await ListSchedulingNotifyService({ searchParam: dateParm, pageNumber: "1" });
// console.log('schedulingNotifies: ',schedulingNotifies) // // console.log('schedulingNotifies: ',schedulingNotifies)
if (schedulingNotifies && schedulingNotifies.length > 0) { // if (schedulingNotifies && schedulingNotifies.length > 0) {
const ticket = await ShowTicketService(schedulingNotifies[0].ticketId); // const ticket = await ShowTicketService(schedulingNotifies[0].ticketId);
SetTicketMessagesAsRead(ticket); // SetTicketMessagesAsRead(ticket);
await SendWhatsAppMessage({ // await SendWhatsAppMessage({
body: schedulingNotifies[0].message, ticket // body: schedulingNotifies[0].message, ticket
}); // });
DeleteSchedulingNotifyService(schedulingNotifies[0].id) // DeleteSchedulingNotifyService(schedulingNotifies[0].id)
} // }
exec("df -h /", (error: any, stdout: any, stderr: any) => { exec("df -h /", (error: any, stdout: any, stderr: any) => {

View File

@ -22,11 +22,10 @@ const FindOrCreateTicketService = async (
}, },
contactId: groupContact ? groupContact.id : contact.id contactId: groupContact ? groupContact.id : contact.id
} }
}); });
const { queues, greetingMessage } = await ShowWhatsAppService(whatsappId); const { queues, greetingMessage } = await ShowWhatsAppService(whatsappId);
//Habilitar esse caso queira usar o bot //Habilitar esse caso queira usar o bot
// const botInfo = await BotIsOnQueue('botqueue') // const botInfo = await BotIsOnQueue('botqueue')
@ -34,7 +33,7 @@ const FindOrCreateTicketService = async (
if (ticket) { if (ticket) {
await ticket.update({ unreadMessages }); await ticket.update({ unreadMessages });
} }
@ -69,7 +68,7 @@ const FindOrCreateTicketService = async (
//[Op.between]: [+subMinutes(new Date(), 30), +new Date()] //[Op.between]: [+subMinutes(new Date(), 30), +new Date()]
// Sub seconds // Sub seconds
[Op.between]: [+subSeconds(new Date(), 3), +new Date()] [Op.between]: [+subSeconds(new Date(), 0), +new Date()]
}, },
contactId: contact.id contactId: contact.id
}, },

View File

@ -423,15 +423,12 @@ const handleMessage = async (
unreadMessages, unreadMessages,
groupContact groupContact
); );
// test del
// console.log('>>>>>>>>>>>>>> wbot MOBILE NUMBER: ', wbot.info["wid"]["user"])
// console.log('>>>>>>>>>>>>>> wbot.id: ', wbot.id)
// console.log('>>>>>>>>>>>>>> ticket.id: ', ticket.id)
// console.log('>>>>>>>>>>>>>> ticket.whatsappId: ', ticket.whatsappId)
// Para responder para o cliente pelo mesmo whatsapp que ele enviou a mensagen // Para responder para o cliente pelo mesmo whatsapp que ele enviou a mensagen
if (wbot.id != ticket.whatsappId) { if (wbot.id != ticket.whatsappId) {
console.log('>>> entrou wbot.id: ', wbot.id, ' | ',ticket.whatsappId)
await ticket.update({ whatsappId: wbot.id }); await ticket.update({ whatsappId: wbot.id });
} }
// //