From 111639e0323f6aa4ca17157c18ab2e10e8596e1b Mon Sep 17 00:00:00 2001 From: benji7425 Date: Sun, 8 Jan 2017 06:18:05 +0000 Subject: [PATCH] Updated message post fail when disconnected to call onDisconnect func --- feed-bot.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/feed-bot.js b/feed-bot.js index 32ec9a0..8f29ec3 100644 --- a/feed-bot.js +++ b/feed-bot.js @@ -95,13 +95,7 @@ var DiscordClient = { if (err) { Log.error("ERROR: Failed to send message: " + message.substring(0, 15) + "...", err); //if there is an error posting the message, check if it is because the bot isn't connected - if (DiscordClient.bot.connected) - Log.info("Connectivity seems fine - I have no idea why the message didn't post"); - else { - Log.error("DiscordClient appears to be disconnected! Attempting to reconnect...", err); - - DiscordClient.bot.connect(); //attempt to reconnect - } + if (!DiscordClient.bot.connected) DiscordClient.onDisconnect(); } }); } @@ -160,7 +154,8 @@ var Links = { validate: function (err, articles, callback) { if (err) Log.error("FEED ERROR: Error reading RSS feed.", err); else { - var latestLink = Links.standardise(Config.youtubeMode ? YouTube.url.createShareUrl(articles[0].link) : articles[0].link); //get the latest link and convert to share url if youtube mode + var latestLink = Links.standardise(articles[0].link); + if (Config.youtubeMode) latestLink = YouTube.createShareUrl(latestLink); //make sure we don't spam the latest link if (latestLink == Links.latestFeedLink)