misc fixes

This commit is contained in:
Erik 2022-08-07 01:03:09 +03:00
parent 4c5605f4e4
commit ba3d7dd166
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
3 changed files with 6 additions and 4 deletions

View File

@ -127,6 +127,7 @@ class StatsCommand extends SlashCommand {
} }
} }
commandValues.avgTime /= commandResult.length; commandValues.avgTime /= commandResult.length;
commandValues.avgTime = commandValues.avgTime.toFixed(2);
const embed = { const embed = {
title: invoker.format('COMMAND_STATS_TITLE', { title: invoker.format('COMMAND_STATS_TITLE', {

View File

@ -1,6 +1,7 @@
const { Util } = require("../../../../utilities"); const { Util } = require("../../../../utilities");
const { SlashCommand } = require("../../../interfaces"); const { SlashCommand } = require("../../../interfaces");
const { inspect } = require('util'); const { inspect } = require('util');
const { InfractionColors, EmbedDefaultColor } = require("../../../../constants/Constants");
class CaseCommand extends SlashCommand { class CaseCommand extends SlashCommand {
@ -97,7 +98,7 @@ class CaseCommand extends SlashCommand {
const embed = { const embed = {
title: invoker.format(caseTitleIndex, { caseID: id.value }), title: invoker.format(caseTitleIndex, { caseID: id.value }),
description, description,
color: 8662306 color: InfractionColors[infraction.type], //8662306
}; };
return { embed }; return { embed };
@ -108,7 +109,7 @@ class CaseCommand extends SlashCommand {
const embed = { const embed = {
title: invoker.format('COMMAND_CASE_CHANGES_TITLE', { case: infraction.case }), 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'); if (!infraction.changes || !infraction.changes.length) embed.description = invoker.format('COMMAND_CASE_CHANGES_NONE');

View File

@ -524,7 +524,7 @@ class GuildLogger extends Observer {
const { guild, guildWrapper: wrapper } = oldMessage; const { guild, guildWrapper: wrapper } = oldMessage;
if (!guild) return; 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 { member, channel, author, reference } = oldMessage;
const settings = await wrapper.settings(); 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' }); 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); const roles = member.roles.cache.map((r) => r.id);
for (const role of bypass) { for (const role of bypass) {
if (roles.includes(role)) return; if (roles.includes(role)) return;