From f4fa286766f0d281e48eaa6cdd894d9654e75b5c Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Wed, 8 May 2024 07:48:05 -0600 Subject: [PATCH] Stop connection before starting, just in case --- index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 48e734a..e621eb5 100644 --- a/index.js +++ b/index.js @@ -239,13 +239,14 @@ xmpp.on("online", async (address) => { }); const start = () => { - xmpp.start().catch((err) => { - console.error(`start failed, ${err}\nGonna try again in 5 seconds...`); - xmpp.stop(); - setTimeout(() => { - start(); - }, 5000); - }); + xmpp.stop().then(() => { + xmpp.start().catch((err) => { + console.error(`start failed, ${err}\nGonna try again in 5 seconds...`); + setTimeout(() => { + start(); + }, 5000); + }); + }); // Do this just in case } // END XMPP