From 021e2920ab1005364c94f361d9bc38fde9f35adb Mon Sep 17 00:00:00 2001 From: emerson Date: Wed, 9 Feb 2022 07:54:03 -0500 Subject: [PATCH] Fix missing parameter for 900, catch connection error --- src/Client.ts | 8 ++++++-- src/numerics.ts | 6 ------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Client.ts b/src/Client.ts index 0003bc4..f22657c 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -188,8 +188,8 @@ export class Client { this.closeConnectionWithError('access token does not match mxid, please check credentials') } else { this.user = thisIRCUser; - this.sendMessage(this.server.name, '900', numerics['900'](this.user.getMask(), this.user.nick)); - this.sendMessage(this.server.name, '903', numerics['903'](this.user.nick)); + this.sendMessage(this.server.name, '900', [this.user.nick, this.user.getMask(), this.user.accountName, `You are now logged in as ${this.user.nick}`]); + this.sendMessage(this.server.name, '903', [this.user.nick, "SASL authentication successful"]); if (this.user.isSynced()) { this.user.addClient(this); } else { @@ -214,6 +214,10 @@ export class Client { }) } } + }).catch((error) => { + console.log(error); + this.sendMessage(this.server.name, '904', numerics['904']('*')) + this.closeConnectionWithError('Error connecting to the Matrix server') }) } } diff --git a/src/numerics.ts b/src/numerics.ts index 628a8bc..de3778b 100644 --- a/src/numerics.ts +++ b/src/numerics.ts @@ -38,12 +38,6 @@ const numerics = { "433": (nick: string, otherNick: string) => { return [nick, otherNick, "Nickname is already in use"] }, - "900": (mask: string, nick: string) => { - return [nick, mask, `You are now logged in as ${nick}`] - }, - "903": (nick: string) => { - return [nick, "SASL authentication successful"] - }, "904": (nick: string) => { return [nick, "SASL authentication failed"] },