Baileys: [BUG] disconnect on average 1 hour DisconnectReason.bad Session == 500
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?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 27 (2 by maintainers)
warning yes
ok, I will try it. I’m not checking all these cases.
In version 6.6.0 this problem does not occur