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:
parent
77e5f429c5
commit
89f545eb62
12 changed files with 429 additions and 196 deletions
28
backend/src/RecoverablePluginError.ts
Normal file
28
backend/src/RecoverablePluginError.ts
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue