From 3174c01b7da2d541f8ee1990ba315007bac441ff Mon Sep 17 00:00:00 2001 From: F2Ville Date: Mon, 12 Feb 2024 23:42:27 +0100 Subject: [PATCH] Working on IRC Bot --- .gitignore | 1 + IRCBot/class/Client.js | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 713d500..055395e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules/ .env +package-lock.json \ No newline at end of file diff --git a/IRCBot/class/Client.js b/IRCBot/class/Client.js index ebef696..30cf1b5 100644 --- a/IRCBot/class/Client.js +++ b/IRCBot/class/Client.js @@ -14,17 +14,21 @@ class IRCClient extends Client { start() { return new Promise((resolve, reject) => { + const timeOutMsg = setTimeout(() => { + this.log("Trying to connect . . . ") + }, 10000) this.on("connected", () => { + clearTimeout(timeOutMsg) this.log("Client connected") resolve() }) - this.on("reconnecting", () => { - this.log("Client reconnecting") + this.on("close", () => { + clearTimeout(timeOutMsg) + this.log(`Can't connect to ${process.env.IRC_HOST}:${process.env.IRC_PORT}`) }) try { - this.log("Trying to connect") this.connect({ host: process.env.IRC_HOST, port: process.env.IRC_PORT,