ChatCensor

Methods
1
Fields
None

Methods

MethodReturnsDescription
censorMessage({Pattern}, {Pattern}, string?, string, any, boolean?)string?Censors one chat line in a single call, for a chat filter censoring every line the chatbox builds, once per chatFilterCheck callback. `pa…

Method details

censorMessage

censorMessage: ({Pattern}, {Pattern}, string?, string, any, boolean?) -> string?

Censors one chat line in a single call, for a chat filter censoring every line the chatbox builds, once per chatFilterCheck callback. patterns and namePatterns are the plugin's compiled word and name patterns; filterType is the plugin's ChatFilterType constant, or its name ("CENSOR_WORDS", "CENSOR_MESSAGE", "REMOVE_MESSAGE"). A username a name pattern finds (standardized) is censored whole; otherwise the message, unescaped and cut to the Jagex printable characters (U+00A0 as a space), has every match of each pattern replaced by *s, matched on the accent-stripped copy when stripAccents, and is escaped again; nil means remove the message. A Luau Matcher/StringBuilder loop doing the same costs about 3 µs a line; this, a fraction of one. stripAccents strips the Latin-1 accents, the only ones a chat line keeps here.