mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-09-07 16:55:29 -05:00
Convert messages to Unicode NFKC in filter (#5905)
This commit is contained in:
committed by
Guangcong Luo
parent
8760b8526f
commit
21ce0229f4
@@ -139,6 +139,12 @@ Chat.registerMonitor('evasion', {
|
||||
punishment: 'EVASION',
|
||||
label: 'Filter Evasion Detection',
|
||||
monitor(line, room, user, message, lcMessage, isStaff) {
|
||||
// Many codepoints used in filter evasion detection can be decomposed
|
||||
// into multiple codepoints that are canonically equivalent to the
|
||||
// original. Perform a canonical composition on the message to detect
|
||||
// when people attempt to evade by abusing this behaviour of Unicode.
|
||||
lcMessage = lcMessage.normalize('NFKC');
|
||||
|
||||
let [regex, word, reason] = line;
|
||||
// Remove spaces and obvious false positives
|
||||
lcMessage = lcMessage.replace(/[\s-_,.]/g, '');
|
||||
|
||||
Reference in New Issue
Block a user