ソースを参照

Remove mute command before processing

ghorsington 4 年 前
コミット
f8918dc7d1
1 ファイル変更2 行追加2 行削除
  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> {
     async muteUser({ message }: ICommandData): Promise<void> {
+        await tryDo(message.delete());
         const info = await this.parseCommand(message);
         const info = await this.parseCommand(message);
         if (!info.ok)
         if (!info.ok)
             return;
             return;
@@ -156,7 +157,6 @@ export class ViolationPlugin {
 
 
         await this.applyTimedViolation(Mute, info, "mute", handler.start, handler.stop);
         await this.applyTimedViolation(Mute, info, "mute", handler.start, handler.stop);
         await this.sendViolationMessage(message, info, "User has been muted for server violation");
         await this.sendViolationMessage(message, info, "User has been muted for server violation");
-        await tryDo(message.delete());
     }
     }
 
 
     @Command({
     @Command({
@@ -169,8 +169,8 @@ export class ViolationPlugin {
         }
         }
     })
     })
     async unmuteUser({ message }: ICommandData): Promise<void> {
     async unmuteUser({ message }: ICommandData): Promise<void> {
-        await this.removeTimedViolation(Mute, message, "mute");
         await tryDo(message.delete());
         await tryDo(message.delete());
+        await this.removeTimedViolation(Mute, message, "mute");
     }
     }
 
 
     private getViolationHandler(type: ObjectType<TimedViolation>): TimedViolationStopHandler {
     private getViolationHandler(type: ObjectType<TimedViolation>): TimedViolationStopHandler {