Skip to content

Commit 41e2ca5

Browse files
committed
Warn on all but first recent offense
1 parent 47288e4 commit 41e2ca5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/handler.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ impl EventHandler for BotHandler {
6464

6565
async fn guild_member_update(&self, ctx: Context, _: Option<Member>, new: Member) {
6666
if new.roles.contains(&self.config.punishment_role) {
67-
let mut should_warn: bool = false;
6867
let mut user: Option<PunishedUser> = None;
6968
{
7069
let mut state = self.state.lock().expect("Unable to read from state");
@@ -74,8 +73,6 @@ impl EventHandler for BotHandler {
7473
punished.times_punished += 1;
7574
punished.last_punish = SystemTime::now();
7675

77-
should_warn = punished.times_punished >= self.config.warn_threshold;
78-
7976
user = Some(punished.clone());
8077

8178
break;
@@ -90,10 +87,12 @@ impl EventHandler for BotHandler {
9087
times_punished: 1,
9188
last_punish: SystemTime::now(),
9289
});
90+
91+
return
9392
}
9493
}
9594

96-
if should_warn && user.is_some() {
95+
if user.is_some() {
9796
self.warn_mods(&ctx, &user.unwrap()).await;
9897
}
9998
}

0 commit comments

Comments
 (0)