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

@ -50,37 +50,10 @@ const SendWhatsAppMessage = async ({
if (quotedMsg) {
await GetWbotMessage(ticket, quotedMsg.id);
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) {
const whatsapp = await Whatsapp.findByPk(ticket.whatsappId);
if (whatsapp && whatsapp.status != 'CONNECTED') {
let whatsapps = await wbotByUserQueue(ticket.userId)
@ -122,20 +95,7 @@ const SendWhatsAppMessage = async ({
return sentMessage;
} catch (err) {
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;
// }
const whatsapp = await ShowWhatsAppService(ticket.whatsappId);
throw new AppError("ERR_SENDING_WAPP_MSG");
}