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:

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).

The action specifies the action to be taken, such as. There are both "regular" actions and "soft" actions. The soft actions (eg: soft-kill) are not applied to users who are authenticated with Services (preferably with SASL):

For action, see also Spamfilter rule and Setting tags below.

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

You can use any tag name (we use "SCORE" below) and it will exist for the lifetime of connection, until the user gets disconnected.

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++; }

You can also set+block: 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).

Reporting hits
If you are sure you are catching good spambots with your spamfitler block, then you can report spamfilter hits to central services like DroneBL. That way other IRC users benefit from you catching spam/drones (just like you are benefiting from others doing this). See the Spamreport block.