Working on IRC Bot
This commit is contained in:
parent
811ae9a71b
commit
3174c01b7d
2 changed files with 8 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
|||
node_modules/
|
||||
.env
|
||||
package-lock.json
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue