Add moderator variable to mod action templates (#119)
This commit is contained in:
parent
497b76296d
commit
ec3bf2739d
4 changed files with 17 additions and 1 deletions
|
@ -46,6 +46,9 @@ export async function banUserId(
|
||||||
const banMessage = await renderTemplate(config.ban_message, {
|
const banMessage = await renderTemplate(config.ban_message, {
|
||||||
guildName: pluginData.guild.name,
|
guildName: pluginData.guild.name,
|
||||||
reason,
|
reason,
|
||||||
|
moderator: banOptions.caseArgs?.modId
|
||||||
|
? stripObjectToScalars(await resolveUser(pluginData.client, banOptions.caseArgs.modId))
|
||||||
|
: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
notifyResult = await notifyUser(user, banMessage, contactMethods);
|
notifyResult = await notifyUser(user, banMessage, contactMethods);
|
||||||
|
|
|
@ -39,6 +39,9 @@ export async function kickMember(
|
||||||
const kickMessage = await renderTemplate(config.kick_message, {
|
const kickMessage = await renderTemplate(config.kick_message, {
|
||||||
guildName: pluginData.guild.name,
|
guildName: pluginData.guild.name,
|
||||||
reason,
|
reason,
|
||||||
|
moderator: kickOptions.caseArgs?.modId
|
||||||
|
? stripObjectToScalars(await resolveUser(pluginData.client, kickOptions.caseArgs.modId))
|
||||||
|
: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
notifyResult = await notifyUser(member.user, kickMessage, contactMethods);
|
notifyResult = await notifyUser(member.user, kickMessage, contactMethods);
|
||||||
|
|
|
@ -14,6 +14,7 @@ import { waitForReaction } from "knub/dist/helpers";
|
||||||
import { CasesPlugin } from "../../Cases/CasesPlugin";
|
import { CasesPlugin } from "../../Cases/CasesPlugin";
|
||||||
import { CaseTypes } from "../../../data/CaseTypes";
|
import { CaseTypes } from "../../../data/CaseTypes";
|
||||||
import { LogType } from "../../../data/LogType";
|
import { LogType } from "../../../data/LogType";
|
||||||
|
import { renderTemplate } from "../../../templateFormatter";
|
||||||
|
|
||||||
export async function warnMember(
|
export async function warnMember(
|
||||||
pluginData: GuildPluginData<ModActionsPluginType>,
|
pluginData: GuildPluginData<ModActionsPluginType>,
|
||||||
|
@ -25,7 +26,13 @@ export async function warnMember(
|
||||||
|
|
||||||
let notifyResult: UserNotificationResult;
|
let notifyResult: UserNotificationResult;
|
||||||
if (config.warn_message) {
|
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
|
const contactMethods = warnOptions?.contactMethods
|
||||||
? warnOptions.contactMethods
|
? warnOptions.contactMethods
|
||||||
: getDefaultContactMethods(pluginData, "warn");
|
: getDefaultContactMethods(pluginData, "warn");
|
||||||
|
|
|
@ -88,6 +88,9 @@ export async function muteUser(
|
||||||
guildName: pluginData.guild.name,
|
guildName: pluginData.guild.name,
|
||||||
reason: reason || "None",
|
reason: reason || "None",
|
||||||
time: timeUntilUnmute,
|
time: timeUntilUnmute,
|
||||||
|
moderator: muteOptions.caseArgs?.modId
|
||||||
|
? stripObjectToScalars(await resolveUser(pluginData.client, muteOptions.caseArgs.modId))
|
||||||
|
: "",
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (muteMessage && user instanceof User) {
|
if (muteMessage && user instanceof User) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue