From 2727180ea881c7c593cc69c93be6125fede5cb94 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Thu, 13 Aug 2026 15:17:29 -0600 Subject: [PATCH] Handle disconnects from XMPP, which I guess I wasn't doing. --- index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/index.js b/index.js index 430acbf..95ce4f6 100644 --- a/index.js +++ b/index.js @@ -608,6 +608,18 @@ xmpp.on("status", (status) => { })); } }); + + // If status is 'disconnect', attempt to reconnect after 5 seconds + if (status === 'disconnect') { + console.log(`${colors.yellow("[WARN]")} XMPP disconnected, attempting to reconnect in 5 seconds...`); + setTimeout(() => { + console.log(`${colors.yellow("[WARN]")} Attempting to reconnect to XMPP...`); + xmpp.start().catch((err) => { + console.log(`${colors.red("[ERROR]")} XMPP failed to start: ${err}.`); + setTimeout(start, 5000); + }); + }, 5000); + } }); xmpp.reconnect.on("reconnecting", () => {