commit test
parent
728c5b580e
commit
12c497f65b
|
@ -36,23 +36,23 @@ const monitor = async () => {
|
|||
|
||||
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({
|
||||
body: schedulingNotifies[0].message, ticket
|
||||
});
|
||||
// await SendWhatsAppMessage({
|
||||
// body: schedulingNotifies[0].message, ticket
|
||||
// });
|
||||
|
||||
DeleteSchedulingNotifyService(schedulingNotifies[0].id)
|
||||
// DeleteSchedulingNotifyService(schedulingNotifies[0].id)
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
exec("df -h /", (error: any, stdout: any, stderr: any) => {
|
||||
|
|
|
@ -22,11 +22,10 @@ const FindOrCreateTicketService = async (
|
|||
},
|
||||
contactId: groupContact ? groupContact.id : contact.id
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
const { queues, greetingMessage } = await ShowWhatsAppService(whatsappId);
|
||||
|
||||
|
||||
//Habilitar esse caso queira usar o bot
|
||||
// const botInfo = await BotIsOnQueue('botqueue')
|
||||
|
@ -34,7 +33,7 @@ const FindOrCreateTicketService = async (
|
|||
|
||||
|
||||
|
||||
if (ticket) {
|
||||
if (ticket) {
|
||||
await ticket.update({ unreadMessages });
|
||||
}
|
||||
|
||||
|
@ -69,7 +68,7 @@ const FindOrCreateTicketService = async (
|
|||
//[Op.between]: [+subMinutes(new Date(), 30), +new Date()]
|
||||
|
||||
// Sub seconds
|
||||
[Op.between]: [+subSeconds(new Date(), 3), +new Date()]
|
||||
[Op.between]: [+subSeconds(new Date(), 0), +new Date()]
|
||||
},
|
||||
contactId: contact.id
|
||||
},
|
||||
|
|
|
@ -423,15 +423,12 @@ const handleMessage = async (
|
|||
unreadMessages,
|
||||
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
|
||||
if (wbot.id != ticket.whatsappId) {
|
||||
|
||||
console.log('>>> entrou wbot.id: ', wbot.id, ' | ',ticket.whatsappId)
|
||||
|
||||
await ticket.update({ whatsappId: wbot.id });
|
||||
}
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue