WIP ModActions
This commit is contained in:
parent
a3d0ec03d9
commit
ebcb28261b
25 changed files with 1162 additions and 6 deletions
|
@ -0,0 +1,28 @@
|
|||
import { PluginData } from "knub";
|
||||
import { ModActionsPluginType } from "../types";
|
||||
import { UserNotificationMethod } from "../../../utils";
|
||||
import { TextChannel } from "eris";
|
||||
|
||||
export function getDefaultContactMethods(
|
||||
pluginData: PluginData<ModActionsPluginType>,
|
||||
type: "warn" | "kick" | "ban",
|
||||
): UserNotificationMethod[] {
|
||||
const methods: UserNotificationMethod[] = [];
|
||||
const config = pluginData.config.get();
|
||||
|
||||
if (config[`dm_on_${type}`]) {
|
||||
methods.push({ type: "dm" });
|
||||
}
|
||||
|
||||
if (config[`message_on_${type}`] && config.message_channel) {
|
||||
const channel = pluginData.guild.channels.get(config.message_channel);
|
||||
if (channel instanceof TextChannel) {
|
||||
methods.push({
|
||||
type: "channel",
|
||||
channel,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return methods;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue