Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
feat: do not cure bots
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Sep 20, 2022
1 parent 5ab333b commit 97c064c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/utils/decancer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ pub async fn cure(
old_if_available: &Option<serenity::Member>,
member: &serenity::Member,
) {
if member.user.bot {
trace!("Skipping decancer for bot {}.", member.user.tag());
return;
}

let name = member.display_name().to_string();

if let Some(old) = old_if_available {
Expand All @@ -22,9 +27,10 @@ pub async fn cure(
}
}

let mut cured_name = DECANCER
.cure(&name)
.replace(|c: char| !(c == ' ' || c == '-' || c == '_' || c.is_ascii_alphanumeric()), "");
let mut cured_name = DECANCER.cure(&name).replace(
|c: char| !(c == ' ' || c == '-' || c == '_' || c.is_ascii_alphanumeric()),
"",
);

if cured_name.is_empty() {
cured_name = "ReVanced user".to_string();
Expand Down

0 comments on commit 97c064c

Please sign in to comment.