From 25588f79cc64453d4d0751c22db9944c1e80b7d3 Mon Sep 17 00:00:00 2001 From: John Tur Date: Mon, 21 Jan 2019 18:50:16 -0500 Subject: [PATCH] Fixes Vol. 7 Warnings no longer spam the console --- bot.js | 11 ++++++----- plugins/warning.js | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/bot.js b/bot.js index dddefc5..c8ba423 100755 --- a/bot.js +++ b/bot.js @@ -3558,7 +3558,7 @@ function vacuumSettings() { timer.timeout = moment(timer.timeout); changesMade = true; } - } + } } //Iterate over all guilds in settings @@ -3568,9 +3568,10 @@ function vacuumSettings() { changesMade = true; log("Deleting guild " + key + " as this guild is no longer recognised.", logType.info); delete settings.guilds[key]; + continue; } - for (let logChannel in ["chatLogs, botWarnings, memberAlerts"]) { + for (let logChannel of ["chatLogs, botWarnings, memberAlerts"]) { if(settings.guilds[key][logChannel] != undefined) { if (settings.guilds[key].blocked[logChannel] == undefined) { log(`Detected logging channel ${settings.guilds[key].chatLogs} without blocked feature list. Creating array.`, logType.info); @@ -3586,16 +3587,16 @@ function vacuumSettings() { } } - for (let warnArray in settings.guilds[key].warnings) { +/* for (let warnArray in settings.guilds[key].warnings) { for (let warn of settings.guilds[key].warnings[warnArray]) { if (typeof warn.timestamp === 'string' || warn.timestamp instanceof String) { log("Detected warning with String timestamp. Converting to moment.", logType.info); - warn.timestamp = moment(warn.timestamp); + warn.timestamp = moment(warn.timestamp).utc(); changesMade = true; } } } - + */ if (settings.guilds[key].locale == undefined) { changesMade = true; log(`Detected guild ${key} without set locale. Setting locale to en.`, logType.info); diff --git a/plugins/warning.js b/plugins/warning.js index 78cbbe3..e0d9092 100755 --- a/plugins/warning.js +++ b/plugins/warning.js @@ -143,7 +143,7 @@ function processCommand(message, isMod, command, options) { warner = message.guild.member(warning.warner); } - embed.addField($("LSWARN_WARNING_TITLE", {index: (parseInt(index) + 1)}), $("LSWARN_WARNING_INFO", {warning: warning.reason, timestamp: {date: warning.timestamp, h24: options.h24, offset: options.offset}, warner: warner, interpolation: {escapeValue: false}}), true); + embed.addField($("LSWARN_WARNING_TITLE", {index: (parseInt(index) + 1)}), $("LSWARN_WARNING_INFO", {warning: warning.reason, timestamp: {date: moment(warning.timestamp), h24: options.h24, offset: options.offset}, warner: warner, interpolation: {escapeValue: false}}), true); } message.channel.send("", {embed: embed}); @@ -242,7 +242,7 @@ function processCommand(message, isMod, command, options) { warner = message.guild.member(warning.warner); } - embed.addField("Warning #" + (parseInt(index) + 1), $("LSWARN_WARNING_INFO", {warning: warning.reason, timestamp: {date: warning.timestamp, h24: options.h24, offset: options.offset}, warner: warner, interpolation: {escapeValue: false}}), true); + embed.addField("Warning #" + (parseInt(index) + 1), $("LSWARN_WARNING_INFO", {warning: warning.reason, timestamp: {date: moment(warning.timestamp), h24: options.h24, offset: options.offset}, warner: warner, interpolation: {escapeValue: false}}), true); } message.channel.send("", {embed: embed});