feat: do not cure bots

This commit is contained in:
oSumAtrIX 2022-09-21 00:00:16 +02:00
parent 5ab333ba5c
commit 97c064ce7f
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -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 {
@ -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();