Allow overriding user notification method for mod actions via -notify and -notify-channel. Allow setting these settings for automod actions as well.

This commit is contained in:
Dragory 2020-01-29 02:44:11 +02:00
parent 77e5f429c5
commit 89f545eb62
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
12 changed files with 429 additions and 196 deletions

View file

@ -26,6 +26,19 @@ setInterval(() => (recentDiscordErrors = Math.max(0, recentDiscordErrors - 1)),
if (process.env.NODE_ENV === "production") {
const errorHandler = err => {
if (err instanceof RecoverablePluginError) {
// Recoverable plugin errors can be, well, recovered from.
// Log it in the console as a warning and post a warning to the guild's log.
// tslint:disable:no-console
console.warn(`${err.guild.name}: [${err.code}] ${err.message}`);
const logs = new GuildLogs(err.guild.id);
logs.log(LogType.BOT_ALERT, { body: `\`[${err.code}]\` ${err.message}` });
return;
}
// tslint:disable:no-console
console.error(err);
@ -76,6 +89,9 @@ import { errorMessage, successMessage } from "./utils";
import { startUptimeCounter } from "./uptime";
import { AllowedGuilds } from "./data/AllowedGuilds";
import { IZeppelinGuildConfig, IZeppelinGlobalConfig } from "./types";
import { RecoverablePluginError } from "./RecoverablePluginError";
import { GuildLogs } from "./data/GuildLogs";
import { LogType } from "./data/LogType";
logger.info("Connecting to database");
connect().then(async conn => {