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

@ -0,0 +1,28 @@
import { Guild } from "eris";
export enum ERRORS {
NO_MUTE_ROLE_IN_CONFIG = 1,
UNKNOWN_NOTE_CASE,
INVALID_EMOJI,
NO_USER_NOTIFICATION_CHANNEL,
INVALID_USER_NOTIFICATION_CHANNEL,
}
export const RECOVERABLE_PLUGIN_ERROR_MESSAGES = {
[ERRORS.NO_MUTE_ROLE_IN_CONFIG]: "No mute role specified in config",
[ERRORS.UNKNOWN_NOTE_CASE]: "Tried to add a note to an unknown case",
[ERRORS.INVALID_EMOJI]: "Invalid emoji",
[ERRORS.NO_USER_NOTIFICATION_CHANNEL]: "No user notify channel specified",
[ERRORS.INVALID_USER_NOTIFICATION_CHANNEL]: "Invalid user notify channel specified",
};
export class RecoverablePluginError extends Error {
public readonly code: ERRORS;
public readonly guild?: Guild;
constructor(code: ERRORS, guild?: Guild) {
super(RECOVERABLE_PLUGIN_ERROR_MESSAGES[code]);
this.guild = guild;
this.code = code;
}
}