File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff 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" ] ;
You can’t perform that action at this time.
0 commit comments