From c70b41457aaf843aa8ce27ea5b642bf7a110ac34 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Tue, 12 Jul 2022 12:49:53 +0300 Subject: [PATCH] misc fixes --- src/structure/client/ModerationManager.js | 2 +- src/structure/components/observers/Automoderation.js | 4 ++-- src/structure/components/observers/CommandHandler.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/structure/client/ModerationManager.js b/src/structure/client/ModerationManager.js index d0a4168..ffbc5a2 100644 --- a/src/structure/client/ModerationManager.js +++ b/src/structure/client/ModerationManager.js @@ -438,7 +438,7 @@ class ModerationManager { continue; } - this.logger.debug(`Going to resolve infraction in: ${callBackAt - currentDate} ms`); + this.logger.debug(`Going to resolve infraction in: ${Math.floor((callBackAt - currentDate) / 1000)} s`); this.callbacks.set(infraction.id, { timeout: setTimeout(async () => { diff --git a/src/structure/components/observers/Automoderation.js b/src/structure/components/observers/Automoderation.js index 8c85b03..613b0a2 100644 --- a/src/structure/components/observers/Automoderation.js +++ b/src/structure/components/observers/Automoderation.js @@ -561,8 +561,8 @@ module.exports = class AutoModeration extends Observer { if (!match) return; const result = await wrapper.checkInvite(match.groups.code); - const invite = await this.client.fetchInvite(match.groups.code); - if (whitelist.includes(invite.guild.id)) return; + const invite = await this.client.fetchInvite(match.groups.code).catch(() => null); + if (whitelist.includes(invite?.guild?.id)) return; if (!result) { // Doesn't resolve to the origin server diff --git a/src/structure/components/observers/CommandHandler.js b/src/structure/components/observers/CommandHandler.js index 02e0ddb..d8a4a21 100644 --- a/src/structure/components/observers/CommandHandler.js +++ b/src/structure/components/observers/CommandHandler.js @@ -76,9 +76,9 @@ class CommandHandler extends Observer { emoji: 'failure', ephemeral: true }); - await invoker.deferReply(); const inhibitors = await this._handleInhibitors(invoker); - if(inhibitors.length) return this._generateError(invoker, { type: 'inhibitor', ...inhibitors[0] }); + if (inhibitors.length) return this._generateError(invoker, { type: 'inhibitor', ...inhibitors[0] }); + await invoker.deferReply(); const response = await this._parseInteraction(interaction, command); if (await this._parseResponse(invoker, response)) return;