Trabalhando no restore automatico

pull/21/head
adriano 2022-12-12 13:02:18 -03:00
parent 330299726d
commit 1ef86354f8
3 changed files with 4 additions and 4 deletions

View File

@ -138,10 +138,7 @@ export const initWbot = async (whatsapp: Whatsapp, backupSessionRestore: boolean
});
wbot.on("ready", async () => {
logger.info(`Session: ${sessionName} READY`);
// console.log('>>>>>>>>>>>>>> ready wbot.ts MOBILE NUMBER: ', wbot.info["wid"]["user"])
// console.log('::::::: WHATSAPP INFO: ', JSON.parse(JSON.stringify(whatsapp)))
logger.info(`Session: ${sessionName} READY`);
if(whatsapp.name.includes(wbot.info["wid"]["user"])){
console.log('-----------------> THIS IS THE RIGHT NUMBER')

View File

@ -8,6 +8,8 @@ import { insertOrUpeateWhatsCache } from "../../helpers/WhatsCache";
export const StartWhatsAppSession = async (whatsapp: Whatsapp, backupSession: boolean = false): Promise<void> => {
await whatsapp.update({ status: "OPENING" });
console.log('kkkkkkkkkkkkkxxxxxxxxxxxxxxxxxx')
await insertOrUpeateWhatsCache(`whatsapp:${whatsapp.id}`, {
status: "OPENING",

View File

@ -60,6 +60,7 @@ const wbotMonitor = async (
wbot.on("disconnected", async reason => {
logger.info(`Disconnected session: ${sessionName}, reason: ${reason}`);
try {
await whatsapp.update({ status: "OPENING", session: "" });
await insertOrUpeateWhatsCache(`whatsapp:${whatsapp.id}`, { status: "OPENING", session: "" })
} catch (err) {