From ba3d7dd1665ea6f2e93096fffe0e7cd925ba0d1e Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Sun, 7 Aug 2022 01:03:09 +0300 Subject: [PATCH] misc fixes --- src/structure/components/commands/developer/Stats.js | 1 + src/structure/components/commands/moderation/Case.js | 5 +++-- src/structure/components/observers/GuildLogging.js | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/structure/components/commands/developer/Stats.js b/src/structure/components/commands/developer/Stats.js index 854c0a6..68b5b09 100644 --- a/src/structure/components/commands/developer/Stats.js +++ b/src/structure/components/commands/developer/Stats.js @@ -127,6 +127,7 @@ class StatsCommand extends SlashCommand { } } commandValues.avgTime /= commandResult.length; + commandValues.avgTime = commandValues.avgTime.toFixed(2); const embed = { title: invoker.format('COMMAND_STATS_TITLE', { diff --git a/src/structure/components/commands/moderation/Case.js b/src/structure/components/commands/moderation/Case.js index 439eeee..1a1ee39 100644 --- a/src/structure/components/commands/moderation/Case.js +++ b/src/structure/components/commands/moderation/Case.js @@ -1,6 +1,7 @@ const { Util } = require("../../../../utilities"); const { SlashCommand } = require("../../../interfaces"); const { inspect } = require('util'); +const { InfractionColors, EmbedDefaultColor } = require("../../../../constants/Constants"); class CaseCommand extends SlashCommand { @@ -97,7 +98,7 @@ class CaseCommand extends SlashCommand { const embed = { title: invoker.format(caseTitleIndex, { caseID: id.value }), description, - color: 8662306 + color: InfractionColors[infraction.type], //8662306 }; return { embed }; @@ -108,7 +109,7 @@ class CaseCommand extends SlashCommand { const embed = { title: invoker.format('COMMAND_CASE_CHANGES_TITLE', { case: infraction.case }), - color: 8662306 + color: EmbedDefaultColor }; if (!infraction.changes || !infraction.changes.length) embed.description = invoker.format('COMMAND_CASE_CHANGES_NONE'); diff --git a/src/structure/components/observers/GuildLogging.js b/src/structure/components/observers/GuildLogging.js index 4953c2f..0c62be3 100644 --- a/src/structure/components/observers/GuildLogging.js +++ b/src/structure/components/observers/GuildLogging.js @@ -524,7 +524,7 @@ class GuildLogger extends Observer { const { guild, guildWrapper: wrapper } = oldMessage; if (!guild) return; - if (!oldMessage.member) oldMessage.member = await guild.members.fetch(oldMessage.author); + if (!oldMessage.member) oldMessage.member = await guild.members.fetch(oldMessage.author).catch(() => null); const { member, channel, author, reference } = oldMessage; const settings = await wrapper.settings(); @@ -546,7 +546,7 @@ class GuildLogger extends Observer { return this.client.emit('logError', { guild: wrapper, logger: 'messageLogger', reason: 'MSGLOG_NO_HOOK' }); } - if (bypass && member.roles.cache.size) { + if (bypass && member?.roles.cache.size) { const roles = member.roles.cache.map((r) => r.id); for (const role of bypass) { if (roles.includes(role)) return;