From f4f58c33a3104a77dc246e94c5c1e98ed75bf16b Mon Sep 17 00:00:00 2001 From: Faf4a <87046111+Faf4a@users.noreply.github.com> Date: Sun, 3 Dec 2023 06:37:16 +0100 Subject: [PATCH 1/4] feat: disableAoiDB --- src/classes/AoiBase.js | 9 +-------- src/handler/AoiStart.js | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/classes/AoiBase.js b/src/classes/AoiBase.js index 6a24da47d..3ed1713b7 100644 --- a/src/classes/AoiBase.js +++ b/src/classes/AoiBase.js @@ -48,10 +48,7 @@ class BaseClient extends Discord.Client { this.variableManager = new VariableManager(this); - if ( - ["default", "aoi.db"].includes(options?.database?.type) || - !options?.database - ) { + if (!options.disableAoiDB && (["default", "aoi.db"].includes(options?.database?.type) || !options?.database)) { const dbData = options?.database; this.db = new Database( @@ -135,10 +132,6 @@ class BaseClient extends Discord.Client { } } - /** - * @param {Record} d - * @param table - */ variables(d, table = this.db?.tables?.[0]) { if (this.db === undefined) { throw new TypeError( diff --git a/src/handler/AoiStart.js b/src/handler/AoiStart.js index e343fcb6d..957b73916 100644 --- a/src/handler/AoiStart.js +++ b/src/handler/AoiStart.js @@ -13,7 +13,7 @@ module.exports = async (client, options) => { await require("./AoiAutoUpdate.js")(client); } - if (client.aoiOptions.database && client.aoiOptions.database) { + if (!client.aoiOptions.disableAoiDB && client.aoiOptions.database && client.aoiOptions.database) { await require("./Custom/timeout.js")( { client, interpreter: Interpreter }, undefined, From 6e1158b3d788e249d08b494184984be22f87b2ea Mon Sep 17 00:00:00 2001 From: Faf4a <87046111+Faf4a@users.noreply.github.com> Date: Sun, 3 Dec 2023 06:38:41 +0100 Subject: [PATCH 2/4] fix: error handling --- src/functions/event/shard.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/functions/event/shard.js b/src/functions/event/shard.js index 0df7970d5..60681e465 100644 --- a/src/functions/event/shard.js +++ b/src/functions/event/shard.js @@ -1,5 +1,6 @@ module.exports = async (d) => { const data = d.util.aoiFunc(d); + if (data.err) return d.error(data.err); const [option] = data.inside.splits; From 233b781ad8b8fec2a30a4167b7f6a5dd20fd6e2c Mon Sep 17 00:00:00 2001 From: Faf4a <87046111+Faf4a@users.noreply.github.com> Date: Sun, 3 Dec 2023 07:01:24 +0100 Subject: [PATCH 3/4] fix: types --- src/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.d.ts b/src/index.d.ts index 9ef515dba..2118343ba 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -191,6 +191,7 @@ declare module "aoi.js" { aoiLogs?: boolean; aoiWarning?: boolean; aoiAutoUpdate?: boolean; + disableAoiDB?: boolean; suppressAllErrors?: boolean; errorMessage?: Array; events?: Array; From ba4706a8a95fe452844db9318646b639f962963d Mon Sep 17 00:00:00 2001 From: Faf4a <87046111+Faf4a@users.noreply.github.com> Date: Sun, 3 Dec 2023 06:09:02 +0000 Subject: [PATCH 4/4] undo removal of types --- src/classes/AoiBase.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/classes/AoiBase.js b/src/classes/AoiBase.js index 3ed1713b7..2cde4e8a9 100644 --- a/src/classes/AoiBase.js +++ b/src/classes/AoiBase.js @@ -131,7 +131,10 @@ class BaseClient extends Discord.Client { }); } } - + /** + * @param {Record} d + * @param table + */ variables(d, table = this.db?.tables?.[0]) { if (this.db === undefined) { throw new TypeError(