From d399811cbbfe382fbfc4bc4a45806af6f7ae7702 Mon Sep 17 00:00:00 2001 From: Bsian Date: Sun, 17 Nov 2019 11:07:01 +0000 Subject: [PATCH 1/8] Error handler --- src/api/Security.ts | 2 +- src/api/Server.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/Security.ts b/src/api/Security.ts index e5ec505..a59c64b 100644 --- a/src/api/Security.ts +++ b/src/api/Security.ts @@ -52,7 +52,7 @@ export default class Security { if (saltCheck.salt !== account.salt) return null; return account; } catch (error) { - this.client.signale.debug(error); + this.client.util.handleError(error); return null; } } diff --git a/src/api/Server.ts b/src/api/Server.ts index bc36325..43f77a3 100644 --- a/src/api/Server.ts +++ b/src/api/Server.ts @@ -39,7 +39,7 @@ export default class Server { this.app.use(route.conf.path, route.router); this.client.signale.success(`Successfully loaded route ${route.conf.path}`); } catch (error) { - this.client.signale.error(error); + this.client.util.handleError(error); } }); } From 701eb132cb7a8368e868d5107cc3e9e70cac6ffd Mon Sep 17 00:00:00 2001 From: Bsian Date: Mon, 18 Nov 2019 20:14:43 +0000 Subject: [PATCH 2/8] Added restart command --- src/commands/restart.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/commands/restart.ts diff --git a/src/commands/restart.ts b/src/commands/restart.ts new file mode 100644 index 0000000..0f80600 --- /dev/null +++ b/src/commands/restart.ts @@ -0,0 +1,23 @@ +import { Message } from 'eris'; +import { Client } from '..'; +import { Command } from '../class'; + +export default class Restart extends Command { + constructor(client: Client) { + super(client); + this.name = 'restart'; + this.description = 'Restart the bot'; + this.permissions = { users: ['253600545972027394', '278620217221971968'] }; + this.enabled = true; + } + + public async run(message: Message, args: string[]) { + try { + if (this.client.updating && args[0] !== '-f') return message.channel.createMessage(`${this.client.stores.emojis.error} ***Update in progress***`); + await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Restarting...***`); + return process.exit(1); + } catch (error) { + return this.client.util.handleError(error, message, this); + } + } +} From 99ea3da1969328da315bcccaaf1d3628f93a5393 Mon Sep 17 00:00:00 2001 From: Bsian Date: Mon, 18 Nov 2019 20:21:06 +0000 Subject: [PATCH 3/8] Forgot to include this --- src/Client.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Client.ts b/src/Client.ts index de45cc0..2547f71 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -28,6 +28,8 @@ export default class Client extends Eris.Client { public server: Server; + public updating: Boolean; + constructor() { super(config.token, { getAllUsers: true, restMode: true, defaultImageFormat: 'png' }); @@ -44,6 +46,7 @@ export default class Client extends Eris.Client { displayTimestamp: true, displayFilename: true, }); + this.updating = false; this.events(); this.loadFunctions(); this.init(); From 0fbd44c46321b5979be4565fc7563bd96a1776ed Mon Sep 17 00:00:00 2001 From: Bsian Date: Mon, 18 Nov 2019 20:33:47 +0000 Subject: [PATCH 4/8] Registered the command --- src/commands/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/commands/index.ts b/src/commands/index.ts index 8e6538b..600c9de 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -14,6 +14,7 @@ export { default as Parse } from './parse'; export { default as Parseall } from './parseall'; export { default as Ping } from './ping'; export { default as Pull } from './pull'; +export { default as Restart } from './restart'; export { default as SecureSign } from './securesign'; export { default as Sysinfo } from './sysinfo'; export { default as Unlock } from './unlock'; From c4f91667a37429e3e6d30e1f9b01813e1869163f Mon Sep 17 00:00:00 2001 From: Bsian Date: Mon, 18 Nov 2019 20:36:06 +0000 Subject: [PATCH 5/8] Add genrsa to list --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index afbe239..484ef4b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ package-lock.json htmlEmail_templates yarn-error.log src/keys.json -dist \ No newline at end of file +dist +securesign_genrsa.ts \ No newline at end of file From 4e27477061a49c5bd5c06ba048d802d99c3ebd15 Mon Sep 17 00:00:00 2001 From: Bsian Date: Mon, 18 Nov 2019 20:40:30 +0000 Subject: [PATCH 6/8] Revert "Add genrsa to list" This reverts commit c4f91667a37429e3e6d30e1f9b01813e1869163f. Matt ur a dickhead --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 484ef4b..afbe239 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,4 @@ package-lock.json htmlEmail_templates yarn-error.log src/keys.json -dist -securesign_genrsa.ts \ No newline at end of file +dist \ No newline at end of file From 06265b653e0819a311040c7e22ae5df54e7c6819 Mon Sep 17 00:00:00 2001 From: Bsian Date: Mon, 18 Nov 2019 20:42:18 +0000 Subject: [PATCH 7/8] Don't error if user doesn't have account --- src/commands/bearer.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/commands/bearer.ts b/src/commands/bearer.ts index 08500d4..fd0d70a 100644 --- a/src/commands/bearer.ts +++ b/src/commands/bearer.ts @@ -16,6 +16,7 @@ export default class Bearer extends Command { public async run(message: Message) { try { const account = await this.client.db.Account.findOne({ userID: message.author.id }); + if (!account) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Account not found***`); // eslint-disable-next-line no-underscore-dangle const bearer = await this.client.server.security.createBearer(account._id); const dm = await this.client.getDMChannel(message.author.id); From 9a2c29133127f5b30e18be3429666b0f653732d7 Mon Sep 17 00:00:00 2001 From: Bsian Date: Mon, 18 Nov 2019 20:48:35 +0000 Subject: [PATCH 8/8] Revert "Revert "Add genrsa to list"" This reverts commit 4e27477061a49c5bd5c06ba048d802d99c3ebd15. unlocked file --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index afbe239..484ef4b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ package-lock.json htmlEmail_templates yarn-error.log src/keys.json -dist \ No newline at end of file +dist +securesign_genrsa.ts \ No newline at end of file