2020-10-01 01:43:38 +03:00
|
|
|
import { GuildPluginData } from "knub";
|
2020-07-23 00:37:33 +03:00
|
|
|
import { ModActionsPluginType } from "../types";
|
|
|
|
import { UserNotificationMethod } from "../../../utils";
|
|
|
|
|
|
|
|
export function getDefaultContactMethods(
|
2020-10-01 01:43:38 +03:00
|
|
|
pluginData: GuildPluginData<ModActionsPluginType>,
|
2020-07-23 00:37:33 +03:00
|
|
|
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) {
|
2021-06-01 02:05:55 +02:00
|
|
|
const channel = pluginData.guild.channels.cache.get(config.message_channel);
|
2020-07-23 00:37:33 +03:00
|
|
|
if (channel instanceof TextChannel) {
|
|
|
|
methods.push({
|
|
|
|
type: "channel",
|
|
|
|
channel,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return methods;
|
|
|
|
}
|