From 2d0f4ead203f111d622bc75819718c6058d3d934 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Thu, 2 May 2019 08:28:49 +0300 Subject: [PATCH] Remove deprecated expand/hidden opts from !cases, use --expand/--hidden instead --- src/plugins/ModActions.ts | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/plugins/ModActions.ts b/src/plugins/ModActions.ts index 95b040b9..9d9f2b98 100644 --- a/src/plugins/ModActions.ts +++ b/src/plugins/ModActions.ts @@ -1223,7 +1223,7 @@ export class ModActionsPlugin extends ZeppelinPlugin { msg.channel.createMessage(embed); } - @d.command("cases", " [opts:string$]", { + @d.command("cases", "", { options: [ { name: "expand", @@ -1238,7 +1238,7 @@ export class ModActionsPlugin extends ZeppelinPlugin { ], }) @d.permission("can_view") - async userCasesCmd(msg: Message, args: { user: string; opts?: string; expand?: boolean; hidden?: boolean }) { + async userCasesCmd(msg: Message, args: { user: string; expand?: boolean; hidden?: boolean }) { const user = await this.resolveUser(args.user); if (!user) return this.sendErrorMessage(msg.channel, `User not found`); @@ -1254,10 +1254,9 @@ export class ModActionsPlugin extends ZeppelinPlugin { if (cases.length === 0) { msg.channel.createMessage(`No cases found for **${userName}**`); } else { - const showHidden = args.hidden || (args.opts && args.opts.match(/\bhidden\b/)); - const casesToDisplay = showHidden ? cases : normalCases; + const casesToDisplay = args.hidden ? cases : normalCases; - if (args.expand || (args.opts && args.opts.match(/\b(expand|e)\b/))) { + if (args.expand) { if (casesToDisplay.length > 8) { msg.channel.createMessage("Too many cases for expanded view. Please use compact view instead."); return; @@ -1278,7 +1277,7 @@ export class ModActionsPlugin extends ZeppelinPlugin { lines.push(caseSummary); } - if (!showHidden && hiddenCases.length) { + if (!args.hidden && hiddenCases.length) { if (hiddenCases.length === 1) { lines.push(`*+${hiddenCases.length} hidden case, use "--hidden" to show it*`); } else { @@ -1296,14 +1295,6 @@ export class ModActionsPlugin extends ZeppelinPlugin { createChunkedMessage(msg.channel, finalMessage); } - - if ((args.opts && args.opts.match(/\bhidden\b/)) || (args.opts && args.opts.match(/\b(expand|e)\b/))) { - msg.channel.createMessage( - `<@!${ - msg.author.id - }> **Note:** expand/hidden have been replaced with --expand/--hidden (and -e/-h as shortcuts)`, - ); - } } }