3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-30 16:09:27 +01:00

redirects

This commit is contained in:
reality 2016-03-22 23:03:46 +00:00
parent a14d042be2
commit e120869bcd

View File

@ -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)];