Browse Source

Remove mute command before processing

ghorsington 4 years ago
parent
commit
f8918dc7d1
1 changed files with 2 additions and 2 deletions
  1. 2 2
      bot/src/plugins/violation.ts

+ 2 - 2
bot/src/plugins/violation.ts

@@ -144,6 +144,7 @@ export class ViolationPlugin {
         }
     })
     async muteUser({ message }: ICommandData): Promise<void> {
+        await tryDo(message.delete());
         const info = await this.parseCommand(message);
         if (!info.ok)
             return;
@@ -156,7 +157,6 @@ export class ViolationPlugin {
 
         await this.applyTimedViolation(Mute, info, "mute", handler.start, handler.stop);
         await this.sendViolationMessage(message, info, "User has been muted for server violation");
-        await tryDo(message.delete());
     }
 
     @Command({
@@ -169,8 +169,8 @@ export class ViolationPlugin {
         }
     })
     async unmuteUser({ message }: ICommandData): Promise<void> {
-        await this.removeTimedViolation(Mute, message, "mute");
         await tryDo(message.delete());
+        await this.removeTimedViolation(Mute, message, "mute");
     }
 
     private getViolationHandler(type: ObjectType<TimedViolation>): TimedViolationStopHandler {