Skip to content

Commit

Permalink
case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxIsJoe committed May 3, 2024
1 parent f29a7c5 commit 2272caa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,10 +650,10 @@ export async function BlockBlueVerified(user: BlueBlockerUser, config: Config) {
const disallowedWordsWithoutEmptyStrings = config.disallowedWords.filter(word => word !== '');
if (disallowedWordsWithoutEmptyStrings.length > 0){
// this makes extra sure that emojis are always detected, regardless if they are attached to a word or another string of emojis.
const regex = new RegExp(config.disallowedWords.join('|'));
const wordsInUserName = user.legacy.name.split(/\s+/);
const disallowedWordsAndEmojis = new RegExp(config.disallowedWords.join('|'), 'i');
const wordsInUserName = user.legacy.name.toLocaleLowerCase().split(/\s+/);
for (const word of wordsInUserName) {
if (regex.test(word)) {
if (disallowedWordsAndEmojis.test(word)) {
queueBlockUser(user, String(user.rest_id), ReasonDisallowedWordsOrEmojis);
console.log(logstr, `${config.mute ? 'muted' : 'blocked'} ${formattedUserName} for having disallowed words/emojis in their username.`);
return;
Expand Down

0 comments on commit 2272caa

Please sign in to comment.