From 61471e80dcfb1166eff7967db30c4a7d1519dc58 Mon Sep 17 00:00:00 2001 From: amki Date: Sat, 24 May 2014 00:46:01 +0000 Subject: [PATCH] Fixed feeds having seperate last posted times --- modules/rss/rss.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/modules/rss/rss.js b/modules/rss/rss.js index 809265b..07c588d 100644 --- a/modules/rss/rss.js +++ b/modules/rss/rss.js @@ -6,10 +6,13 @@ var FeedParser = require('feedparser') , request = require('request'); var rss = function(dbot) { + this.pollInterval = 60000; var self = this; this.intervals = []; this.internalAPI = { - 'makeRequest': function(server,channel,name,url) { + 'makeRequest': function(id,server,channel,name) { + var url = dbot.db.feeds[id].url; + var lastPosted = dbot.db.feeds[id].lastPosted; var req = request(url); var feedparser = new FeedParser(); req.on('error', function (error) { @@ -36,17 +39,20 @@ var rss = function(dbot) { , item; while (item = stream.read()) { - if(item.pubdate - self.lastPosted > 0) + if(item.pubdate - lastPosted > 0) { + lastPosted = item.pubdate; dbot.say(server,channel,"["+name+"] ["+item.title+"] [Post by "+item.author+" in "+item.categories[0]+"] - "+item.link); + } } }); }.bind(this), 'reloadFeeds': function() { for(var i=0;i