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

half the number of errors

This commit is contained in:
almeidx 2023-03-11 19:31:36 +00:00
parent 7c5e6eb91f
commit 1dca8c4447
No known key found for this signature in database
GPG key ID: B1F4887CEBE2EDB1
261 changed files with 760 additions and 1023 deletions

View file

@ -1,8 +1,6 @@
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { CaseTypes } from "../../../data/CaseTypes";
import { Case } from "../../../data/entities/Case";
import { LogType } from "../../../data/LogType";
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin";
import { canActOn, hasPermission, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { resolveMember, resolveUser } from "../../../utils";

View file

@ -1,9 +1,7 @@
import humanizeDuration from "humanize-duration";
import { getMemberLevel } from "knub/dist/helpers";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { CaseTypes } from "../../../data/CaseTypes";
import { LogType } from "../../../data/LogType";
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin";
import { canActOn, hasPermission, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { resolveMember, resolveUser } from "../../../utils";

View file

@ -1,4 +1,4 @@
import { EmbedData, MessageCreateOptions, User } from "discord.js";
import { APIEmbed, User } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
import { emptyEmbedValue, resolveUser, trimLines } from "../../../utils";
@ -54,10 +54,10 @@ export const CasesModCmd = modActionsCmd({
const lastCaseNum = page * casesPerPage;
const title = `Most recent cases ${firstCaseNum}-${lastCaseNum} of ${totalCases} by ${modName}`;
const embed: EmbedData = {
const embed = {
author: {
name: title,
iconURL: mod instanceof User ? mod.displayAvatarURL() : undefined,
icon_url: mod instanceof User ? mod.displayAvatarURL() : undefined,
},
fields: [
...getChunkedEmbedFields(emptyEmbedValue, lines.join("\n")),
@ -69,7 +69,7 @@ export const CasesModCmd = modActionsCmd({
`),
},
],
};
} satisfies APIEmbed;
return { embeds: [embed] };
},

View file

@ -1,4 +1,4 @@
import { EmbedData, User } from "discord.js";
import { APIEmbed, User } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { CaseTypes } from "../../../data/CaseTypes";
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin";
@ -116,19 +116,19 @@ export const CasesUserCmd = modActionsCmd({
const chunkStart = i * linesPerChunk + 1;
const chunkEnd = Math.min((i + 1) * linesPerChunk, lines.length);
const embed: EmbedData = {
const embed = {
author: {
name:
lineChunks.length === 1
? `Cases for ${userName} (${lines.length} total)`
: `Cases ${chunkStart}${chunkEnd} of ${lines.length} for ${userName}`,
iconURL: user instanceof User ? user.displayAvatarURL() : undefined,
icon_url: user instanceof User ? user.displayAvatarURL() : undefined,
},
fields: [
...getChunkedEmbedFields(emptyEmbedValue, linesInChunk.join("\n")),
...(isLastChunk ? [footerField] : []),
],
};
} satisfies APIEmbed;
msg.channel.send({ embeds: [embed] });
}

View file

@ -1,11 +1,8 @@
import { TextChannel } from "discord.js";
import { helpers } from "knub";
import { memberToTemplateSafeMember } from "../../../utils/templateSafeObjects";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { Case } from "../../../data/entities/Case";
import { LogType } from "../../../data/LogType";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { SECONDS, stripObjectToScalars, trimLines } from "../../../utils";
import { SECONDS, trimLines } from "../../../utils";
import { CasesPlugin } from "../../Cases/CasesPlugin";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
@ -54,12 +51,7 @@ export const DeleteCaseCmd = modActionsCmd({
content: "Delete the following case? Answer 'Yes' to continue, 'No' to cancel.",
});
const reply = await helpers.waitForReply(
pluginData.client,
message.channel as TextChannel,
message.author.id,
15 * SECONDS,
);
const reply = await helpers.waitForReply(pluginData.client, message.channel, message.author.id, 15 * SECONDS);
const normalizedReply = (reply?.content || "").toLowerCase().trim();
if (normalizedReply !== "yes" && normalizedReply !== "y") {
message.channel.send("Cancelled. Case was not deleted.");

View file

@ -1,11 +1,10 @@
import { Snowflake } from "discord.js";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { CaseTypes } from "../../../data/CaseTypes";
import { LogType } from "../../../data/LogType";
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin";
import { canActOn, hasPermission, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { resolveMember, resolveUser } from "../../../utils";
import { DAYS, MINUTES, resolveMember, resolveUser } from "../../../utils";
import { formatReasonWithAttachments } from "../functions/formatReasonWithAttachments";
import { ignoreEvent } from "../functions/ignoreEvent";
import { isBanned } from "../functions/isBanned";
@ -70,7 +69,7 @@ export const ForcebanCmd = modActionsCmd({
try {
// FIXME: Use banUserId()?
await pluginData.guild.bans.create(user.id as Snowflake, {
days: 1,
deleteMessageSeconds: (1 * DAYS) / MINUTES,
reason: reason ?? undefined,
});
} catch {

View file

@ -1,14 +1,13 @@
import { Snowflake, TextChannel } from "discord.js";
import { Snowflake } from "discord.js";
import { waitForReply } from "knub/dist/helpers";
import { performance } from "perf_hooks";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { CaseTypes } from "../../../data/CaseTypes";
import { LogType } from "../../../data/LogType";
import { humanizeDurationShort } from "../../../humanizeDurationShort";
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin";
import { canActOn, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { MINUTES, noop } from "../../../utils";
import { DAYS, MINUTES, SECONDS, noop } from "../../../utils";
import { formatReasonWithAttachments } from "../functions/formatReasonWithAttachments";
import { ignoreEvent } from "../functions/ignoreEvent";
import { IgnoredEventType, modActionsCmd } from "../types";
@ -34,7 +33,7 @@ export const MassbanCmd = modActionsCmd({
// Ask for ban reason (cleaner this way instead of trying to cram it into the args)
msg.channel.send("Ban reason? `cancel` to cancel");
const banReasonReply = await waitForReply(pluginData.client, msg.channel as TextChannel, msg.author.id);
const banReasonReply = await waitForReply(pluginData.client, msg.channel, msg.author.id);
if (!banReasonReply || !banReasonReply.content || banReasonReply.content.toLowerCase().trim() === "cancel") {
sendErrorMessage(pluginData, msg.channel, "Cancelled");
return;
@ -95,8 +94,8 @@ export const MassbanCmd = modActionsCmd({
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_BAN, userId, 30 * MINUTES);
await pluginData.guild.bans.create(userId as Snowflake, {
days: deleteDays,
reason: banReason ?? undefined,
deleteMessageSeconds: (deleteDays * DAYS) / SECONDS,
reason: banReason,
});
await casesPlugin.createCase({

View file

@ -1,6 +1,5 @@
import { Snowflake, TextChannel } from "discord.js";
import { Snowflake } from "discord.js";
import { waitForReply } from "knub/dist/helpers";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { CaseTypes } from "../../../data/CaseTypes";
import { LogType } from "../../../data/LogType";
@ -32,7 +31,7 @@ export const MassunbanCmd = modActionsCmd({
// Ask for unban reason (cleaner this way instead of trying to cram it into the args)
msg.channel.send("Unban reason? `cancel` to cancel");
const unbanReasonReply = await waitForReply(pluginData.client, msg.channel as TextChannel, msg.author.id);
const unbanReasonReply = await waitForReply(pluginData.client, msg.channel, msg.author.id);
if (!unbanReasonReply || !unbanReasonReply.content || unbanReasonReply.content.toLowerCase().trim() === "cancel") {
sendErrorMessage(pluginData, msg.channel, "Cancelled");
return;

View file

@ -1,6 +1,5 @@
import { Snowflake, TextChannel } from "discord.js";
import { Snowflake } from "discord.js";
import { waitForReply } from "knub/dist/helpers";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { LogType } from "../../../data/LogType";
import { logger } from "../../../logger";
@ -30,7 +29,7 @@ export const MassmuteCmd = modActionsCmd({
// Ask for mute reason
msg.channel.send("Mute reason? `cancel` to cancel");
const muteReasonReceived = await waitForReply(pluginData.client, msg.channel as TextChannel, msg.author.id);
const muteReasonReceived = await waitForReply(pluginData.client, msg.channel, msg.author.id);
if (
!muteReasonReceived ||
!muteReasonReceived.content ||

View file

@ -1,7 +1,5 @@
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { CaseTypes } from "../../../data/CaseTypes";
import { LogType } from "../../../data/LogType";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { resolveUser } from "../../../utils";
import { CasesPlugin } from "../../Cases/CasesPlugin";

View file

@ -1,5 +1,4 @@
import { Snowflake } from "discord.js";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { CaseTypes } from "../../../data/CaseTypes";
import { LogType } from "../../../data/LogType";

View file

@ -1,4 +1,3 @@
import { TextChannel } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { CaseTypes } from "../../../data/CaseTypes";
import { canActOn, hasPermission, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
@ -94,7 +93,7 @@ export const WarnCmd = modActionsCmd({
ppId: mod.id !== msg.author.id ? msg.author.id : undefined,
reason,
},
retryPromptChannel: msg.channel as TextChannel,
retryPromptChannel: msg.channel,
});
if (warnResult.status === "failed") {

View file

@ -1,8 +1,7 @@
import { GuildAuditLogs, User } from "discord.js";
import { AuditLogEvent, User } from "discord.js";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { CaseTypes } from "../../../data/CaseTypes";
import { Case } from "../../../data/entities/Case";
import { LogType } from "../../../data/LogType";
import { resolveUser, UnknownUser } from "../../../utils";
import { CasesPlugin } from "../../Cases/CasesPlugin";
import { clearIgnoredEvents } from "../functions/clearIgnoredEvents";
@ -24,7 +23,11 @@ export const CreateBanCaseOnManualBanEvt = modActionsEvt({
return;
}
const relevantAuditLogEntry = await findMatchingAuditLogEntry(pluginData.guild, "MEMBER_BAN_ADD", user.id);
const relevantAuditLogEntry = await findMatchingAuditLogEntry(
pluginData.guild,
AuditLogEvent.MemberBanAdd,
user.id,
);
const casesPlugin = pluginData.getPlugin(CasesPlugin);

View file

@ -1,8 +1,6 @@
import { GuildAuditLogs, User } from "discord.js";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { User } from "discord.js";
import { CaseTypes } from "../../../data/CaseTypes";
import { Case } from "../../../data/entities/Case";
import { LogType } from "../../../data/LogType";
import { logger } from "../../../logger";
import { resolveUser, UnknownUser } from "../../../utils";
import { CasesPlugin } from "../../Cases/CasesPlugin";
@ -24,7 +22,7 @@ export const CreateKickCaseOnManualKickEvt = modActionsEvt({
return;
}
const kickAuditLogEntry = await findMatchingAuditLogEntry(pluginData.guild, "MEMBER_KICK", member.id);
const kickAuditLogEntry = await findMatchingAuditLogEntry(pluginData.guild, AuditLogEvent.MemberKick, member.id);
let mod: User | UnknownUser | null = null;
let createdCase: Case | null = null;

View file

@ -1,8 +1,6 @@
import { GuildAuditLogs, User } from "discord.js";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { AuditLogEvent, User } from "discord.js";
import { CaseTypes } from "../../../data/CaseTypes";
import { Case } from "../../../data/entities/Case";
import { LogType } from "../../../data/LogType";
import { resolveUser, UnknownUser } from "../../../utils";
import { CasesPlugin } from "../../Cases/CasesPlugin";
import { clearIgnoredEvents } from "../functions/clearIgnoredEvents";
@ -24,7 +22,11 @@ export const CreateUnbanCaseOnManualUnbanEvt = modActionsEvt({
return;
}
const relevantAuditLogEntry = await findMatchingAuditLogEntry(pluginData.guild, "MEMBER_BAN_REMOVE", user.id);
const relevantAuditLogEntry = await findMatchingAuditLogEntry(
pluginData.guild,
AuditLogEvent.MemberBanRemove,
user.id,
);
const casesPlugin = pluginData.getPlugin(CasesPlugin);

View file

@ -1,5 +1,4 @@
import { PermissionsBitField, Snowflake, TextChannel } from "discord.js";
import { LogType } from "../../../data/LogType";
import { resolveMember } from "../../../utils";
import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
import { LogsPlugin } from "../../Logs/LogsPlugin";

View file

@ -1,9 +1,9 @@
import { GuildMember, TextChannel, ThreadChannel } from "discord.js";
import { GuildMember, GuildTextBasedChannel } from "discord.js";
import { GuildPluginData } from "knub";
import { hasPermission } from "knub/dist/helpers";
import { LogType } from "../../../data/LogType";
import { canActOn, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { errorMessage, resolveMember, resolveUser } from "../../../utils";
import { DAYS, SECONDS, errorMessage, resolveMember, resolveUser } from "../../../utils";
import { IgnoredEventType, ModActionsPluginType } from "../types";
import { formatReasonWithAttachments } from "./formatReasonWithAttachments";
import { ignoreEvent } from "./ignoreEvent";
@ -19,7 +19,7 @@ export async function actualKickMemberCmd(
reason: string;
mod: GuildMember;
notify?: string;
"notify-channel"?: TextChannel | ThreadChannel;
"notify-channel"?: GuildTextBasedChannel;
clean?: boolean;
},
) {
@ -82,7 +82,7 @@ export async function actualKickMemberCmd(
ignoreEvent(pluginData, IgnoredEventType.Ban, memberToKick.id);
try {
await memberToKick.ban({ days: 1, reason: "kick -clean" });
await memberToKick.ban({ deleteMessageSeconds: (1 * DAYS) / SECONDS, reason: "kick -clean" });
} catch {
sendErrorMessage(pluginData, msg.channel, "Failed to ban the user to clean messages (-clean)");
}

View file

@ -1,4 +1,4 @@
import { GuildMember, Message, TextChannel, ThreadChannel, User } from "discord.js";
import { GuildMember, GuildTextBasedChannel, Message, User } from "discord.js";
import humanizeDuration from "humanize-duration";
import { GuildPluginData } from "knub";
import { logger } from "../../../logger";
@ -24,7 +24,7 @@ export async function actualMuteUserCmd(
reason?: string;
mod: GuildMember;
notify?: string;
"notify-channel"?: TextChannel | ThreadChannel;
"notify-channel"?: GuildTextBasedChannel;
},
) {
// The moderator who did the action is the message author or, if used, the specified -mod
@ -33,7 +33,7 @@ export async function actualMuteUserCmd(
if (args.mod) {
if (!(await hasPermission(pluginData, "can_act_as_other", { message: msg }))) {
sendErrorMessage(pluginData, msg.channel as TextChannel, "You don't have permission to use -mod");
sendErrorMessage(pluginData, msg.channel, "You don't have permission to use -mod");
return;
}
@ -51,7 +51,7 @@ export async function actualMuteUserCmd(
try {
contactMethods = readContactMethodsFromArgs(args);
} catch (e) {
sendErrorMessage(pluginData, msg.channel as TextChannel, e.message);
sendErrorMessage(pluginData, msg.channel, e.message);
return;
}
@ -65,9 +65,9 @@ export async function actualMuteUserCmd(
});
} catch (e) {
if (e instanceof RecoverablePluginError && e.code === ERRORS.NO_MUTE_ROLE_IN_CONFIG) {
sendErrorMessage(pluginData, msg.channel as TextChannel, "Could not mute the user: no mute role set in config");
sendErrorMessage(pluginData, msg.channel, "Could not mute the user: no mute role set in config");
} else if (isDiscordAPIError(e) && e.code === 10007) {
sendErrorMessage(pluginData, msg.channel as TextChannel, "Could not mute the user: unknown member");
sendErrorMessage(pluginData, msg.channel, "Could not mute the user: unknown member");
} else {
logger.error(`Failed to mute user ${user.id}: ${e.stack}`);
if (user.id == null) {
@ -75,14 +75,14 @@ export async function actualMuteUserCmd(
// tslint:disable-next-line:no-console
console.trace("[DEBUG] Null user.id for mute");
}
sendErrorMessage(pluginData, msg.channel as TextChannel, "Could not mute the user");
sendErrorMessage(pluginData, msg.channel, "Could not mute the user");
}
return;
}
// Confirm the action to the moderator
let response;
let response: string;
if (args.time) {
if (muteResult.updatedExistingMute) {
response = asSingleLine(`
@ -110,5 +110,5 @@ export async function actualMuteUserCmd(
}
if (muteResult.notifyResult.text) response += ` (${muteResult.notifyResult.text})`;
sendSuccessMessage(pluginData, msg.channel as TextChannel, response);
sendSuccessMessage(pluginData, msg.channel, response);
}

View file

@ -1,4 +1,4 @@
import { GuildMember, Message, TextChannel, User } from "discord.js";
import { GuildMember, Message, User } from "discord.js";
import humanizeDuration from "humanize-duration";
import { GuildPluginData } from "knub";
import { MutesPlugin } from "../../../plugins/Mutes/MutesPlugin";
@ -19,7 +19,7 @@ export async function actualUnmuteCmd(
if (args.mod) {
if (!(await hasPermission(pluginData, "can_act_as_other", { message: msg, channelId: msg.channel.id }))) {
sendErrorMessage(pluginData, msg.channel as TextChannel, "You don't have permission to use -mod");
sendErrorMessage(pluginData, msg.channel, "You don't have permission to use -mod");
return;
}
@ -37,7 +37,7 @@ export async function actualUnmuteCmd(
});
if (!result) {
sendErrorMessage(pluginData, msg.channel as TextChannel, "User is not muted!");
sendErrorMessage(pluginData, msg.channel, "User is not muted!");
return;
}
@ -46,7 +46,7 @@ export async function actualUnmuteCmd(
const timeUntilUnmute = args.time && humanizeDuration(args.time);
sendSuccessMessage(
pluginData,
msg.channel as TextChannel,
msg.channel,
asSingleLine(`
Unmuting **${user.tag}**
in ${timeUntilUnmute} (Case #${result.case.case_number})
@ -55,7 +55,7 @@ export async function actualUnmuteCmd(
} else {
sendSuccessMessage(
pluginData,
msg.channel as TextChannel,
msg.channel,
asSingleLine(`
Unmuted **${user.tag}**
(Case #${result.case.case_number})

View file

@ -8,9 +8,10 @@ import { logger } from "../../../logger";
import { renderTemplate, TemplateSafeValueContainer } from "../../../templateFormatter";
import {
createUserNotificationError,
DAYS,
notifyUser,
resolveUser,
stripObjectToScalars,
SECONDS,
ucfirst,
UserNotificationResult,
} from "../../../utils";
@ -87,7 +88,7 @@ export async function banUserId(
try {
const deleteMessageDays = Math.min(7, Math.max(0, banOptions.deleteMessageDays ?? 1));
await pluginData.guild.bans.create(userId as Snowflake, {
days: deleteMessageDays,
deleteMessageSeconds: (deleteMessageDays * DAYS) / SECONDS,
reason: reason ?? undefined,
});
} catch (e) {

View file

@ -5,7 +5,7 @@ import moment from "moment-timezone";
import { LogType } from "src/data/LogType";
import { logger } from "src/logger";
import { CaseTypes } from "../../../data/CaseTypes";
import { resolveUser, SECONDS } from "../../../utils";
import { resolveUser } from "../../../utils";
import { CasesPlugin } from "../../Cases/CasesPlugin";
import { IgnoredEventType, ModActionsPluginType } from "../types";
import { formatReasonWithAttachments } from "./formatReasonWithAttachments";

View file

@ -1,6 +1,5 @@
import { PermissionsBitField, Snowflake } from "discord.js";
import { GuildPluginData } from "knub";
import { LogType } from "../../../data/LogType";
import { isDiscordAPIError, isDiscordHTTPError, SECONDS, sleep } from "../../../utils";
import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
import { LogsPlugin } from "../../Logs/LogsPlugin";

View file

@ -1,9 +1,9 @@
import { TextChannel, ThreadChannel } from "discord.js";
import { GuildTextBasedChannel } from "discord.js";
import { disableUserNotificationStrings, UserNotificationMethod } from "../../../utils";
export function readContactMethodsFromArgs(args: {
notify?: string;
"notify-channel"?: TextChannel | ThreadChannel;
"notify-channel"?: GuildTextBasedChannel;
}): null | UserNotificationMethod[] {
if (args.notify) {
if (args.notify === "dm") {

View file

@ -1,7 +1,6 @@
import { Message, TextChannel } from "discord.js";
import { Message } from "discord.js";
import { CaseTypes } from "../../../data/CaseTypes";
import { Case } from "../../../data/entities/Case";
import { LogType } from "../../../data/LogType";
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { formatReasonWithAttachments } from "./formatReasonWithAttachments";
@ -16,12 +15,12 @@ export async function updateCase(pluginData, msg: Message, args) {
}
if (!theCase) {
sendErrorMessage(pluginData, msg.channel as TextChannel, "Case not found");
sendErrorMessage(pluginData, msg.channel, "Case not found");
return;
}
if (!args.note && msg.attachments.size === 0) {
sendErrorMessage(pluginData, msg.channel as TextChannel, "Text or attachment required");
sendErrorMessage(pluginData, msg.channel, "Text or attachment required");
return;
}
@ -41,5 +40,5 @@ export async function updateCase(pluginData, msg: Message, args) {
note,
});
sendSuccessMessage(pluginData, msg.channel as TextChannel, `Case \`#${theCase.case_number}\` updated`);
sendSuccessMessage(pluginData, msg.channel, `Case \`#${theCase.case_number}\` updated`);
}

View file

@ -1,8 +1,7 @@
import { GuildMember, Snowflake } from "discord.js";
import { GuildPluginData } from "knub";
import { memberToTemplateSafeMember, userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
import { CaseTypes } from "../../../data/CaseTypes";
import { LogType } from "../../../data/LogType";
import { renderTemplate, TemplateSafeValueContainer } from "../../../templateFormatter";
import { createUserNotificationError, notifyUser, resolveUser, ucfirst, UserNotificationResult } from "../../../utils";
import { waitForButtonConfirm } from "../../../utils/waitForInteraction";

View file

@ -1,4 +1,4 @@
import { TextChannel } from "discord.js";
import { GuildTextBasedChannel } from "discord.js";
import { EventEmitter } from "events";
import * as t from "io-ts";
import { BasePluginType, guildPluginMessageCommand, guildPluginEventListener } from "knub";
@ -11,8 +11,6 @@ import { Queue } from "../../Queue";
import { tNullable, UserNotificationMethod, UserNotificationResult } from "../../utils";
import { CaseArgs } from "../Cases/types";
import Timeout = NodeJS.Timeout;
export const ConfigSchema = t.type({
dm_on_warn: t.boolean,
dm_on_kick: t.boolean,
@ -129,7 +127,7 @@ export type WarnMemberNotifyRetryCallback = () => boolean | Promise<boolean>;
export interface WarnOptions {
caseArgs?: Partial<CaseArgs> | null;
contactMethods?: UserNotificationMethod[] | null;
retryPromptChannel?: TextChannel | null;
retryPromptChannel?: GuildTextBasedChannel | null;
isAutomodAction?: boolean;
}