diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-11-28 09:27:41 -0500 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-11-28 09:27:41 -0500 |
commit | 453683b57b8ff013ff25e2aaa4aa1d2e047edcb7 (patch) | |
tree | 8b98d2f30dbb6a8448602446cfacf9091667cc33 /src/commands/moderation/modlog.ts | |
parent | de4c3dcaf172804d34ae708be1ed3e75af42f4d5 (diff) | |
download | tanzanite-453683b57b8ff013ff25e2aaa4aa1d2e047edcb7.tar.gz tanzanite-453683b57b8ff013ff25e2aaa4aa1d2e047edcb7.tar.bz2 tanzanite-453683b57b8ff013ff25e2aaa4aa1d2e047edcb7.zip |
a few small changes
Diffstat (limited to 'src/commands/moderation/modlog.ts')
-rw-r--r-- | src/commands/moderation/modlog.ts | 46 |
1 files changed, 17 insertions, 29 deletions
diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts index 8bdee59..474eaa9 100644 --- a/src/commands/moderation/modlog.ts +++ b/src/commands/moderation/modlog.ts @@ -6,48 +6,36 @@ export default class ModlogCommand extends BushCommand { super('modlog', { aliases: ['modlog', 'modlogs'], category: 'moderation', - description: { - content: "View a user's modlogs, or view a specific case.", - usage: ['modlogs <search> [--hidden]'], - examples: ['modlogs @Tyman'] - }, + description: "View a user's modlogs, or view a specific case.", + usage: ['modlogs <search> [--hidden]'], + examples: ['modlogs @Tyman'], args: [ { id: 'search', + description: 'The case id or user to search for modlogs by.', customType: util.arg.union('user', 'string'), - prompt: { - start: 'What case id or user would you like to see?', - retry: '{error} Choose a valid case id or user.' - } + prompt: 'What case id or user would you like to see?', + retry: '{error} Choose a valid case id or user.', + slashType: 'STRING' }, { id: 'hidden', + description: 'Show hidden modlogs.', + prompt: 'Would you like to see hidden modlogs?', match: 'flag', flag: ['--hidden', '-h'], - default: false + default: false, + optional: true, + slashType: 'BOOLEAN' } ], - clientPermissions: (m) => util.clientSendAndPermCheck(m), - userPermissions: (m) => util.userGuildPermCheck(m, ['MANAGE_MESSAGES']), slash: true, - slashOptions: [ - { - name: 'search', - description: 'What case id or user would you like to see?', - type: 'STRING', - required: true - }, - { - name: 'hidden', - description: 'Would you like to see hidden modlogs?', - type: 'BOOLEAN', - required: false - } - ] + clientPermissions: (m) => util.clientSendAndPermCheck(m), + userPermissions: (m) => util.userGuildPermCheck(m, ['MANAGE_MESSAGES']) }); } - #generateModlogInfo(log: ModLog, showUser: boolean): string { + 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}>`); @@ -75,7 +63,7 @@ export default class ModlogCommand extends BushCommand { const niceLogs = logs .filter((log) => !log.pseudo) .filter((log) => !(log.hidden && hidden)) - .map((log) => this.#generateModlogInfo(log, false)); + .map((log) => ModlogCommand.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 +84,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, true), + description: ModlogCommand.generateModlogInfo(entry, true), color: util.colors.default }; return await ButtonPaginator.send(message, [embed]); |