3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

Type fixes + use template safe values for renderTemplate() everywhere

This commit is contained in:
Dragory 2021-08-18 20:32:45 +03:00
parent e16eb8c8d1
commit d109a58cb7
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
21 changed files with 190 additions and 98 deletions

View file

@ -7,7 +7,7 @@ import { Case } from "../../../data/entities/Case";
import { LogType } from "../../../data/LogType";
import { LogsPlugin } from "../../../plugins/Logs/LogsPlugin";
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
import { renderTemplate } from "../../../templateFormatter";
import { renderTemplate, TemplateSafeValueContainer } from "../../../templateFormatter";
import {
notifyUser,
resolveMember,
@ -151,14 +151,17 @@ export async function muteUser(
const muteMessage =
template &&
(await renderTemplate(template, {
guildName: pluginData.guild.name,
reason: reason || "None",
time: timeUntilUnmute,
moderator: muteOptions.caseArgs?.modId
? userToTemplateSafeUser(await resolveUser(pluginData.client, muteOptions.caseArgs.modId))
: "",
}));
(await renderTemplate(
template,
new TemplateSafeValueContainer({
guildName: pluginData.guild.name,
reason: reason || "None",
time: timeUntilUnmute,
moderator: muteOptions.caseArgs?.modId
? userToTemplateSafeUser(await resolveUser(pluginData.client, muteOptions.caseArgs.modId))
: null,
}),
));
if (muteMessage && user instanceof User) {
let contactMethods: UserNotificationMethod[] = [];