From 9bfe160e0e597c37c63f3b56e067b5b99b37645c Mon Sep 17 00:00:00 2001 From: Dragory Date: Sun, 6 Jan 2019 15:34:42 +0200 Subject: [PATCH] Add delete_with_command config option to the tags plugin --- src/plugins/Tags.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/Tags.ts b/src/plugins/Tags.ts index fd08aa2b..9d7e1b92 100644 --- a/src/plugins/Tags.ts +++ b/src/plugins/Tags.ts @@ -18,7 +18,7 @@ export class TagsPlugin extends Plugin { return { config: { prefix: "!!", - deleteWithCommand: true + delete_with_command: true }, permissions: { @@ -109,9 +109,11 @@ export class TagsPlugin extends Plugin { const responseMsg = await channel.createMessage(tag.body); // Save the command-response message pair once the message is in our database - this.savedMessages.onceMessageAvailable(responseMsg.id, async theMsg => { - await this.tags.addResponse(msg.id, responseMsg.id); - }); + if (this.configValueForMemberIdAndChannelId(msg.user_id, msg.channel_id, "delete_with_command")) { + this.savedMessages.onceMessageAvailable(responseMsg.id, async () => { + await this.tags.addResponse(msg.id, responseMsg.id); + }); + } } async onMessageDelete(msg: SavedMessage) {