Browse Source

Fixed log file reference errors and crash when failing to send message

shorten
benji7425 4 years ago
parent
commit
62cc4cc195
  1. 4
      feed-bot.js
  2. 2
      log.js

4
feed-bot.js

@ -71,7 +71,7 @@ var DiscordClient = {
case Config.logRequestMessage:
DiscordClient.bot.uploadFile({
to: channelID,
file: Config.logFileName
file: Config.logFile
}, (err, message) => {
if (err) Log.error("Failed to upload log file: " + message, err);
else Log.event("Uploaded log file for user " + user + "(" + userID + ")");
@ -119,7 +119,7 @@ var DiscordClient = {
message: tags + link
}, function (err, message) {
if (err) {
Log.error("ERROR: Failed to send message: " + message.substring(0, 15) + "...", err);
Log.error("ERROR: Failed to send message" + message ? message : "", err);
//if there is an error posting the message, check if it is because the bot isn't connected
if (!DiscordClient.bot.connected) DiscordClient.onDisconnect();
}

2
log.js

@ -5,7 +5,7 @@ var FileWriter = require("simple-file-writer"); //file writer for logging
//my imports
var Config = require("./config.json"); //config file containing other settings
var logWriter = new FileWriter(Config.logFileName);
var logWriter = new FileWriter(Config.logFile);
var latestLog = "";
function log(message) {

Loading…
Cancel
Save