-
Notifications
You must be signed in to change notification settings - Fork 128
ChatFilter
Misc > ChatFilter filters chat by regex (regular expressions) to make your life less miserable.
Note: It will completely drop matched chat packets. Other mods won't receive them either.
.chatfilter enabled <0/1>
.chatfilter list
- lists all added filters
.chatfilter filter <name> "<regex>"
- adds a new regex filter. Don't forget the quotes around your regex
- any space will mess up the command.
.chatfilter remove <name>
- remove filter by name
Helpful online websites: https://regex101.com/ https://regexr.com/ https://www.freeformatter.com/java-regex-tester.html
Please note: the example filters below don't account for player name/message sender. If you want your filters to actually depend on the beginning of the message (the ^
sign) then you need to add your server's chat message format manually. Public chat messages may be different from whispers etc.
E.g. to make the Discord invite filter only trigger on public messages of 2b2t (don't remove privately sent links), modify it as follows:
(?i)discord(\.gg|app\.com\/invite)\/\w{6,}
→ (?i)^<\w+> .*?discord(\.gg|app\.com\/invite)\/\w{6,}
^<\w+>
will only match messages starting with a nickname prefix
.*?
will match the following space and any irrelevant content
discord
... is the start of your relevant regex that you want to match
- 2b2t public:
<NAME> ChatMessageBeginsHere
- 2b2t public green text:
<NAME> >ChatMessageBeginsHere
-
(?i)>? *(bye|later|good ?(bye|morning|day|evening|afternoon|night)|howdy|hey|farewell|hello|hi|see y(a|ou) (later|next time)|greetings|catcha y(a|ou) later|welcome|good to see y(a|ou))(, )
- Filters all welcome messages. If you want it to only trigger on green text welcome messages, remove
?
after>?
at the beginning
- Filters all welcome messages. If you want it to only trigger on green text welcome messages, remove
-
(?i)>? *I just [a-z]+ \d+ [a-z].*?(!|\.)$
- Filters all "I'm doing XYZ spam" that follows the pattern
>I just <word> <number> <word><...><ends with ! or .>
- Filters all "I'm doing XYZ spam" that follows the pattern
-
(?i)(SMIB ?){4,}
- Filters all
SMIB
spam (repetitions of ≥4)
- Filters all
-
(?i)discord(\.gg|app\.com\/invite)\/\w{6,}
- Filters ANY Discord invite link
// ok I think this is enough to filter 95% of actual spam