[BUG]
athilasb opened this issue · comments
Mine, after an average of 1 hour of disconnection, enters this if DisconnectReason.badSession == 500
My version "@whiskeysockets/baileys": "6.7.4",
const { state, saveCreds } = await useMultiFileAuthState("./main-session/" + process.env.INSTANCE);
Mai = MaiConnect({
version: [2, 2413, 1],
logger: pin({ level: "silent" }),
printQRInTerminal: false, // Disabled here, as we will use qrcode-terminal to display
browser: Browsers.macOS("Desktop"),
auth: state,
});
// Handling credentials update
Mai.ev.on("creds.update", saveCreds);
Mai.ev.on("connection.update", (update) => {
const { connection, lastDisconnect, qr } = update;
if (connection === "close") {
let reason = lastDisconnect.error
? lastDisconnect?.error?.output.statusCode
: 0;
if (reason === DisconnectReason.badSession) {
deleteSession("Invalid session, restarting...." + DisconnectReason.badSession + JSON.stringify(Mai.user))
qrGenerated = true;
startMai();
}
}
});
Can anyone help me with this error please?