fix: Respect telegram.ban_alert
configuration
Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
parent
5344d742f6
commit
9b533e7ea3
1 changed files with 5 additions and 3 deletions
|
@ -65,7 +65,9 @@ async fn check_new_user(
|
|||
tracing::info!("@{} has been banned because `{re}`", user.username);
|
||||
if config.dry_run {
|
||||
// If it's a dry run, we don't need to ban the user
|
||||
if config.telegram.ban_alert {
|
||||
ban_sender.send(user).await.ok();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -78,7 +80,7 @@ async fn check_new_user(
|
|||
.await
|
||||
{
|
||||
tracing::error!("Error while banning a user: {err}");
|
||||
} else {
|
||||
} else if config.telegram.ban_alert {
|
||||
ban_sender.send(user).await.ok();
|
||||
}
|
||||
} else if let Some(re) = config.expressions.sus.is_match(&user) {
|
||||
|
@ -137,7 +139,7 @@ pub async fn users_fetcher(
|
|||
tracing::info!("Starting users fetcher");
|
||||
loop {
|
||||
tokio::select! {
|
||||
_ = tokio::time::sleep(Duration::from_secs(20)) => {
|
||||
_ = tokio::time::sleep(Duration::from_secs(120)) => {
|
||||
tokio::spawn(check_new_users(
|
||||
Arc::clone(&last_user_id),
|
||||
Arc::clone(&request_client),
|
||||
|
|
Loading…
Reference in a new issue