Filter Module
Implements customizable filters that search for forbiddan words or phrases and removes them with a customizable response and excludable channels. Optionally also adds pressure to the user for triggering a filter, and if the response is set to !, doesn't remove the message at all, only adding pressure.
If you just want a basic case-insensitive word filter that respects spaces, use
!setconfig filter.templates
with your filter name and this template:
(?i)(^| )%%($| )
.
Example usage:
!setfilter badwords "This is a christian server, no swearing allowed." !setconfig filter.templates badwords (?i)(^| )%%($| ) !addfilter badwords hell !addfilter badwords "jesus christ"
Configuration
-
filter.channels
A collection of channel exclusions for each filter. -
filter.filters
A collection of word lists for each filter. These are combined into a single regex of the form(word1|word2|etc...)
, depending on the filter template. -
filter.pressure
The amount of pressure added to the user when the filter is triggered (defaults to 0). -
filter.responses
The response message sent by each filter when triggered. If this is set to!
, the bot won't respond AND she won't delete the message, only the pressure will be added. -
filter.templates
The template used to construct the regex.%%
is replaced with(word1|word2|etc...)
using the filter's word list. Example:\[\]\(\/r?%%[-) "]
is transformed into\[\]\(\/r?(word1|word2)[-) "]
SetFilter
!setfilter <filter> [response] [channels]
Sets the [filter] response to [response] and it's excluded channel list to [channels]. Creates the filter if it doesn't exist.
-
filter
The name of a filter. -
response
(optional) The message that will be sent when a message is deleted. Can be left blank, but quotes are mandatory. -
channels
(optional) All additional arguments should be channels to exclude the filter from.
AddFilter
!addfilter <filter> <arbitrary string>
Adds [arbitrary string] to [filter] and recompiles the filter regex.
-
filter
The name of a filter. The filter must exist. Create a new filter by using !setfilter. -
arbitrary string
Arbitrary string to add to the filter. Quotes aren't necessary, but cannot be empty.
RemoveFilter
!removefilter <filter> <arbitrary string>
Removes [arbitrary string] from [filter], then recompiles the regex.
-
filter
The name of a filter. The filter must exist. Create a new filter by using !setfilter. -
arbitrary string
Arbitrary string to remove from the filter. Quotes aren't necessary, but cannot be empty.
DeleteFilter
!deletefilter <filter>
Deletes a filter and all of its settings.
-
filter
The name of a filter. The filter must exist. Create a new filter by using !setfilter.
SearchFilter
!searchfilter <filter> [arbitrary string]
Returns all terms of the given filter that contain the given string.
-
filter
The name of the filter. The filter must exist. Create a new filter by using !setfilter. -
arbitrary string
(optional) Arbitrary string to add to filter. If not provided, will simply return entire contents of the filter.