- Supported Skript Version
- 2.11
- 2.12
- Supported Minecraft Versions
- 1.19
- 1.20
- 1.21
# Chat Filter Skript
A flexible chat filter with support for alternate characters, separators, repeated letters, exceptions, and severity levels
Requires:
- oopsk (for structs)
- skript-reflect (for pre-compiled regex patterns)
author: sovde
version: 1.0
license: MIT (do what you want with it)
How to use:
on load:
1. Customize the alternate characters and separators to suit your needs
2. Add filtered phrases with addFilteredPhrase()
If you change alternates or separators after adding phrases, call regeneratePatterns() to update the patterns
when filtering messages, use filterMessage(message, sender) which returns a struct with details of any matches found:
on chat:
set {_result} to filterMessage(message, sender)
if {_result}->matched is true:
cancel event
send "Your message was blocked due to inappropriate content."
The command testFilter <text> can be used to test filtering of a message: '/testFilter badword'
The command stresstest can be used to benchmark performance of filtering 100,000 messages. It takes about 6 seconds on my machine with the default phrases.
NOTE: filtered phrases are NOT saved between server restarts, so you need to add them on load each time.
This can be worked around, but it was intentional to keep the script simple and focused on filtering logic.
A flexible chat filter with support for alternate characters, separators, repeated letters, exceptions, and severity levels
Requires:
- oopsk (for structs)
- skript-reflect (for pre-compiled regex patterns)
author: sovde
version: 1.0
license: MIT (do what you want with it)
How to use:
on load:
1. Customize the alternate characters and separators to suit your needs
2. Add filtered phrases with addFilteredPhrase()
If you change alternates or separators after adding phrases, call regeneratePatterns() to update the patterns
when filtering messages, use filterMessage(message, sender) which returns a struct with details of any matches found:
on chat:
set {_result} to filterMessage(message, sender)
if {_result}->matched is true:
cancel event
send "Your message was blocked due to inappropriate content."
The command testFilter <text> can be used to test filtering of a message: '/testFilter badword'
The command stresstest can be used to benchmark performance of filtering 100,000 messages. It takes about 6 seconds on my machine with the default phrases.
NOTE: filtered phrases are NOT saved between server restarts, so you need to add them on load each time.
This can be worked around, but it was intentional to keep the script simple and focused on filtering logic.