Hackily fixed https:// and http:// not matching

This commit is contained in:
benji7425 2016-10-31 23:44:14 +00:00
parent 5661af7b66
commit 6feaf49a97
1 changed files with 3 additions and 1 deletions

View File

@ -18,6 +18,8 @@ var linkRegExp = new RegExp(["http", "https", "www"].join("|"));
var cachedLinks = [];
//caches a link so we can check again later
function cacheLink(link) {
//cheaty way to get around http and https not matching
link = link.replace("https://", "http://");
//store the new link if not stored already
if (!cachedLinks.includes(link)){
cachedLinks.push(link);
@ -72,7 +74,7 @@ function checkLinkAndPost(err, articles) {
if (err) reportError("FEED ERROR: Error reading RSS feed. Details: " + (err.message || err));
else {
//get the latest link and check if it has already been posted and cached
var latestLink = articles[0].link;
var latestLink = articles[0].link.replace("https", "http"); //replace https with http for cheaty way of getting around matching issue
if (!cachedLinks.includes(latestLink)) {
logEvent("Attempting to post new link: " + latestLink);
bot.sendMessage({