aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation/hideCase.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-05 20:24:50 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-05 20:24:50 -0400
commitc4c1d9ffeb179e208792c88dd099caea5030581b (patch)
treedc075bda115de5f6cec925c398f3c9547d1bad55 /src/commands/moderation/hideCase.ts
parentc238b0279c7686ca45506b0909e376f241cf0e30 (diff)
downloadtanzanite-c4c1d9ffeb179e208792c88dd099caea5030581b.tar.gz
tanzanite-c4c1d9ffeb179e208792c88dd099caea5030581b.tar.bz2
tanzanite-c4c1d9ffeb179e208792c88dd099caea5030581b.zip
add moderation logging, fixes, hide modlog, jank
Diffstat (limited to 'src/commands/moderation/hideCase.ts')
-rw-r--r--src/commands/moderation/hideCase.ts50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/commands/moderation/hideCase.ts b/src/commands/moderation/hideCase.ts
new file mode 100644
index 0000000..1d8dea6
--- /dev/null
+++ b/src/commands/moderation/hideCase.ts
@@ -0,0 +1,50 @@
+import { BushCommand, BushMessage, BushSlashMessage, ModLog } from '@lib';
+
+export default class HideCaseCommand extends BushCommand {
+ public constructor() {
+ super('hideCase', {
+ aliases: ['hidecase', 'hide_case', 'showcase', 'show_case', 'coverupmodabuse', 'cover_up_mod_abuse'],
+ category: 'moderation',
+ description: {
+ content: 'Hide a particular modlog case from the modlog command unless the `--hidden` flag is specified',
+ usage: 'hideCase <caseID>',
+ examples: ['hideCase 9210b1ea-91f5-4ea2-801b-02b394469c77']
+ },
+ args: [
+ {
+ id: 'case',
+ type: 'string',
+ prompt: {
+ start: 'What modlog case would you like to hide?',
+ retry: '{error} Choose a valid case id.'
+ }
+ }
+ ],
+ userPermissions: ['MANAGE_MESSAGES'],
+ slash: true,
+ slashOptions: [
+ {
+ name: 'case',
+ description: 'What modlog case would you like to hide?',
+ type: 'STRING',
+ required: true
+ }
+ ],
+ channel: 'guild'
+ });
+ }
+
+ public override async exec(message: BushMessage | BushSlashMessage, { case: caseID }: { case: string }): Promise<unknown> {
+ if (message.author.id === '496409778822709251')
+ return await message.util.reply(`${util.emojis.error} This command is Bestower proof.`);
+ const entry = await ModLog.findByPk(caseID);
+ 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';
+ entry.hidden = !entry.hidden;
+ await entry.save();
+
+ return await message.util.reply(`${util.emojis.success} CaseID \`${caseID}\` is ${action}.`);
+ }
+}