Trabalhando no restore automatico
parent
330299726d
commit
1ef86354f8
|
@ -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')
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue