diff --git a/src/irc.ts b/src/irc.ts index 5cdda104..a85769ac 100644 --- a/src/irc.ts +++ b/src/irc.ts @@ -1272,12 +1272,7 @@ export class Client extends (EventEmitter as unknown as new () => TypedEmitter TypedEmitter { + this.conn?.removeAllListeners(evtType); + }); + } + private reconnect(retryCount: number) { if (!this.isOurSocket) { // Cannot reconnect if the socket is not ours. @@ -1461,11 +1464,7 @@ export class Client extends (EventEmitter as unknown as new () => TypedEmitter { - this.conn?.removeAllListeners(evtType); - }); + this.unbindListeners(); if (this.isOurSocket) { this.disconnect(); }