From 02dd19b0afcbccc9bb112a24508d73c53bbc086a Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Mon, 13 Jun 2022 12:42:43 +0300 Subject: [PATCH] misc fixes --- src/structure/client/ModerationManager.js | 1 + src/structure/components/commands/developer/Eval.js | 4 ++-- src/structure/components/observers/Automoderation.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/structure/client/ModerationManager.js b/src/structure/client/ModerationManager.js index 66b4660..5c6c3d8 100644 --- a/src/structure/client/ModerationManager.js +++ b/src/structure/client/ModerationManager.js @@ -433,6 +433,7 @@ class ModerationManager { }; for (const infraction of infractions) { + if(!infraction) throw new Error('Undefined infraction'); const callBackAt = infraction.timestamp + infraction.duration; if (callBackAt - currentDate <= 0) { await resolve(infraction); diff --git a/src/structure/components/commands/developer/Eval.js b/src/structure/components/commands/developer/Eval.js index 57295c4..efb7d39 100644 --- a/src/structure/components/commands/developer/Eval.js +++ b/src/structure/components/commands/developer/Eval.js @@ -27,8 +27,8 @@ class EvalCommand extends Command { let response = null; try { - let evaled = eval(params); //eslint-disable-line no-eval - if (evaled instanceof Promise) await evaled; + let evaled = await eval(params); //eslint-disable-line no-eval + // if (evaled instanceof Promise) await evaled; if (typeof evaled !== 'string') evaled = inspect(evaled); evaled = evaled .replace(new RegExp(this.client.token, 'gu'), '') diff --git a/src/structure/components/observers/Automoderation.js b/src/structure/components/observers/Automoderation.js index d36916f..d3b8b05 100644 --- a/src/structure/components/observers/Automoderation.js +++ b/src/structure/components/observers/Automoderation.js @@ -106,7 +106,7 @@ module.exports = class AutoModeration extends Observer { const { guild, author, channel, guildWrapper: wrapper } = message; if (!guild || author.bot) return; - const member = message.member || await guild.members.fetch(author.id).catch(); + const member = message.member || await guild.members.fetch(author.id).catch(() => null); const settings = await wrapper.settings(); const { wordfilter: setting } = settings; const { bypass, ignore, enabled, silent, explicit, fuzzy, regex, whitelist, actions } = setting;