dont post the thingy if there is no category or author

This commit is contained in:
reality 2014-06-16 15:53:27 +00:00
parent ecec80ac58
commit fbdec17670

View File

@ -52,8 +52,13 @@ var rss = function(dbot) {
}; };
request(options, function (error, response, body) { request(options, function (error, response, body) {
if (!error && response.statusCode == 200) { if (!error && response.statusCode === 200) {
dbot.say(feed.server,feed.channel,"["+feed.name+"] ["+rss.title+"] [Post by "+rss.author+" in "+rss.categories[0]+"] - "+body.id); var rString = "["+feed.name+"] ["+rss.title+"] ";
if(rss.author && rss.categories[0]) {
rString += "[Post by "+rss.author+" in "+rss.categories[0]+"] ";
}
rString += "- "+body.id;
dbot.say(feed.server,feed.channel, rString);
} else { } else {
dbot.say(feed.server,feed.channel,"RSS: Request to shorten URL returned: "+body.id); dbot.say(feed.server,feed.channel,"RSS: Request to shorten URL returned: "+body.id);
} }