Browse Source

Added verbose logging option (currently toggled with a message)

shorten
benji7425 5 years ago
parent
commit
e1473e2114
  1. 7
      feed-bot.js

7
feed-bot.js

@ -7,6 +7,8 @@ var FeedRead = require("feed-read"); //for rss feed reading
var BotConfig = require("./botConfig.json"); //bot config file containing bot token
var Config = require("./config.json"); //config file containing other settings
var verboseLogging = false;
//get a URL object from the feedUrl so we can examine it and check connectivity later
var url = Url.parse(Config.feedUrl);
@ -65,12 +67,17 @@ Dns.resolve("discordapp.com", function (err) {
cacheLink(url);
return url;
});
} else if(message === "enableVerboseLogging"){
verboseLogging = true;
} else if(message === "disableVerboseLogging"){
verboseLogging = false;
}
});
}
});
function checkFeedAndPost() {
if(verboseLogging) logEvent("Bot is currently " + (bot.connected ? "connected to" : "disconnected from") + " discord");
//check that we have an internet connection (well not exactly - check that we have a connection to the host of the feedUrl)
Dns.resolve(url.host, function (err) {
if (err) reportError("CONNECTION ERROR: Cannot resolve host (you are probably not connected to the internet). Details: " + (err.message || err));

Loading…
Cancel
Save