From 6feaf49a97b353be9754e05a43ab1e407b797d1b Mon Sep 17 00:00:00 2001 From: benji7425 Date: Mon, 31 Oct 2016 23:44:14 +0000 Subject: [PATCH] Hackily fixed https:// and http:// not matching --- feed-bot.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/feed-bot.js b/feed-bot.js index 32e01e7..46f089a 100644 --- a/feed-bot.js +++ b/feed-bot.js @@ -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({