3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-14 13:55:03 +00:00

Various fixes

This commit is contained in:
Lily Bergonzat 2024-02-17 18:16:53 +01:00
parent 2c0e4b37ca
commit cafcc2839e
15 changed files with 45 additions and 68 deletions

View file

@ -1,7 +1,6 @@
import { GuildMember, Snowflake } from "discord.js";
import { GuildPluginData } from "knub";
import { CaseTypes } from "../../../data/CaseTypes";
import { getContextChannel, isContextInteraction } from "../../../pluginUtils";
import { TemplateParseError, TemplateSafeValueContainer, renderTemplate } from "../../../templateFormatter";
import { UserNotificationResult, createUserNotificationError, notifyUser, resolveUser, ucfirst } from "../../../utils";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
@ -52,12 +51,7 @@ export async function warnMember(
}
if (!notifyResult.success) {
const contextIsNotInteraction =
warnOptions.retryPromptContext && !isContextInteraction(warnOptions.retryPromptContext);
const contextChannel = contextIsNotInteraction ? await getContextChannel(warnOptions.retryPromptContext!) : null;
const isValidChannel = contextIsNotInteraction && pluginData.guild.channels.resolve(contextChannel!.id);
if (!warnOptions.retryPromptContext || !isValidChannel) {
if (!warnOptions.retryPromptContext) {
return {
status: "failed",
error: "Failed to message user",