Working on IRC Bot

This commit is contained in:
F2Ville 2024-02-12 23:42:27 +01:00
parent 811ae9a71b
commit 3174c01b7d
2 changed files with 8 additions and 3 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
node_modules/ node_modules/
.env .env
package-lock.json

View file

@ -14,17 +14,21 @@ class IRCClient extends Client {
start() { start() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const timeOutMsg = setTimeout(() => {
this.log("Trying to connect . . . ")
}, 10000)
this.on("connected", () => { this.on("connected", () => {
clearTimeout(timeOutMsg)
this.log("Client connected") this.log("Client connected")
resolve() resolve()
}) })
this.on("reconnecting", () => { this.on("close", () => {
this.log("Client reconnecting") clearTimeout(timeOutMsg)
this.log(`Can't connect to ${process.env.IRC_HOST}:${process.env.IRC_PORT}`)
}) })
try { try {
this.log("Trying to connect")
this.connect({ this.connect({
host: process.env.IRC_HOST, host: process.env.IRC_HOST,
port: process.env.IRC_PORT, port: process.env.IRC_PORT,