diff --git a/index.js b/index.js index 707b06d..7d207a6 100644 --- a/index.js +++ b/index.js @@ -290,6 +290,8 @@ xmpp.on("offline", () => { }) }); +var restartTimer = null; + xmpp.on("stanza", (stanza) => { // Debug stuff if (config.debug >= 2) console.log(`${colors.magenta("[DEBUG]")} Stanza: ${stanza.toString()}`); @@ -315,6 +317,11 @@ xmpp.on("stanza", (stanza) => { } // Get new messages and log them, ignore old messages if (stanza.is("message") && stanza.attrs.type === "groupchat") { + clearTimeout(restartTimer) + restartTimer = setTimeout(() => { + console.log(`${colors.red("[FATAL]")} No messages from weather.im in 10 minutes, restarting!!!!!!!!!!!`) + process.exit(1) + }, 600000) // Stops spam from getting old messages if (startup) return; // Get channel name