From e120869bcd05b3752c9255346a2859376ab83db0 Mon Sep 17 00:00:00 2001 From: reality Date: Tue, 22 Mar 2016 23:03:46 +0000 Subject: [PATCH] redirects --- modules/wikipedia/wikipedia.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/wikipedia/wikipedia.js b/modules/wikipedia/wikipedia.js index 183c8b4..c40ea66 100644 --- a/modules/wikipedia/wikipedia.js +++ b/modules/wikipedia/wikipedia.js @@ -25,6 +25,7 @@ var wikipedia = function(dbot) { body = body[prop].revisions[0]['*']; var oBody = body; + console.log(body); var redirect = body.match(/#redirect \[\[(.+)\]\]/i); if(redirect) { @@ -49,7 +50,7 @@ var wikipedia = function(dbot) { body = _.filter(body, function(line) { var spaces = line.match(/\s/g); - return line != '' && !line.match(/^\s+$/) && !line.match(/^!/) && !line.match(/^Category:/) && !line.match(/http:\/\//) && !line.match(/\|/) && !line.match(/:$/) && spaces && spaces.length > 10 && spaces.length < 60; + return line != '' && !line.match(/{|}/) && !line.match(/'''/) && !line.match(/^\s+$/) && !line.match(/^!/) && !line.match(/^Category:/) && !line.match(/http:\/\//) && !line.match(/\|/) && !line.match(/:$/) && spaces && spaces.length > 10 && spaces.length < 60; }); var sentence = body[_.random(0, body.length -1)];