In order to use the spam filter, you must move it to your gossip directory. You can find your gossip directory by navigating to Help > About.
It needs to be named filter.rhai
The script works out of the box, but you may wish to edit it. There are comments at the top explaining how it works.