Hackily fixed https:// and http:// not matching
This commit is contained in:
parent
5661af7b66
commit
6feaf49a97
|
@ -18,6 +18,8 @@ var linkRegExp = new RegExp(["http", "https", "www"].join("|"));
|
||||||
var cachedLinks = [];
|
var cachedLinks = [];
|
||||||
//caches a link so we can check again later
|
//caches a link so we can check again later
|
||||||
function cacheLink(link) {
|
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
|
//store the new link if not stored already
|
||||||
if (!cachedLinks.includes(link)){
|
if (!cachedLinks.includes(link)){
|
||||||
cachedLinks.push(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));
|
if (err) reportError("FEED ERROR: Error reading RSS feed. Details: " + (err.message || err));
|
||||||
else {
|
else {
|
||||||
//get the latest link and check if it has already been posted and cached
|
//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)) {
|
if (!cachedLinks.includes(latestLink)) {
|
||||||
logEvent("Attempting to post new link: " + latestLink);
|
logEvent("Attempting to post new link: " + latestLink);
|
||||||
bot.sendMessage({
|
bot.sendMessage({
|
||||||
|
|
Loading…
Reference in a new issue