aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation/modlog.ts
diff options
context:
space:
mode:
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`);
+ }
}