aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation/modlog.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-12-27 13:12:49 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-12-27 13:12:49 -0500
commite05f25f4b98cac3c2409cee9a664ab5ea6251467 (patch)
treef8e3dc4fde8f6deaa543b910acb9a725abbac999 /src/commands/moderation/modlog.ts
parent84f246ebb5ddee984012d3043dcc67ffae806856 (diff)
downloadtanzanite-e05f25f4b98cac3c2409cee9a664ab5ea6251467.tar.gz
tanzanite-e05f25f4b98cac3c2409cee9a664ab5ea6251467.tar.bz2
tanzanite-e05f25f4b98cac3c2409cee9a664ab5ea6251467.zip
better typings and some other stuff
Diffstat (limited to 'src/commands/moderation/modlog.ts')
-rw-r--r--src/commands/moderation/modlog.ts28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts
index 0f2d33c..be6e6b4 100644
--- a/src/commands/moderation/modlog.ts
+++ b/src/commands/moderation/modlog.ts
@@ -1,4 +1,4 @@
-import { BushCommand, ButtonPaginator, ModLog, type BushMessage, type BushSlashMessage, type BushUser } from '#lib';
+import { ArgType, BushCommand, ButtonPaginator, ModLog, type BushMessage, type BushSlashMessage } from '#lib';
import { MessageEmbed, User } from 'discord.js';
export default class ModlogCommand extends BushCommand {
@@ -35,21 +35,9 @@ export default class ModlogCommand extends BushCommand {
});
}
- static 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**: ${util.discord.escapeMarkdown(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**: ${util.timestamp(log.createdAt)}`);
- if (log.evidence) modLog.push(`**Evidence:** ${trim(log.evidence)}`);
- return modLog.join(`\n`);
- }
-
public override async exec(
message: BushMessage | BushSlashMessage,
- { search, hidden }: { search: BushUser | string; hidden: boolean }
+ { search, hidden }: { search: ArgType<'user'> | string; hidden: boolean }
) {
const foundUser = search instanceof User ? search : await util.resolveUserAsync(search);
if (foundUser) {
@@ -90,4 +78,16 @@ export default class ModlogCommand extends BushCommand {
return await ButtonPaginator.send(message, [embed]);
}
}
+
+ public static 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**: ${util.discord.escapeMarkdown(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**: ${util.timestamp(log.createdAt)}`);
+ if (log.evidence) modLog.push(`**Evidence:** ${trim(log.evidence)}`);
+ return modLog.join(`\n`);
+ }
}