mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
WIP ModActions
This commit is contained in:
parent
a3d0ec03d9
commit
ebcb28261b
25 changed files with 1162 additions and 6 deletions
|
@ -0,0 +1,25 @@
|
|||
import { TextChannel } from "eris";
|
||||
import { disableUserNotificationStrings, UserNotificationMethod } from "../../../utils";
|
||||
|
||||
export function readContactMethodsFromArgs(args: {
|
||||
notify?: string;
|
||||
"notify-channel"?: TextChannel;
|
||||
}): null | UserNotificationMethod[] {
|
||||
if (args.notify) {
|
||||
if (args.notify === "dm") {
|
||||
return [{ type: "dm" }];
|
||||
} else if (args.notify === "channel") {
|
||||
if (!args["notify-channel"]) {
|
||||
throw new Error("No `-notify-channel` specified");
|
||||
}
|
||||
|
||||
return [{ type: "channel", channel: args["notify-channel"] }];
|
||||
} else if (disableUserNotificationStrings.includes(args.notify)) {
|
||||
return [];
|
||||
} else {
|
||||
throw new Error("Unknown contact method");
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue