Chat Filter

A simple yet highly configurable plugin to filter your servers chat. Should be compatible with most chat plugins.

677

Chat Filter

Chat Filter

About

Chat Filter is a simple yet highly configurable plugin that uses regex to scan and handle messages. It can support an unlimited number of patterns in an unlimited number of categories, each capable of executing commands and notifying the proper staff when a match is made.

Features:

- Mute and unmute players - Unlimited filter categories - Unlimited Regex patterns per category - Execute commands based off which category was matched - Log filter violations with a discord weblink - Built-in profiler for optimisation - Wide compatibility with other chat plugins - Everything is configurable

Try out GlowCraft's Filter

- [[ GlowCraft's Filter Repo]](https://github.com/PlayGlowCraft/GS-REGEXChatFilter) - Official ChatFilter partner - Regularly updated - High-performance regex patterns - Minimal false-positives

config.yml

```yaml

Chat Filter by _txsla and NBT Archives

This plugin uses MiniMessage to parse messaged

https://docs.advntr.dev/minimessage

[ REGISTER FILTER CATEGORIES ]

Add a category here to register it

The plugin will not recognize categories that are not listed here

Permission 'chatfilter.filter.bypass' will bypass these filters

It is recommended that you put more important categories first on the list.

Messages are filtered from first category in this list to last, so if two filters both match the pattern [a-zA-Z].(.com|.net), only the one listed first will be triggered

The 'gamersafer' list is the official list of GamerSafer.com

registered-categories: - 'demo-websites' - 'demo-all_caps' - 'gamersafer'

[ SPAM LIMITER ]

Every time a player sends a message, it increments a counter

Every x milliseconds that counter is decremented

If a player hits the max messages on their counter, their messages are not shown to other players

Permission `chatfilter.spam.bypass` will bypass this limiter

spam-limiter: enabled: true ghost: true # send player their own messages, so they do not know they are muted count-repeats: true # should repeat messages increment twice? ADD THIS LATER counter-ceiling: 5 # if a player's message counter goes above this number, their messages will be hidden to other players decrement-timer: 3000 # milliseconds between message counter decrements ghost-player: true # should we show the player their cancelled message, so they do not know they are currently muted?

This is the message format sent to ghosted players.

Can also be used to tell players to slow down

Placeholders:

%PLAYER% - player who sent the message

%MESSAGE% - player's message

%SERVER% - server that player is in

%WORLD% - world that player is on

ghost-format: "[GHOSTED] <white><%PLAYER%> %MESSAGE%</white>"

Server Mute settings

Muted players' messages can not be s

mute:

should mods be required ot provide a reason?

require-reason: true

show muted player's their messages

ghost-player: true

[ NOTIFY ]

Notify a player when someone triggers a filter

Players with permission 'chatfilter.notify' will be notified

Placeholders:

%PLAYER% - violator's username

%MESSAGE% - message that triggered the filter

%CATEGORY% - filter category that got triggered

%PATTERN% - regex pattern that matched

%RECIPIENT% - player who is receiving the message

notify: enabled: false message: '<click:suggest_command:"/chatfilter mute %PLAYER% 1h %category% violation"><hover:show_text:"category: <red>%CATEGORY%</red><newline>pattern: <red>%PATTERN%</red><newline><grey>click to mute %player%</grey>"><red>@%RECIPIENT% </red><dark_red>|</dark_red><white> %PLAYER% : %MESSAGE%'

logs violations

log:

Log Message Placeholders:

%PLAYER% - player that triggered the filter

%MESSAGE% - message that triggered the filter

%CATEGORY% - category of filter that got triggered

%PATTERN% - regex pattern that matched

message-format: "%PLAYER% has violated filter %CATEGORY% with message %MESSAGE%" to-file: true to-discord: false webhook: "WEBHOOK URL"

Should scan times be timed?

Use this to optimise your regex patterns

profile: false

enable debug console output

debug: false

```

filter.yml

```yaml

This filter uses regex to match messages and will not work if you set up your expressions correctly

PATTERNS ARE CASE SENSITIVE, design your regex accordingly

Resources:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Cheatsheet

https://regex101.com/

Action tag allowed arguments:

'notify' - notify user as specified in config.yml under notify

(only put one of the below per category)

'cancel' - cancel the message

'ghost' - return message to sender but hide message from other players

'ignore' - does not cancel or modify the message, but still runs the commands

Placeholders for commands (case-sensitive)

%PLAYER% - offending player's username

%UUID% - offending player's UUID

%MESSAGE% - message that triggered the violation

%PATTERN% - pattern that matched the offending text

%CATEGORY% - filter category that got triggered

%WORLD% - world that offending player was in

%IP% - player's IP address, useful for auto IP BANS

You must add the category to the list in config.yml to enable

categories:

Name of category

example:

Whether this category is enabled by default

enabled: false

Action to be taken when violation occurs

action: - 'cancel' - 'notify'

These commands are executed as console when a player triggers the filter

commands: - '/ban %PLAYER%'

Regex patterns for the filter to match

regex: - 'pattern-1' - 'pattern-2' - 'pattern-3'

You can add unlimited categories

This is an example category to block websites in chat

demo-websites: enabled: false action: - 'cancel' commands: - '/chatfilter mute %PLAYER% 5m Chat Filter' regex: - 'https?://' - '[wd-]+.(net|com|org)' - '[d]+.[d]+.[d]+.[d]+'

demo-all_caps: enabled: false action: - 'cancel' commands: - '/chatfilter mute %PLAYER% 1h Chat Filter' regex: - '^[A-Zs]+$'

The GamerSafer Regex list cannot be modified as it uses GamerSafer's official list

If there are ever issues with this filter, please make an issue on ChatFilter's GitHub Page

gamersafer: enabled: false action: - 'cancel' - 'notify' commands: '/mute %PLAYER% 1h'

How strict should the filter be?

0 : exact match, case-insensitive

1 : matches extra letters, case-insensitive

2 : matches whitespace, extra letters, case-insensitive

strictness: 1

For words that have too many false-positives

exclude: - 'cok' - 'iap' - 'sm' - 'ho' - 'hell' ```

Commands

<pre><code> chatfilter |disable <filter> - disable a category |enable <filter> - enable a category |status <filter> - get information on the state of a filter |mute <player> <duration> <reason> - mute a player |unmute <player> - unmute a player |debug | |enable - enable debut output to console without changing config | |disable - stop debug output to console without changing config | query - outputs wether debug output is on or off |profile | |enable - enable built-in profiler without changing config | |disable - disable built-in profiler without changing config | query - return whether profiler is enabled or not </pre></code>

Support

If you stumble across any bugs, please create a support ticket.

ADS