mirror of
https://github.com/reality/dbot.git
synced 2025-01-23 18:44:14 +01:00
Fixed 2 crashes when rss database was empty
This commit is contained in:
parent
65d752484f
commit
1756ae84ef
@ -93,6 +93,10 @@ var rss = function(dbot) {
|
|||||||
|
|
||||||
'checkFeeds': function() {
|
'checkFeeds': function() {
|
||||||
console.log("Checking feeds...");
|
console.log("Checking feeds...");
|
||||||
|
if(dbot.db.feeds == null) {
|
||||||
|
console.log("No active feeds...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
for(var i=0;i<dbot.db.feeds.length;++i) {
|
for(var i=0;i<dbot.db.feeds.length;++i) {
|
||||||
this.internalAPI.makeRequest(i,dbot.db.feeds[i]);
|
this.internalAPI.makeRequest(i,dbot.db.feeds[i]);
|
||||||
}
|
}
|
||||||
@ -110,13 +114,17 @@ var rss = function(dbot) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var now = Date.now();
|
var now = Date.now();
|
||||||
|
if(dbot.db.feeds == null)
|
||||||
|
dbot.db.feeds = [];
|
||||||
dbot.db.feeds.push({server:event.server, channel:event.channel.name, name:event.params[1], url:event.params[2], lastPosted: now, newTime: now});
|
dbot.db.feeds.push({server:event.server, channel:event.channel.name, name:event.params[1], url:event.params[2], lastPosted: now, newTime: now});
|
||||||
event.reply("Adding RSS feed named "+event.params[1]+" with URL "+event.params[2]);
|
event.reply("Adding RSS feed named "+event.params[1]+" with URL "+event.params[2]);
|
||||||
},
|
},
|
||||||
|
|
||||||
'~rsstest': function(event) {
|
'~rsstest': function(event) {
|
||||||
event.reply("I posted RSS last @ "+this.lastPosted);
|
event.reply("I posted RSS last @ "+this.lastPosted);
|
||||||
event.reply("Nothing to test. Go home.");
|
event.reply("Checking feeds manually...");
|
||||||
|
this.internalAPI.checkFeeds();
|
||||||
|
event.reply("Call got through!");
|
||||||
},
|
},
|
||||||
|
|
||||||
'~delrssfeed': function(event) {
|
'~delrssfeed': function(event) {
|
||||||
|
Loading…
Reference in New Issue
Block a user