3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Add moderator variable to mod action templates (#119)

This commit is contained in:
Nils 2020-12-12 21:29:08 +01:00 committed by GitHub
parent 497b76296d
commit ec3bf2739d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 1 deletions

View file

@ -46,6 +46,9 @@ export async function banUserId(
const banMessage = await renderTemplate(config.ban_message, {
guildName: pluginData.guild.name,
reason,
moderator: banOptions.caseArgs?.modId
? stripObjectToScalars(await resolveUser(pluginData.client, banOptions.caseArgs.modId))
: {},
});
notifyResult = await notifyUser(user, banMessage, contactMethods);

View file

@ -39,6 +39,9 @@ export async function kickMember(
const kickMessage = await renderTemplate(config.kick_message, {
guildName: pluginData.guild.name,
reason,
moderator: kickOptions.caseArgs?.modId
? stripObjectToScalars(await resolveUser(pluginData.client, kickOptions.caseArgs.modId))
: {},
});
notifyResult = await notifyUser(member.user, kickMessage, contactMethods);

View file

@ -14,6 +14,7 @@ import { waitForReaction } from "knub/dist/helpers";
import { CasesPlugin } from "../../Cases/CasesPlugin";
import { CaseTypes } from "../../../data/CaseTypes";
import { LogType } from "../../../data/LogType";
import { renderTemplate } from "../../../templateFormatter";
export async function warnMember(
pluginData: GuildPluginData<ModActionsPluginType>,
@ -25,7 +26,13 @@ export async function warnMember(
let notifyResult: UserNotificationResult;
if (config.warn_message) {
const warnMessage = config.warn_message.replace("{guildName}", pluginData.guild.name).replace("{reason}", reason);
const warnMessage = await renderTemplate(config.warn_message, {
guildName: pluginData.guild.name,
reason,
moderator: warnOptions.caseArgs?.modId
? stripObjectToScalars(await resolveUser(pluginData.client, warnOptions.caseArgs.modId))
: {},
});
const contactMethods = warnOptions?.contactMethods
? warnOptions.contactMethods
: getDefaultContactMethods(pluginData, "warn");

View file

@ -88,6 +88,9 @@ export async function muteUser(
guildName: pluginData.guild.name,
reason: reason || "None",
time: timeUntilUnmute,
moderator: muteOptions.caseArgs?.modId
? stripObjectToScalars(await resolveUser(pluginData.client, muteOptions.caseArgs.modId))
: "",
}));
if (muteMessage && user instanceof User) {