From 93571bcbfe06f00dfbac4e94a09b0b89a53e40d7 Mon Sep 17 00:00:00 2001 From: Dragory Date: Thu, 7 Feb 2019 20:36:57 +0200 Subject: [PATCH] Add --mod to !addcase --- src/plugins/ModActions.ts | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/plugins/ModActions.ts b/src/plugins/ModActions.ts index e231fcf6..11f03a53 100644 --- a/src/plugins/ModActions.ts +++ b/src/plugins/ModActions.ts @@ -85,7 +85,8 @@ export class ModActionsPlugin extends ZeppelinPlugin { view: false, addcase: false, massban: true, - hidecase: false + hidecase: false, + addcase_other: false }, overrides: [ { @@ -104,7 +105,8 @@ export class ModActionsPlugin extends ZeppelinPlugin { level: ">=100", permissions: { massban: true, - hidecase: true + hidecase: true, + addcase_other: true } } ] @@ -823,7 +825,9 @@ export class ModActionsPlugin extends ZeppelinPlugin { } } - @d.command("addcase", " [reason:string$]") + @d.command("addcase", " [reason:string$]", { + options: [{ name: "mod", type: "user" }] + }) @d.permission("addcase") async addcaseCmd(msg: Message, args: any) { // Verify the user id is a valid snowflake-ish @@ -846,10 +850,20 @@ export class ModActionsPlugin extends ZeppelinPlugin { return; } + let modId = msg.author.id; + if (args.mod) { + if (!this.hasPermission("addcase_other", { message: msg })) { + msg.channel.createMessage(errorMessage("No permission for --mod")); + return; + } + + modId = args.mod.id; + } + // Create the case const theCase: Case = await this.actions.fire("createCase", { userId: args.target, - modId: msg.author.id, + modId, type: CaseTypes[type], reason: args.reason });