Spamfilter block

The spamfilter block allows you to add local spam filters (not network-wide). See the Spamfilter article for more information about spamfilters.

Syntax
spamfilter { match-type [simple|regex]; match ' '; rule " "; /* optional */ target {  }; action ; reason ; ban-time ; };

The match-type is one of: match is the text to match on, which depends on the match-type. Note the use of single quotes in  instead of. Using single quotes will prevent a regex from accidentally be interpreted as an URL by Remote includes.
 * simple (simple matching with ? and * support), or
 * regex for regular PCRE2 expressions (see also Introduction to regex (PCRE))

You specify the targets via target:

action specifies the action to be taken, such as kline. See Actions for a list of all possible actions. New actions since UnrealIRCd 6.1.2 are set (set a tag on the user) and report (report via Spamreport block), see docs in Actions.

reason is used as the reason for the *LINE/kill/block message and ban-time for the duration of the *LINE (it is irrelevant for types like kill, block, etc).

Spamfilter rule
Since UnrealIRCd 6.1.2 there is also rule which acts as a pre-filter, it is evaluated before running the spamfilter, it supports simple matching in a syntax like: :
 * Supported comparison operators are:,   and
 * You can use  (AND) and   (OR) expressions to combine multiple checks
 * The following functions are supported:
 * : number of seconds the user is online
 * : the Reputation score of the user
 * : read the value of a tag set on the user with name TAGNAME

You can combine all these, like:  but the more useful purpose is with tag, see also next section.

Setting tags
Since UnrealIRCd 6.1.2 you can set tags of users. And also, you can have multiple actions, like set + block.

This would bump the SCORE tag up by 1 (and create it with a value of 1 if it does not exist yet): action { set SCORE++; }

Or you can combine it and block the message too: action { set SCORE++; block; }

Combined with this allows you to combine things like:

spamfilter { match-type simple; match "this is one line"; target { private; channel; } action { set SCORE++; } reason "Hit one"; }

spamfilter { match-type simple; match "this is another line"; target { private; channel; } action { set SCORE++; } reason "Hit two"; }

spamfilter { rule "tag(SCORE)>1"; action kill; reason "Score is at least 2!"; }

The last spamfilter block from above is special, you can see it has no match and it has no target. Such spamfilter blocks run when a tag has changed in value for the user (like by the "Hit one" and "Hit two" blocks before that).