Linting & wrapping some utility functions on the String prototype so they don't clobb...
[KiwiIRC.git] / node / kiwi_modules / spamfilter.js
1 /*
2 * Example Kiwi module.
3 * This is by no means is a production ready module.
4 */
5
6 var filters;
7 var compiled_regex;
8
9 exports.onload = function(){
10 filters = ['sad', 'kill', 'death'];
11 compiled_regex = new RegExp(filters.join('|'), 'im');
12 }
13
14
15 exports.onmsg = function(msg){
16 if (msg.msg.search(compiled_regex) > -1) {
17 return null;
18 }
19
20 return msg;
21 }