diff options
-rw-r--r-- | src/commands/moderation/hideCase.ts | 2 | ||||
-rw-r--r-- | src/commands/moderation/modlog.ts | 19 |
2 files changed, 10 insertions, 11 deletions
diff --git a/src/commands/moderation/hideCase.ts b/src/commands/moderation/hideCase.ts index 1d8dea6..6cd8e31 100644 --- a/src/commands/moderation/hideCase.ts +++ b/src/commands/moderation/hideCase.ts @@ -41,7 +41,7 @@ export default class HideCaseCommand extends BushCommand { if (!entry || entry.pseudo) return message.util.send(`${util.emojis.error} Invalid entry.`); if (entry.guild !== message.guild!.id) return message.util.reply(`${util.emojis.error} This modlog is from another server.`); - const action = entry.hidden ? 'now hidden' : 'no longer hidden'; + const action = entry.hidden ? 'no longer hidden' : 'now hidden'; entry.hidden = !entry.hidden; await entry.save(); diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts index 459e53c..d1a3900 100644 --- a/src/commands/moderation/modlog.ts +++ b/src/commands/moderation/modlog.ts @@ -46,16 +46,14 @@ export default class ModlogCommand extends BushCommand { }); } - #generateModlogInfo(log: ModLog): string { + #generateModlogInfo(log: ModLog, showUser: boolean): string { const trim = (str: string): string => (str.endsWith('\n') ? str.substring(0, str.length - 1).trim() : str.trim()); - const modLog = [ - `**Case ID**: ${log.id}`, - `**Type**: ${log.type.toLowerCase()}`, - `**User**: <@!${log.user}>`, - `**Moderator**: <@!${log.moderator}>` - ]; + const modLog = [`**Case ID**: ${log.id}`, `**Type**: ${log.type.toLowerCase()}`]; + if (showUser) modLog.push(`**User**: <@!${log.user}>`); + modLog.push(`**Moderator**: <@!${log.moderator}>`); if (log.duration) modLog.push(`**Duration**: ${util.humanizeDuration(log.duration)}`); modLog.push(`**Reason**: ${trim(log.reason ?? 'No Reason Specified.')}`); + modLog.push(`**Date**: ${log.createdAt.toLocaleString()}`); if (log.evidence) modLog.push(`**Evidence:** ${trim(log.evidence)}`); return modLog.join(`\n`); } @@ -74,8 +72,9 @@ export default class ModlogCommand extends BushCommand { order: [['createdAt', 'ASC']] }); const niceLogs = logs - .filter((log) => !log.pseudo || (!log.hidden && !hidden)) - .map((log) => this.#generateModlogInfo(log)); + .filter((log) => !log.pseudo) + .filter((log) => !(log.hidden && hidden)) + .map((log) => this.#generateModlogInfo(log, false)); if (!logs.length || !niceLogs.length) return message.util.reply(`${util.emojis.error} **${foundUser.tag}** does not have any modlogs.`); const chunked: string[][] = util.chunk(niceLogs, 4); @@ -96,7 +95,7 @@ export default class ModlogCommand extends BushCommand { return message.util.reply(`${util.emojis.error} This modlog is from another server.`); const embed = { title: `Case ${entry.id}`, - description: this.#generateModlogInfo(entry), + description: this.#generateModlogInfo(entry, true), color: util.colors.default }; return await util.buttonPaginate(message, [embed]); |