diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-05 21:45:29 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-05 21:45:29 -0400 |
commit | e3c116e0f4b741032fe777936fdf5d80f0b011e6 (patch) | |
tree | 024bd9884f1456983faae2b62b59485a879ac934 /src/commands/moderation | |
parent | c8a5bfe694ee6e784a0c5cbe1a7076b1c055249a (diff) | |
download | tanzanite-e3c116e0f4b741032fe777936fdf5d80f0b011e6.tar.gz tanzanite-e3c116e0f4b741032fe777936fdf5d80f0b011e6.tar.bz2 tanzanite-e3c116e0f4b741032fe777936fdf5d80f0b011e6.zip |
modlogid uuid -> nanoid
Diffstat (limited to 'src/commands/moderation')
-rw-r--r-- | src/commands/moderation/modlog.ts | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts index 0be6971..459e53c 100644 --- a/src/commands/moderation/modlog.ts +++ b/src/commands/moderation/modlog.ts @@ -1,5 +1,5 @@ import { BushCommand, BushMessage, BushSlashMessage, BushUser, ModLog } from '@lib'; -import { User } from 'discord.js'; +import { MessageEmbed, User } from 'discord.js'; export default class ModlogCommand extends BushCommand { public constructor() { @@ -23,7 +23,7 @@ export default class ModlogCommand extends BushCommand { { id: 'hidden', match: 'flag', - flags: ['--hidden', '-h'], + flag: ['--hidden', '-h'], default: false } ], @@ -51,8 +51,8 @@ export default class ModlogCommand extends BushCommand { const modLog = [ `**Case ID**: ${log.id}`, `**Type**: ${log.type.toLowerCase()}`, - `**User**: <@!${log.user}> (${log.user})`, - `**Moderator**: <@!${log.moderator}> (${log.moderator})` + `**User**: <@!${log.user}>`, + `**Moderator**: <@!${log.moderator}>` ]; if (log.duration) modLog.push(`**Duration**: ${util.humanizeDuration(log.duration)}`); modLog.push(`**Reason**: ${trim(log.reason ?? 'No Reason Specified.')}`); @@ -73,14 +73,20 @@ export default class ModlogCommand extends BushCommand { }, order: [['createdAt', 'ASC']] }); - if (!logs.length) return message.util.reply(`${util.emojis.error} **${foundUser.tag}** does not have any modlogs.`); - const niceLogs = logs.filter((log) => !log.pseudo && !log.hidden && !hidden).map((log) => this.#generateModlogInfo(log)); - const chunked: string[][] = util.chunk(niceLogs, 3); - const embedPages = chunked.map((chunk) => ({ - title: `${foundUser.tag}'s Mod Logs`, - description: chunk.join('\n━━━━━━━━━━━━━━━\n'), - color: util.colors.default - })); + const niceLogs = logs + .filter((log) => !log.pseudo || (!log.hidden && !hidden)) + .map((log) => this.#generateModlogInfo(log)); + 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); + const embedPages = chunked.map( + (chunk) => + new MessageEmbed({ + title: `${foundUser.tag}'s Mod Logs`, + description: chunk.join('\n━━━━━━━━━━━━━━━\n'), + color: util.colors.default + }) + ); return await util.buttonPaginate(message, embedPages, undefined, true); } else if (search) { const entry = await ModLog.findByPk(search as string); |