Development (#76)
diff --git a/src/reflex/scanners.ts b/src/reflex/scanners.ts
index a6e94d6..cdfb56b 100644
--- a/src/reflex/scanners.ts
+++ b/src/reflex/scanners.ts
@@ -217,9 +217,13 @@
if (!guildData.logging.staff.channel) return;
const [loose, strict] = [guildData.filters.wordFilter.words.loose, guildData.filters.wordFilter.words.strict];
// Does the username contain filtered words
- const usernameCheck = TestString(member.user.username, loose, strict, guildData.filters.wordFilter.enabled);
// Does the nickname contain filtered words
- const nicknameCheck = TestString(member.nickname ?? "", loose, strict, guildData.filters.wordFilter.enabled);
+ let nameCheck;
+ if(member.nickname) {
+ nameCheck = TestString(member.nickname ?? "", loose, strict, guildData.filters.wordFilter.enabled);
+ } else {
+ nameCheck = TestString(member.user.username, loose, strict, guildData.filters.wordFilter.enabled);
+ }
// Does the profile picture contain filtered words
const avatarTextCheck = TestString(
(await TestImage(member.displayAvatarURL({ forceStatic: true }))) ?? "",
@@ -236,19 +240,15 @@
const nicknameInviteCheck =
guildData.filters.invite.enabled && /discord\.gg\/[a-zA-Z0-9]+/gi.test(member.nickname ?? "");
if (
- usernameCheck !== null ||
- nicknameCheck !== null ||
+ nameCheck !== null ||
avatarCheck ||
inviteCheck ||
nicknameInviteCheck ||
avatarTextCheck !== null
) {
const infractions = [];
- if (usernameCheck !== null) {
- infractions.push(`Username contains a ${usernameCheck.type}ly filtered word (${usernameCheck.word})`);
- }
- if (nicknameCheck !== null) {
- infractions.push(`Nickname contains a ${nicknameCheck.type}ly filtered word (${nicknameCheck.word})`);
+ if (nameCheck !== null) {
+ infractions.push(`Name contains a ${nameCheck.type}ly filtered word (${nameCheck.word})`);
}
if (avatarCheck) {
infractions.push("Profile picture is NSFW");
@@ -288,7 +288,7 @@
new ButtonBuilder().setCustomId(`mod:kick:${member.user.id}`).setLabel("Kick").setStyle(ButtonStyle.Danger),
new ButtonBuilder().setCustomId(`mod:ban:${member.user.id}`).setLabel("Ban").setStyle(ButtonStyle.Danger)
];
- if (usernameCheck !== null || nicknameCheck !== null)
+ if (nameCheck !== null)
buttons.concat([
new ButtonBuilder()
.setCustomId(`mod:nickname:${member.user.id}`)