Fixes Vol. 7

Warnings no longer spam the console
This commit is contained in:
reflectronic 2019-01-21 18:50:16 -05:00
parent 97b0a823c1
commit 3a717f41f2
2 changed files with 8 additions and 7 deletions

11
bot.js
View file

@ -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);

View file

@ -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});