Implementação de codigo para desativar inicio de sessões do whatsapp

pull/21/head
adriano 2023-01-16 09:34:56 -03:00
parent 0576614473
commit 6673faccbb
2 changed files with 5 additions and 45 deletions

View File

@ -17,5 +17,5 @@ if (global.gc) {
}
initIO(server);
StartAllWhatsAppsSessions();
// StartAllWhatsAppsSessions();
gracefulShutdown(server);

View File

@ -52,35 +52,8 @@ const SendWhatsAppMessage = async ({
quotedMsgSerializedId = SerializeWbotMsgId(ticket, quotedMsg);
}
// let whatsapps: any
// let listWhatsapp = null
// listWhatsapp = await searchWhatsappCache(`${ticket.whatsappId}`, 'CONNECTED')
// if (!listWhatsapp) {
// listWhatsapp = await ListWhatsAppsNumber(ticket.whatsappId, 'CONNECTED')
// }
// if (listWhatsapp.length > 1) {
// console.log('entrou --------------------->')
// const _whatsapp = listWhatsapp[Math.floor(Math.random() * listWhatsapp.length)];
// await ticket.update({ whatsappId: +_whatsapp.id });
// }
// console.log('1 --------> ticket.whatsappId: ', ticket.whatsappId)
const whatsapp = await Whatsapp.findByPk(ticket.whatsappId);
// console.log('whatsapp.status: ', whatsapp?.status)
// if (listWhatsapp.length == 0) {
if (whatsapp && whatsapp.status != 'CONNECTED') {
let whatsapps = await wbotByUserQueue(ticket.userId)
@ -124,19 +97,6 @@ const SendWhatsAppMessage = async ({
const whatsapp = await ShowWhatsAppService(ticket.whatsappId);
await _restore(whatsapp, 'auto_send_message')
// const sentMessage = await sendMessageMultiSession(ticket, body, quotedMsgSerializedId)
// if (sentMessage.length > 0) {
// await ticket.update({ lastMessage: body });
// await updateTicketCacheByTicketId(ticket.id, { lastMessage: body, updatedAt: new Date(ticket.updatedAt).toISOString() })
// return sentMessage;
// }
throw new AppError("ERR_SENDING_WAPP_MSG");
}
};