diff --git a/src/cscli/main.ts b/src/cscli/main.ts index 8b7b8ab..9963ed0 100644 --- a/src/cscli/main.ts +++ b/src/cscli/main.ts @@ -40,19 +40,24 @@ export default class CSCLI { // FINISH VERIFICATION CHECKS switch (parsed.Type) { case 'score': - const acc = await this.client.db.Account.findOne({ username: parsed.Username }); - if (!acc) { socket.destroy(); break; } - const pin = await Report.getPIN(acc.userID, this.client.config.internalKey); - if (pin.status !== 'SUCCESS') { socket.destroy(); break; } + try { + const acc = await this.client.db.Account.findOne({ username: parsed.Username }); + if (!acc) { socket.destroy(); break; } + const pin = await Report.getPIN(acc.userID, this.client.config.internalKey); + if (pin.status !== 'SUCCESS') { socket.destroy(); break; } - const report = await Report.soft(acc.userID, pin.pin[2], this.client.config.vendorKey); - if (report.status !== 'SUCCESS') { socket.destroy(); break; } + const report = await Report.soft(acc.userID, pin.pin[2], this.client.config.vendorKey); + if (report.status !== 'SUCCESS') { socket.destroy(); break; } - if (!report.totalScore) { socket.write('N/C\n'); socket.destroy(); break; } - if (report.totalScore === 0) { socket.write('---\n'); socket.destroy(); break; } + if (!report.totalScore) { socket.write('N/C\n'); socket.destroy(); break; } + if (report.totalScore === 0) { socket.write('---\n'); socket.destroy(); break; } - socket.write(`${report.totalScore}\n`); - socket.destroy(); + socket.write(`${report.totalScore}\n`); + socket.destroy(); + } catch { + socket.write('---\n'); + socket.destroy(); + } break; case 'lock': await this.client.util.accounts.lock(parsed.Username, this.client.user.id, { reason: parsed.Message });