From 7add24561239e019678f88cc893fb854a9ffee42 Mon Sep 17 00:00:00 2001
From: Will Hunt <will@half-shot.uk>
Date: Thu, 16 May 2019 18:48:32 +0100
Subject: [PATCH] Lock the other things

---
 src/bot.ts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/bot.ts b/src/bot.ts
index 7880b35..21e29e5 100644
--- a/src/bot.ts
+++ b/src/bot.ts
@@ -404,8 +404,8 @@ export class DiscordBot {
         }
         this.lockChannel(channel);
         const res = await channel.send(msg);
-        this.unlockChannel(channel);
         await this.StoreMessagesSent(res, channel, event);
+        this.unlockChannel(channel);
     }
 
     public async send(
@@ -640,8 +640,8 @@ export class DiscordBot {
             res = await botChannel.send(
                 `${kickee} was unbanned from this channel by ${kicker}.`,
             ) as Discord.Message;
-            this.unlockChannel(botChannel);
             this.sentMessages.push(res.id);
+            this.unlockChannel(botChannel);
             return;
         }
         const existingPerms = tchan.memberPermissions(kickee);
@@ -655,8 +655,8 @@ export class DiscordBot {
             `${kickee} was ${word} from this channel by ${kicker}.`
             + (reason ? ` Reason: ${reason}` : ""),
         ) as Discord.Message;
-        this.unlockChannel(botChannel);
         this.sentMessages.push(res.id);
+        this.unlockChannel(botChannel);
         log.info(`${word} ${kickee}`);
 
         await tchan.overwritePermissions(kickee,
-- 
GitLab