From 51bfb376cf4f436f8390f3c17226a77813e39d9a Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sat, 30 Nov 2019 22:06:48 +0200 Subject: [PATCH] tags: allow using --delete/-d with !tag to delete tags --- backend/src/plugins/Tags.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/backend/src/plugins/Tags.ts b/backend/src/plugins/Tags.ts index abcdbde9..812162dc 100644 --- a/backend/src/plugins/Tags.ts +++ b/backend/src/plugins/Tags.ts @@ -183,8 +183,20 @@ export class TagsPlugin extends ZeppelinPlugin { msg.channel.createMessage(successMessage(`Tag set! Use it with: \`${prefix}${args.tag}\``)); } - @d.command("tag", "") - async tagSourceCmd(msg: Message, args: { tag: string }) { + @d.command("tag", "", { + options: [ + { + name: "delete", + shortcut: "d", + isSwitch: true, + }, + ], + }) + async tagSourceCmd(msg: Message, args: { tag: string; delete?: boolean }) { + if (args.delete) { + return this.deleteTagCmd(msg, { tag: args.tag }); + } + const tag = await this.tags.find(args.tag); if (!tag) { msg.channel.createMessage(errorMessage("No tag with that name"));