Skip to content

Commit

Permalink
timeout users that have an expired timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettMayson committed Jan 23, 2024
1 parent b95d3e9 commit 20aa47a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bin/bot/src/discord/handler/brain/functions/moderation.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use serde_json::json;
use serenity::prelude::Context;
use serenity::{model::Timestamp, prelude::Context};
use synixe_meta::discord::{channel::LOG, GUILD};
use time::{Duration, OffsetDateTime};

Expand Down Expand Up @@ -68,9 +68,11 @@ impl BrainFunction for Timeout {
error!("failed to get member: {}", id);
continue;
};
if member.communication_disabled_until.is_some() {
info!("user already timed out: {}", member.user.id);
continue;
if let Some(until) = member.communication_disabled_until {
if until > Timestamp::now() {
info!("user already timed out: {}", member.user.id);
continue;
}
}
info!("timing out user: {}", member.user.id);
if let Err(e) = member
Expand Down

0 comments on commit 20aa47a

Please sign in to comment.