Skip to content

Commit d623e26

Browse files
authored
Update iochat.js
1 parent 87fad9a commit d623e26

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

js/iochat.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,19 @@ $(document).ready(function() {
420420
filterMessages();
421421
}
422422

423+
// Convert the pattern into a regex
424+
const regexPattern = pattern.replace(/\*/g, '.*'); // Replace '*' with '.*' for regex
425+
const regex = new RegExp(`^${regexPattern}`, 'i'); // Create a case-insensitive regex
426+
427+
// Check if the username matches the regex
428+
if (regex.test(username)) {
429+
console.log(`The username '${username}' has been blocked due to matching the pattern '${pattern}'.`);
430+
blockedUsers.push(username);
431+
updateBlockedUsersList();
432+
filterMessages();
433+
return;
434+
}
435+
423436
// Function to unblock all users
424437
function unblockAllUsers() {
425438
blockedUsers = ["a bot"];

0 commit comments

Comments
 (0)