3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-06-07 16:05:01 +00:00

chore: format

This commit is contained in:
Dragory 2025-05-31 18:19:26 +00:00
parent 6c55b98eee
commit aaf4e02c5f
No known key found for this signature in database
56 changed files with 282 additions and 255 deletions

View file

@ -1,5 +1,5 @@
import { EventEmitter } from "node:events";
import { CooldownManager } from "knub"; import { CooldownManager } from "knub";
import { EventEmitter } from "node:events";
import { RegExpWorker, TimeoutError } from "regexp-worker"; import { RegExpWorker, TimeoutError } from "regexp-worker";
import { MINUTES, SECONDS } from "./utils.js"; import { MINUTES, SECONDS } from "./utils.js";
import Timeout = NodeJS.Timeout; import Timeout = NodeJS.Timeout;

View file

@ -73,7 +73,10 @@ function formatZodConfigSchema(schema: z.ZodType) {
return schema.def.values; return schema.def.values;
} }
if (isZodIntersection(schema)) { if (isZodIntersection(schema)) {
return [formatZodConfigSchema(schema.def.left as z.ZodType), formatZodConfigSchema(schema.def.right as z.ZodType)].join(" & "); return [
formatZodConfigSchema(schema.def.left as z.ZodType),
formatZodConfigSchema(schema.def.right as z.ZodType),
].join(" & ");
} }
if (schema.def.type === "string") { if (schema.def.type === "string") {
return "string"; return "string";
@ -131,7 +134,7 @@ export function initDocs(router: express.Router) {
config: cmd.config, config: cmd.config,
})); }));
const defaultOptions = (pluginInfo.plugin as any /* TODO */).defaultOptions || {}; const defaultOptions = (pluginInfo.plugin as any) /* TODO */.defaultOptions || {};
res.json({ res.json({
name: pluginInfo.plugin.name, name: pluginInfo.plugin.name,

View file

@ -28,12 +28,15 @@ export async function validateGuildConfig(config: any): Promise<string | null> {
} }
const plugin = pluginNameToPlugin.get(pluginName)!; const plugin = pluginNameToPlugin.get(pluginName)!;
const configManager = new PluginConfigManager({}, { const configManager = new PluginConfigManager(
{},
{
configSchema: plugin.configSchema, configSchema: plugin.configSchema,
defaultOverrides: plugin.defaultOverrides ?? [], defaultOverrides: plugin.defaultOverrides ?? [],
levels: {}, levels: {},
customOverrideCriteriaFunctions: plugin.customOverrideCriteriaFunctions, customOverrideCriteriaFunctions: plugin.customOverrideCriteriaFunctions,
}); },
);
try { try {
await configManager.init(); await configManager.init();

View file

@ -37,6 +37,7 @@ const envType = z.object({
.optional(), .optional(),
PHISHERMAN_API_KEY: z.string().optional(), PHISHERMAN_API_KEY: z.string().optional(),
FISHFISH_API_KEY: z.string().optional(),
DB_HOST: z.string().optional(), DB_HOST: z.string().optional(),
DB_PORT: z.preprocess((v) => Number(v), z.number()).optional(), DB_PORT: z.preprocess((v) => Number(v), z.number()).optional(),

View file

@ -1,8 +1,8 @@
import fs from "node:fs";
import { z } from "zod/v4"; import { z } from "zod/v4";
import { availableGuildPlugins } from "./plugins/availablePlugins.js"; import { availableGuildPlugins } from "./plugins/availablePlugins.js";
import { zZeppelinGuildConfig } from "./types.js"; import { zZeppelinGuildConfig } from "./types.js";
import { deepPartial } from "./utils/zodDeepPartial.js"; import { deepPartial } from "./utils/zodDeepPartial.js";
import fs from "node:fs";
const basePluginOverrideCriteriaSchema = z.strictObject({ const basePluginOverrideCriteriaSchema = z.strictObject({
channel: z channel: z

View file

@ -3,7 +3,6 @@
*/ */
import { import {
BaseChannel,
BitField, BitField,
BitFieldResolvable, BitFieldResolvable,
ChatInputCommandInteraction, ChatInputCommandInteraction,
@ -19,15 +18,21 @@ import {
MessageFlagsString, MessageFlagsString,
ModalSubmitInteraction, ModalSubmitInteraction,
PermissionsBitField, PermissionsBitField,
SendableChannels,
TextBasedChannel, TextBasedChannel,
User,
} from "discord.js"; } from "discord.js";
import { AnyPluginData, BasePluginData, CommandContext, ExtendedMatchParams, GuildPluginData, helpers, PluginConfigManager } from "knub"; import {
AnyPluginData,
BasePluginData,
CommandContext,
ExtendedMatchParams,
GuildPluginData,
helpers,
PluginConfigManager,
} from "knub";
import z from "zod/v4";
import { isStaff } from "./staff.js"; import { isStaff } from "./staff.js";
import { TZeppelinKnub } from "./types.js"; import { TZeppelinKnub } from "./types.js";
import { Tail } from "./utils/typeUtils.js"; import { Tail } from "./utils/typeUtils.js";
import z from "zod/v4";
const { getMemberLevel } = helpers; const { getMemberLevel } = helpers;
@ -66,18 +71,14 @@ export type GenericCommandSource = Message | CommandInteraction | ModalSubmitInt
export function isContextInteraction( export function isContextInteraction(
context: GenericCommandSource, context: GenericCommandSource,
): context is CommandInteraction | ModalSubmitInteraction { ): context is CommandInteraction | ModalSubmitInteraction {
return (context instanceof CommandInteraction || context instanceof ModalSubmitInteraction); return context instanceof CommandInteraction || context instanceof ModalSubmitInteraction;
} }
export function isContextMessage( export function isContextMessage(context: GenericCommandSource): context is Message {
context: GenericCommandSource, return context instanceof Message;
): context is Message {
return (context instanceof Message);
} }
export async function getContextChannel( export async function getContextChannel(context: GenericCommandSource): Promise<TextBasedChannel | null> {
context: GenericCommandSource,
): Promise<TextBasedChannel | null> {
if (isContextInteraction(context)) { if (isContextInteraction(context)) {
return context.channel; return context.channel;
} }
@ -87,9 +88,7 @@ export async function getContextChannel(
throw new Error("Unknown context type"); throw new Error("Unknown context type");
} }
export function getContextChannelId( export function getContextChannelId(context: GenericCommandSource): string | null {
context: GenericCommandSource,
): string | null {
return context.channelId; return context.channelId;
} }
@ -104,13 +103,10 @@ export async function fetchContextChannel(context: GenericCommandSource) {
return (await context.guild.channels.fetch(channelId))!; return (await context.guild.channels.fetch(channelId))!;
} }
function flagsWithEphemeral< function flagsWithEphemeral<TFlags extends string, TType extends number | bigint>(
TFlags extends string, flags: BitFieldResolvable<TFlags, any>,
TType extends number | bigint ephemeral: boolean,
>(flags: BitFieldResolvable<TFlags, any>, ephemeral: boolean): BitFieldResolvable< ): BitFieldResolvable<TFlags | Extract<MessageFlagsString, "Ephemeral">, TType | MessageFlags.Ephemeral> {
TFlags | Extract<MessageFlagsString, "Ephemeral">,
TType | MessageFlags.Ephemeral
> {
if (!ephemeral) { if (!ephemeral) {
return flags; return flags;
} }
@ -167,7 +163,10 @@ export async function deleteContextResponse(response: ContextResponse): Promise<
await response.delete(); await response.delete();
} }
export async function getConfigForContext<TPluginData extends BasePluginData<any>>(config: PluginConfigManager<TPluginData>, context: GenericCommandSource): Promise<z.output<TPluginData["_pluginType"]["configSchema"]>> { export async function getConfigForContext<TPluginData extends BasePluginData<any>>(
config: PluginConfigManager<TPluginData>,
context: GenericCommandSource,
): Promise<z.output<TPluginData["_pluginType"]["configSchema"]>> {
if (context instanceof ChatInputCommandInteraction) { if (context instanceof ChatInputCommandInteraction) {
// TODO: Support for modal interactions (here and Knub) // TODO: Support for modal interactions (here and Knub)
return config.getForInteraction(context); return config.getForInteraction(context);

View file

@ -1,4 +1,4 @@
import { PluginOptions, guildPlugin } from "knub"; import { guildPlugin } from "knub";
import { GuildLogs } from "../../data/GuildLogs.js"; import { GuildLogs } from "../../data/GuildLogs.js";
import { GuildSavedMessages } from "../../data/GuildSavedMessages.js"; import { GuildSavedMessages } from "../../data/GuildSavedMessages.js";
import { LogsPlugin } from "../Logs/LogsPlugin.js"; import { LogsPlugin } from "../Logs/LogsPlugin.js";

View file

@ -1,4 +1,4 @@
import { ChannelType, PermissionsBitField, Snowflake } from "discord.js"; import { PermissionsBitField, Snowflake } from "discord.js";
import { GuildPluginData } from "knub"; import { GuildPluginData } from "knub";
import moment from "moment-timezone"; import moment from "moment-timezone";
import { LogType } from "../../../data/LogType.js"; import { LogType } from "../../../data/LogType.js";

View file

@ -1,7 +1,7 @@
import { escapeInlineCode } from "discord.js"; import { escapeInlineCode } from "discord.js";
import z from "zod/v4";
import { asSingleLine, messageSummary, verboseChannelMention } from "../../../utils.js"; import { asSingleLine, messageSummary, verboseChannelMention } from "../../../utils.js";
import { automodTrigger } from "../helpers.js"; import { automodTrigger } from "../helpers.js";
import z from "zod/v4";
interface MatchResultType { interface MatchResultType {
matchedType: string; matchedType: string;

View file

@ -1,4 +1,10 @@
import { escapeCodeBlock, InteractionEditReplyOptions, InteractionReplyOptions, MessageCreateOptions, MessageEditOptions } from "discord.js"; import {
escapeCodeBlock,
InteractionEditReplyOptions,
InteractionReplyOptions,
MessageCreateOptions,
MessageEditOptions,
} from "discord.js";
import { GuildPluginData } from "knub"; import { GuildPluginData } from "knub";
import moment from "moment-timezone"; import moment from "moment-timezone";
import { CaseTypes } from "../../../data/CaseTypes.js"; import { CaseTypes } from "../../../data/CaseTypes.js";

View file

@ -1,4 +1,4 @@
import { PluginOptions, PluginOverride, guildPlugin } from "knub"; import { PluginOverride, guildPlugin } from "knub";
import { GuildLogs } from "../../data/GuildLogs.js"; import { GuildLogs } from "../../data/GuildLogs.js";
import { GuildSavedMessages } from "../../data/GuildSavedMessages.js"; import { GuildSavedMessages } from "../../data/GuildSavedMessages.js";
import { discardRegExpRunner, getRegExpRunner } from "../../regExpRunners.js"; import { discardRegExpRunner, getRegExpRunner } from "../../regExpRunners.js";

View file

@ -18,7 +18,10 @@ export const zCensorConfig = z.strictObject({
domain_blacklist: z.array(zBoundedCharacters(0, 255)).nullable().default(null), domain_blacklist: z.array(zBoundedCharacters(0, 255)).nullable().default(null),
blocked_tokens: z.array(zBoundedCharacters(0, 2000)).nullable().default(null), blocked_tokens: z.array(zBoundedCharacters(0, 2000)).nullable().default(null),
blocked_words: z.array(zBoundedCharacters(0, 2000)).nullable().default(null), blocked_words: z.array(zBoundedCharacters(0, 2000)).nullable().default(null),
blocked_regex: z.array(zRegex(z.string().max(1000))).nullable().default(null), blocked_regex: z
.array(zRegex(z.string().max(1000)))
.nullable()
.default(null),
}); });
export interface CensorPluginType extends BasePluginType { export interface CensorPluginType extends BasePluginType {

View file

@ -1,6 +1,6 @@
import { BasePluginType, guildPluginMessageCommand, pluginUtils } from "knub"; import { BasePluginType, guildPluginMessageCommand, pluginUtils } from "knub";
import { CommonPlugin } from "../Common/CommonPlugin.js";
import { z } from "zod/v4"; import { z } from "zod/v4";
import { CommonPlugin } from "../Common/CommonPlugin.js";
export const zChannelArchiverPluginConfig = z.strictObject({}); export const zChannelArchiverPluginConfig = z.strictObject({});

View file

@ -1,9 +1,4 @@
import { import { Attachment, MessageMentionOptions, SendableChannels, TextBasedChannel } from "discord.js";
Attachment,
MessageMentionOptions,
SendableChannels,
TextBasedChannel
} from "discord.js";
import { guildPlugin } from "knub"; import { guildPlugin } from "knub";
import { GenericCommandSource, sendContextResponse } from "../../pluginUtils.js"; import { GenericCommandSource, sendContextResponse } from "../../pluginUtils.js";
import { errorMessage, successMessage } from "../../utils.js"; import { errorMessage, successMessage } from "../../utils.js";
@ -28,9 +23,7 @@ export const CommonPlugin = guildPlugin<CommonPluginType>()({
) => { ) => {
const emoji = getSuccessEmoji(pluginData); const emoji = getSuccessEmoji(pluginData);
const formattedBody = successMessage(body, emoji); const formattedBody = successMessage(body, emoji);
const content = allowedMentions const content = allowedMentions ? { content: formattedBody, allowedMentions } : { content: formattedBody };
? { content: formattedBody, allowedMentions }
: { content: formattedBody };
if ("isSendable" in context) { if ("isSendable" in context) {
return context.send(content); return context.send(content);
} }
@ -46,9 +39,7 @@ export const CommonPlugin = guildPlugin<CommonPluginType>()({
) => { ) => {
const emoji = getErrorEmoji(pluginData); const emoji = getErrorEmoji(pluginData);
const formattedBody = errorMessage(body, emoji); const formattedBody = errorMessage(body, emoji);
const content = allowedMentions const content = allowedMentions ? { content: formattedBody, allowedMentions } : { content: formattedBody };
? { content: formattedBody, allowedMentions }
: { content: formattedBody };
if ("isSendable" in context) { if ("isSendable" in context) {
return context.send(content); return context.send(content);
} }
@ -67,9 +58,7 @@ export const CommonPlugin = guildPlugin<CommonPluginType>()({
); );
} }
if (!channel.isSendable()) { if (!channel.isSendable()) {
throw new Error( throw new Error("Passed attachment storage channel is not sendable");
"Passed attachment storage channel is not sendable",
);
} }
return channel.send({ return channel.send({

View file

@ -1,4 +1,4 @@
import { PluginOptions, PluginOverride, guildPlugin } from "knub"; import { PluginOverride, guildPlugin } from "knub";
import { GuildCases } from "../../data/GuildCases.js"; import { GuildCases } from "../../data/GuildCases.js";
import { CasesPlugin } from "../Cases/CasesPlugin.js"; import { CasesPlugin } from "../Cases/CasesPlugin.js";
import { LogsPlugin } from "../Logs/LogsPlugin.js"; import { LogsPlugin } from "../Logs/LogsPlugin.js";

View file

@ -62,7 +62,11 @@ export async function cleanAction(
if (fetchMessagesResult.messages.length > 0) { if (fetchMessagesResult.messages.length > 0) {
await utility.cleanMessages(targetChannel, fetchMessagesResult.messages, interaction.user); await utility.cleanMessages(targetChannel, fetchMessagesResult.messages, interaction.user);
interaction.editReply(`Cleaned ${fetchMessagesResult.messages.length} ${fetchMessagesResult.messages.length === 1 ? "message" : "messages"}`); interaction.editReply(
`Cleaned ${fetchMessagesResult.messages.length} ${
fetchMessagesResult.messages.length === 1 ? "message" : "messages"
}`,
);
} else { } else {
interaction.editReply("No messages to clean"); interaction.editReply("No messages to clean");
} }

View file

@ -1,7 +1,12 @@
import { EventEmitter } from "events"; import { EventEmitter } from "events";
import { PluginOptions, PluginOverride, guildPlugin } from "knub"; import { PluginOverride, guildPlugin } from "knub";
import { GuildCounters } from "../../data/GuildCounters.js"; import { GuildCounters } from "../../data/GuildCounters.js";
import { buildCounterConditionString, CounterTrigger, getReverseCounterComparisonOp, parseCounterConditionString } from "../../data/entities/CounterTrigger.js"; import {
CounterTrigger,
buildCounterConditionString,
getReverseCounterComparisonOp,
parseCounterConditionString,
} from "../../data/entities/CounterTrigger.js";
import { makePublicFn } from "../../pluginUtils.js"; import { makePublicFn } from "../../pluginUtils.js";
import { MINUTES, convertDelayStringToMS } from "../../utils.js"; import { MINUTES, convertDelayStringToMS } from "../../utils.js";
import { CommonPlugin } from "../Common/CommonPlugin.js"; import { CommonPlugin } from "../Common/CommonPlugin.js";
@ -98,7 +103,9 @@ export const CountersPlugin = guildPlugin<CountersPluginType>()({
// Initialize triggers // Initialize triggers
for (const [triggerName, trigger] of Object.entries(counter.triggers)) { for (const [triggerName, trigger] of Object.entries(counter.triggers)) {
const parsedCondition = parseCounterConditionString(trigger.condition)!; const parsedCondition = parseCounterConditionString(trigger.condition)!;
const rawReverseCondition = trigger.reverse_condition || buildCounterConditionString(getReverseCounterComparisonOp(parsedCondition[0]), parsedCondition[1]); const rawReverseCondition =
trigger.reverse_condition ||
buildCounterConditionString(getReverseCounterComparisonOp(parsedCondition[0]), parsedCondition[1]);
const parsedReverseCondition = parseCounterConditionString(rawReverseCondition)!; const parsedReverseCondition = parseCounterConditionString(rawReverseCondition)!;
const counterTrigger = await state.counters.initCounterTrigger( const counterTrigger = await state.counters.initCounterTrigger(
dbCounter.id, dbCounter.id,

View file

@ -15,8 +15,7 @@ import Timeout = NodeJS.Timeout;
const MAX_COUNTERS = 5; const MAX_COUNTERS = 5;
const MAX_TRIGGERS_PER_COUNTER = 5; const MAX_TRIGGERS_PER_COUNTER = 5;
export const zTrigger = z export const zTrigger = z.strictObject({
.strictObject({
// Dummy type because name gets replaced by the property key in transform() // Dummy type because name gets replaced by the property key in transform()
pretty_name: zBoundedCharacters(0, 100).nullable().default(null), pretty_name: zBoundedCharacters(0, 100).nullable().default(null),
condition: zBoundedCharacters(1, 64).refine((str) => parseCounterConditionString(str) !== null, { condition: zBoundedCharacters(1, 64).refine((str) => parseCounterConditionString(str) !== null, {
@ -27,7 +26,7 @@ export const zTrigger = z
message: "Invalid counter trigger reverse condition", message: "Invalid counter trigger reverse condition",
}) })
.optional(), .optional(),
}); });
const zTriggerFromString = zBoundedCharacters(0, 100).transform((val, ctx) => { const zTriggerFromString = zBoundedCharacters(0, 100).transform((val, ctx) => {
const parsedCondition = parseCounterConditionString(val); const parsedCondition = parseCounterConditionString(val);

View file

@ -1,4 +1,3 @@
import { Message } from "discord.js";
import { GuildPluginData } from "knub"; import { GuildPluginData } from "knub";
import { TemplateSafeValueContainer } from "../../../templateFormatter.js"; import { TemplateSafeValueContainer } from "../../../templateFormatter.js";
import { ActionError } from "../ActionError.js"; import { ActionError } from "../ActionError.js";

View file

@ -1,5 +1,5 @@
import { Guild } from "discord.js"; import { Guild } from "discord.js";
import { BasePluginType, GlobalPluginData, globalPlugin, globalPluginEventListener } from "knub"; import { GlobalPluginData, globalPlugin, globalPluginEventListener } from "knub";
import { AllowedGuilds } from "../../data/AllowedGuilds.js"; import { AllowedGuilds } from "../../data/AllowedGuilds.js";
import { Configs } from "../../data/Configs.js"; import { Configs } from "../../data/Configs.js";
import { env } from "../../env.js"; import { env } from "../../env.js";

View file

@ -1,5 +1,4 @@
import { PluginOptions, guildPlugin } from "knub"; import { guildPlugin } from "knub";
import z from "zod/v4";
import { Queue } from "../../Queue.js"; import { Queue } from "../../Queue.js";
import { Webhooks } from "../../data/Webhooks.js"; import { Webhooks } from "../../data/Webhooks.js";
import { makePublicFn } from "../../pluginUtils.js"; import { makePublicFn } from "../../pluginUtils.js";

View file

@ -1,4 +1,4 @@
import { PluginOptions, guildPlugin } from "knub"; import { guildPlugin } from "knub";
import { onGuildEvent } from "../../data/GuildEvents.js"; import { onGuildEvent } from "../../data/GuildEvents.js";
import { GuildVCAlerts } from "../../data/GuildVCAlerts.js"; import { GuildVCAlerts } from "../../data/GuildVCAlerts.js";
import { CommonPlugin } from "../Common/CommonPlugin.js"; import { CommonPlugin } from "../Common/CommonPlugin.js";

View file

@ -1,4 +1,4 @@
import { PluginOptions, guildPlugin } from "knub"; import { guildPlugin } from "knub";
import { GuildSavedMessages } from "../../data/GuildSavedMessages.js"; import { GuildSavedMessages } from "../../data/GuildSavedMessages.js";
import { CommonPlugin } from "../Common/CommonPlugin.js"; import { CommonPlugin } from "../Common/CommonPlugin.js";
import { SaveMessagesToDBCmd } from "./commands/SaveMessagesToDB.js"; import { SaveMessagesToDBCmd } from "./commands/SaveMessagesToDB.js";

View file

@ -31,7 +31,7 @@ export const AddCaseMsgCmd = modActionsMsgCmd({
return; return;
} }
const member = msg.member || await msg.guild.members.fetch(msg.author.id); const member = msg.member || (await msg.guild.members.fetch(msg.author.id));
// The moderator who did the action is the message author or, if used, the specified -mod // The moderator who did the action is the message author or, if used, the specified -mod
let mod = member; let mod = member;

View file

@ -41,7 +41,7 @@ export const BanMsgCmd = modActionsMsgCmd({
return; return;
} }
const member = msg.member || await msg.guild.members.fetch(msg.author.id); const member = msg.member || (await msg.guild.members.fetch(msg.author.id));
// The moderator who did the action is the message author or, if used, the specified -mod // The moderator who did the action is the message author or, if used, the specified -mod
let mod = member; let mod = member;

View file

@ -48,12 +48,7 @@ export async function actualDeleteCaseCmd(
content: "Delete the following case? Answer 'Yes' to continue, 'No' to cancel.", content: "Delete the following case? Answer 'Yes' to continue, 'No' to cancel.",
}); });
const reply = await helpers.waitForReply( const reply = await helpers.waitForReply(pluginData.client, channel, author.id, 15 * SECONDS);
pluginData.client,
channel,
author.id,
15 * SECONDS,
);
const normalizedReply = (reply?.content || "").toLowerCase().trim(); const normalizedReply = (reply?.content || "").toLowerCase().trim();
if (normalizedReply !== "yes" && normalizedReply !== "y") { if (normalizedReply !== "yes" && normalizedReply !== "y") {
sendContextResponse(context, "Cancelled. Case was not deleted."); sendContextResponse(context, "Cancelled. Case was not deleted.");

View file

@ -39,7 +39,7 @@ export const ForceMuteMsgCmd = modActionsMsgCmd({
return; return;
} }
const authorMember = await resolveMessageMember(msg) const authorMember = await resolveMessageMember(msg);
const memberToMute = await resolveMember(pluginData.client, pluginData.guild, user.id); const memberToMute = await resolveMember(pluginData.client, pluginData.guild, user.id);
// Make sure we're allowed to mute this user // Make sure we're allowed to mute this user

View file

@ -1,10 +1,10 @@
import { hasPermission } from "knub/helpers"; import { hasPermission } from "knub/helpers";
import { commandTypeHelpers as ct } from "../../../../commandTypes.js"; import { commandTypeHelpers as ct } from "../../../../commandTypes.js";
import { resolveMessageMember } from "../../../../pluginUtils.js";
import { resolveUser } from "../../../../utils.js"; import { resolveUser } from "../../../../utils.js";
import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs.js"; import { readContactMethodsFromArgs } from "../../functions/readContactMethodsFromArgs.js";
import { modActionsMsgCmd } from "../../types.js"; import { modActionsMsgCmd } from "../../types.js";
import { actualKickCmd } from "./actualKickCmd.js"; import { actualKickCmd } from "./actualKickCmd.js";
import { resolveMessageMember } from "../../../../pluginUtils.js";
const opts = { const opts = {
mod: ct.member({ option: true }), mod: ct.member({ option: true }),

View file

@ -1,6 +1,6 @@
import { waitForReply } from "knub/helpers"; import { waitForReply } from "knub/helpers";
import { commandTypeHelpers as ct } from "../../../../commandTypes.js"; import { commandTypeHelpers as ct } from "../../../../commandTypes.js";
import { getContextChannel, resolveMessageMember, sendContextResponse } from "../../../../pluginUtils.js"; import { resolveMessageMember } from "../../../../pluginUtils.js";
import { modActionsMsgCmd } from "../../types.js"; import { modActionsMsgCmd } from "../../types.js";
import { actualMassBanCmd } from "./actualMassBanCmd.js"; import { actualMassBanCmd } from "./actualMassBanCmd.js";

View file

@ -3,7 +3,14 @@ import { GuildPluginData } from "knub";
import { CaseTypes } from "../../../../data/CaseTypes.js"; import { CaseTypes } from "../../../../data/CaseTypes.js";
import { LogType } from "../../../../data/LogType.js"; import { LogType } from "../../../../data/LogType.js";
import { humanizeDurationShort } from "../../../../humanizeDuration.js"; import { humanizeDurationShort } from "../../../../humanizeDuration.js";
import { canActOn, deleteContextResponse, editContextResponse, getConfigForContext, getContextChannel, isContextInteraction, sendContextResponse } from "../../../../pluginUtils.js"; import {
canActOn,
deleteContextResponse,
editContextResponse,
getConfigForContext,
isContextInteraction,
sendContextResponse,
} from "../../../../pluginUtils.js";
import { DAYS, MINUTES, SECONDS, noop } from "../../../../utils.js"; import { DAYS, MINUTES, SECONDS, noop } from "../../../../utils.js";
import { CasesPlugin } from "../../../Cases/CasesPlugin.js"; import { CasesPlugin } from "../../../Cases/CasesPlugin.js";
import { LogsPlugin } from "../../../Logs/LogsPlugin.js"; import { LogsPlugin } from "../../../Logs/LogsPlugin.js";

View file

@ -1,6 +1,6 @@
import { waitForReply } from "knub/helpers"; import { waitForReply } from "knub/helpers";
import { commandTypeHelpers as ct } from "../../../../commandTypes.js"; import { commandTypeHelpers as ct } from "../../../../commandTypes.js";
import { getContextChannel, resolveMessageMember, sendContextResponse } from "../../../../pluginUtils.js"; import { resolveMessageMember } from "../../../../pluginUtils.js";
import { modActionsMsgCmd } from "../../types.js"; import { modActionsMsgCmd } from "../../types.js";
import { actualMassMuteCmd } from "./actualMassMuteCmd.js"; import { actualMassMuteCmd } from "./actualMassMuteCmd.js";

View file

@ -3,6 +3,7 @@ import { GuildPluginData } from "knub";
import { LogType } from "../../../../data/LogType.js"; import { LogType } from "../../../../data/LogType.js";
import { logger } from "../../../../logger.js"; import { logger } from "../../../../logger.js";
import { canActOn, deleteContextResponse, isContextInteraction, sendContextResponse } from "../../../../pluginUtils.js"; import { canActOn, deleteContextResponse, isContextInteraction, sendContextResponse } from "../../../../pluginUtils.js";
import { noop } from "../../../../utils.js";
import { LogsPlugin } from "../../../Logs/LogsPlugin.js"; import { LogsPlugin } from "../../../Logs/LogsPlugin.js";
import { MutesPlugin } from "../../../Mutes/MutesPlugin.js"; import { MutesPlugin } from "../../../Mutes/MutesPlugin.js";
import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction.js"; import { handleAttachmentLinkDetectionAndGetRestriction } from "../../functions/attachmentLinkReaction.js";
@ -11,7 +12,6 @@ import {
formatReasonWithMessageLinkForAttachments, formatReasonWithMessageLinkForAttachments,
} from "../../functions/formatReasonForAttachments.js"; } from "../../functions/formatReasonForAttachments.js";
import { ModActionsPluginType } from "../../types.js"; import { ModActionsPluginType } from "../../types.js";
import { noop } from "../../../../utils.js";
export async function actualMassMuteCmd( export async function actualMassMuteCmd(
pluginData: GuildPluginData<ModActionsPluginType>, pluginData: GuildPluginData<ModActionsPluginType>,

View file

@ -1,6 +1,6 @@
import { waitForReply } from "knub/helpers"; import { waitForReply } from "knub/helpers";
import { commandTypeHelpers as ct } from "../../../../commandTypes.js"; import { commandTypeHelpers as ct } from "../../../../commandTypes.js";
import { getContextChannel, resolveMessageMember, sendContextResponse } from "../../../../pluginUtils.js"; import { resolveMessageMember } from "../../../../pluginUtils.js";
import { modActionsMsgCmd } from "../../types.js"; import { modActionsMsgCmd } from "../../types.js";
import { actualMassUnbanCmd } from "./actualMassUnbanCmd.js"; import { actualMassUnbanCmd } from "./actualMassUnbanCmd.js";

View file

@ -30,16 +30,28 @@ export const zModActionsConfig = z.strictObject({
message_on_ban: z.boolean().default(false), message_on_ban: z.boolean().default(false),
message_channel: z.nullable(z.string()).default(null), message_channel: z.nullable(z.string()).default(null),
warn_message: z.nullable(z.string()).default("You have received a warning on the {guildName} server: {reason}"), warn_message: z.nullable(z.string()).default("You have received a warning on the {guildName} server: {reason}"),
kick_message: z.nullable(z.string()).default("You have been kicked from the {guildName} server. Reason given: {reason}"), kick_message: z
ban_message: z.nullable(z.string()).default("You have been banned from the {guildName} server. Reason given: {reason}"), .nullable(z.string())
tempban_message: z.nullable(z.string()).default("You have been banned from the {guildName} server for {banTime}. Reason given: {reason}"), .default("You have been kicked from the {guildName} server. Reason given: {reason}"),
ban_message: z
.nullable(z.string())
.default("You have been banned from the {guildName} server. Reason given: {reason}"),
tempban_message: z
.nullable(z.string())
.default("You have been banned from the {guildName} server for {banTime}. Reason given: {reason}"),
alert_on_rejoin: z.boolean().default(false), alert_on_rejoin: z.boolean().default(false),
alert_channel: z.nullable(z.string()).default(null), alert_channel: z.nullable(z.string()).default(null),
warn_notify_enabled: z.boolean().default(false), warn_notify_enabled: z.boolean().default(false),
warn_notify_threshold: z.number().default(5), warn_notify_threshold: z.number().default(5),
warn_notify_message: z.string().default("The user already has **{priorWarnings}** warnings!\n Please check their prior cases and assess whether or not to warn anyways.\n Proceed with the warning?"), warn_notify_message: z
.string()
.default(
"The user already has **{priorWarnings}** warnings!\n Please check their prior cases and assess whether or not to warn anyways.\n Proceed with the warning?",
),
ban_delete_message_days: z.number().default(1), ban_delete_message_days: z.number().default(1),
attachment_link_reaction: z.nullable(z.union([z.literal("none"), z.literal("warn"), z.literal("restrict")])).default("warn"), attachment_link_reaction: z
.nullable(z.union([z.literal("none"), z.literal("warn"), z.literal("restrict")]))
.default("warn"),
can_note: z.boolean().default(false), can_note: z.boolean().default(false),
can_warn: z.boolean().default(false), can_warn: z.boolean().default(false),
can_mute: z.boolean().default(false), can_mute: z.boolean().default(false),

View file

@ -23,7 +23,10 @@ export const zMutesConfig = z.strictObject({
message_on_update: z.boolean().default(false), message_on_update: z.boolean().default(false),
message_channel: z.string().nullable().default(null), message_channel: z.string().nullable().default(null),
mute_message: z.string().nullable().default("You have been muted on the {guildName} server. Reason given: {reason}"), mute_message: z.string().nullable().default("You have been muted on the {guildName} server. Reason given: {reason}"),
timed_mute_message: z.string().nullable().default("You have been muted on the {guildName} server for {time}. Reason given: {reason}"), timed_mute_message: z
.string()
.nullable()
.default("You have been muted on the {guildName} server for {time}. Reason given: {reason}"),
update_mute_message: z.string().nullable().default("Your mute on the {guildName} server has been updated to {time}."), update_mute_message: z.string().nullable().default("Your mute on the {guildName} server has been updated to {time}."),
remove_roles_on_mute: z.union([z.boolean(), z.array(zSnowflake)]).default(false), remove_roles_on_mute: z.union([z.boolean(), z.array(zSnowflake)]).default(false),
restore_roles_on_mute: z.union([z.boolean(), z.array(zSnowflake)]).default(false), restore_roles_on_mute: z.union([z.boolean(), z.array(zSnowflake)]).default(false),

View file

@ -1,4 +1,4 @@
import { PluginOptions, guildPlugin } from "knub"; import { guildPlugin } from "knub";
import { Queue } from "../../Queue.js"; import { Queue } from "../../Queue.js";
import { GuildNicknameHistory } from "../../data/GuildNicknameHistory.js"; import { GuildNicknameHistory } from "../../data/GuildNicknameHistory.js";
import { UsernameHistory } from "../../data/UsernameHistory.js"; import { UsernameHistory } from "../../data/UsernameHistory.js";

View file

@ -1,4 +1,4 @@
import { PluginOptions, guildPlugin } from "knub"; import { guildPlugin } from "knub";
import { GuildLogs } from "../../data/GuildLogs.js"; import { GuildLogs } from "../../data/GuildLogs.js";
import { GuildPersistedData } from "../../data/GuildPersistedData.js"; import { GuildPersistedData } from "../../data/GuildPersistedData.js";
import { LogsPlugin } from "../Logs/LogsPlugin.js"; import { LogsPlugin } from "../Logs/LogsPlugin.js";

View file

@ -1,4 +1,4 @@
import { PluginOptions, guildPlugin } from "knub"; import { guildPlugin } from "knub";
import { Queue } from "../../Queue.js"; import { Queue } from "../../Queue.js";
import { GuildReactionRoles } from "../../data/GuildReactionRoles.js"; import { GuildReactionRoles } from "../../data/GuildReactionRoles.js";
import { GuildSavedMessages } from "../../data/GuildSavedMessages.js"; import { GuildSavedMessages } from "../../data/GuildSavedMessages.js";

View file

@ -1,10 +1,10 @@
import { Snowflake } from "discord.js"; import { Snowflake } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes.js"; import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { resolveMessageMember } from "../../../pluginUtils.js";
import { canUseEmoji, isDiscordAPIError, isValidEmoji, noop, trimPluginDescription } from "../../../utils.js"; import { canUseEmoji, isDiscordAPIError, isValidEmoji, noop, trimPluginDescription } from "../../../utils.js";
import { canReadChannel } from "../../../utils/canReadChannel.js"; import { canReadChannel } from "../../../utils/canReadChannel.js";
import { TReactionRolePair, reactionRolesCmd } from "../types.js"; import { TReactionRolePair, reactionRolesCmd } from "../types.js";
import { applyReactionRoleReactionsToMessage } from "../util/applyReactionRoleReactionsToMessage.js"; import { applyReactionRoleReactionsToMessage } from "../util/applyReactionRoleReactionsToMessage.js";
import { resolveMessageMember } from "../../../pluginUtils.js";
const CLEAR_ROLES_EMOJI = "❌"; const CLEAR_ROLES_EMOJI = "❌";

View file

@ -1,4 +1,4 @@
import { PluginOptions, guildPlugin } from "knub"; import { guildPlugin } from "knub";
import { onGuildEvent } from "../../data/GuildEvents.js"; import { onGuildEvent } from "../../data/GuildEvents.js";
import { GuildReminders } from "../../data/GuildReminders.js"; import { GuildReminders } from "../../data/GuildReminders.js";
import { CommonPlugin } from "../Common/CommonPlugin.js"; import { CommonPlugin } from "../Common/CommonPlugin.js";

View file

@ -1,4 +1,4 @@
import { PluginOptions, guildPlugin } from "knub"; import { guildPlugin } from "knub";
import { GuildLogs } from "../../data/GuildLogs.js"; import { GuildLogs } from "../../data/GuildLogs.js";
import { CommonPlugin } from "../Common/CommonPlugin.js"; import { CommonPlugin } from "../Common/CommonPlugin.js";
import { LogsPlugin } from "../Logs/LogsPlugin.js"; import { LogsPlugin } from "../Logs/LogsPlugin.js";

View file

@ -1,4 +1,4 @@
import { CooldownManager, PluginOptions, guildPlugin } from "knub"; import { CooldownManager, guildPlugin } from "knub";
import { CommonPlugin } from "../Common/CommonPlugin.js"; import { CommonPlugin } from "../Common/CommonPlugin.js";
import { RoleAddCmd } from "./commands/RoleAddCmd.js"; import { RoleAddCmd } from "./commands/RoleAddCmd.js";
import { RoleHelpCmd } from "./commands/RoleHelpCmd.js"; import { RoleHelpCmd } from "./commands/RoleHelpCmd.js";

View file

@ -1,12 +1,12 @@
import { Role, Snowflake } from "discord.js"; import { Role, Snowflake } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes.js"; import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { resolveMessageMember } from "../../../pluginUtils.js";
import { memberRolesLock } from "../../../utils/lockNameHelpers.js"; import { memberRolesLock } from "../../../utils/lockNameHelpers.js";
import { selfGrantableRolesCmd } from "../types.js"; import { selfGrantableRolesCmd } from "../types.js";
import { findMatchingRoles } from "../util/findMatchingRoles.js"; import { findMatchingRoles } from "../util/findMatchingRoles.js";
import { getApplyingEntries } from "../util/getApplyingEntries.js"; import { getApplyingEntries } from "../util/getApplyingEntries.js";
import { normalizeRoleNames } from "../util/normalizeRoleNames.js"; import { normalizeRoleNames } from "../util/normalizeRoleNames.js";
import { splitRoleNames } from "../util/splitRoleNames.js"; import { splitRoleNames } from "../util/splitRoleNames.js";
import { resolveMessageMember } from "../../../pluginUtils.js";
export const RoleAddCmd = selfGrantableRolesCmd({ export const RoleAddCmd = selfGrantableRolesCmd({
trigger: ["role", "role add"], trigger: ["role", "role add"],

View file

@ -1,12 +1,12 @@
import { Snowflake } from "discord.js"; import { Snowflake } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes.js"; import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { resolveMessageMember } from "../../../pluginUtils.js";
import { memberRolesLock } from "../../../utils/lockNameHelpers.js"; import { memberRolesLock } from "../../../utils/lockNameHelpers.js";
import { selfGrantableRolesCmd } from "../types.js"; import { selfGrantableRolesCmd } from "../types.js";
import { findMatchingRoles } from "../util/findMatchingRoles.js"; import { findMatchingRoles } from "../util/findMatchingRoles.js";
import { getApplyingEntries } from "../util/getApplyingEntries.js"; import { getApplyingEntries } from "../util/getApplyingEntries.js";
import { normalizeRoleNames } from "../util/normalizeRoleNames.js"; import { normalizeRoleNames } from "../util/normalizeRoleNames.js";
import { splitRoleNames } from "../util/splitRoleNames.js"; import { splitRoleNames } from "../util/splitRoleNames.js";
import { resolveMessageMember } from "../../../pluginUtils.js";
export const RoleRemoveCmd = selfGrantableRolesCmd({ export const RoleRemoveCmd = selfGrantableRolesCmd({
trigger: "role remove", trigger: "role remove",

View file

@ -1,11 +1,11 @@
import { MessageCreateOptions } from "discord.js"; import { MessageCreateOptions } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes.js"; import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { logger } from "../../../logger.js"; import { logger } from "../../../logger.js";
import { resolveMessageMember } from "../../../pluginUtils.js";
import { TemplateParseError } from "../../../templateFormatter.js"; import { TemplateParseError } from "../../../templateFormatter.js";
import { memberToTemplateSafeMember, userToTemplateSafeUser } from "../../../utils/templateSafeObjects.js"; import { memberToTemplateSafeMember, userToTemplateSafeUser } from "../../../utils/templateSafeObjects.js";
import { tagsCmd } from "../types.js"; import { tagsCmd } from "../types.js";
import { renderTagBody } from "../util/renderTagBody.js"; import { renderTagBody } from "../util/renderTagBody.js";
import { resolveMessageMember } from "../../../pluginUtils.js";
export const TagEvalCmd = tagsCmd({ export const TagEvalCmd = tagsCmd({
trigger: "tag eval", trigger: "tag eval",

View file

@ -1,11 +1,10 @@
import { PluginOptions, guildPlugin } from "knub"; import { guildPlugin } from "knub";
import { GuildMemberTimezones } from "../../data/GuildMemberTimezones.js"; import { GuildMemberTimezones } from "../../data/GuildMemberTimezones.js";
import { makePublicFn } from "../../pluginUtils.js"; import { makePublicFn } from "../../pluginUtils.js";
import { CommonPlugin } from "../Common/CommonPlugin.js"; import { CommonPlugin } from "../Common/CommonPlugin.js";
import { ResetTimezoneCmd } from "./commands/ResetTimezoneCmd.js"; import { ResetTimezoneCmd } from "./commands/ResetTimezoneCmd.js";
import { SetTimezoneCmd } from "./commands/SetTimezoneCmd.js"; import { SetTimezoneCmd } from "./commands/SetTimezoneCmd.js";
import { ViewTimezoneCmd } from "./commands/ViewTimezoneCmd.js"; import { ViewTimezoneCmd } from "./commands/ViewTimezoneCmd.js";
import { defaultDateFormats } from "./defaultDateFormats.js";
import { getDateFormat } from "./functions/getDateFormat.js"; import { getDateFormat } from "./functions/getDateFormat.js";
import { getGuildTz } from "./functions/getGuildTz.js"; import { getGuildTz } from "./functions/getGuildTz.js";
import { getMemberTz } from "./functions/getMemberTz.js"; import { getMemberTz } from "./functions/getMemberTz.js";

View file

@ -1,9 +1,9 @@
import { Snowflake, TextChannel } from "discord.js"; import { Snowflake, TextChannel } from "discord.js";
import { commandTypeHelpers as ct } from "../../../commandTypes.js"; import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { resolveMessageMember } from "../../../pluginUtils.js";
import { messageLink } from "../../../utils.js"; import { messageLink } from "../../../utils.js";
import { canReadChannel } from "../../../utils/canReadChannel.js"; import { canReadChannel } from "../../../utils/canReadChannel.js";
import { utilityCmd } from "../types.js"; import { utilityCmd } from "../types.js";
import { resolveMessageMember } from "../../../pluginUtils.js";
export const ContextCmd = utilityCmd({ export const ContextCmd = utilityCmd({
trigger: "context", trigger: "context",

View file

@ -1,6 +1,7 @@
import { Snowflake } from "discord.js"; import { Snowflake } from "discord.js";
import { getChannelId, getRoleId } from "knub/helpers"; import { getChannelId, getRoleId } from "knub/helpers";
import { commandTypeHelpers as ct } from "../../../commandTypes.js"; import { commandTypeHelpers as ct } from "../../../commandTypes.js";
import { resolveMessageMember } from "../../../pluginUtils.js";
import { isValidSnowflake, noop, parseInviteCodeInput, resolveInvite, resolveUser } from "../../../utils.js"; import { isValidSnowflake, noop, parseInviteCodeInput, resolveInvite, resolveUser } from "../../../utils.js";
import { canReadChannel } from "../../../utils/canReadChannel.js"; import { canReadChannel } from "../../../utils/canReadChannel.js";
import { resolveMessageTarget } from "../../../utils/resolveMessageTarget.js"; import { resolveMessageTarget } from "../../../utils/resolveMessageTarget.js";
@ -15,7 +16,6 @@ import { getServerInfoEmbed } from "../functions/getServerInfoEmbed.js";
import { getSnowflakeInfoEmbed } from "../functions/getSnowflakeInfoEmbed.js"; import { getSnowflakeInfoEmbed } from "../functions/getSnowflakeInfoEmbed.js";
import { getUserInfoEmbed } from "../functions/getUserInfoEmbed.js"; import { getUserInfoEmbed } from "../functions/getUserInfoEmbed.js";
import { utilityCmd } from "../types.js"; import { utilityCmd } from "../types.js";
import { resolveMessageMember } from "../../../pluginUtils.js";
export const InfoCmd = utilityCmd({ export const InfoCmd = utilityCmd({
trigger: "info", trigger: "info",

View file

@ -1,11 +1,11 @@
import { GuildPluginData } from "knub";
import { UtilityPluginType } from "../types.js";
import { GuildBasedChannel, Snowflake, TextBasedChannel, User } from "discord.js"; import { GuildBasedChannel, Snowflake, TextBasedChannel, User } from "discord.js";
import { GuildPluginData } from "knub";
import { SavedMessage } from "../../../data/entities/SavedMessage.js"; import { SavedMessage } from "../../../data/entities/SavedMessage.js";
import { LogType } from "../../../data/LogType.js"; import { LogType } from "../../../data/LogType.js";
import { chunkArray } from "../../../utils.js";
import { getBaseUrl } from "../../../pluginUtils.js"; import { getBaseUrl } from "../../../pluginUtils.js";
import { chunkArray } from "../../../utils.js";
import { LogsPlugin } from "../../Logs/LogsPlugin.js"; import { LogsPlugin } from "../../Logs/LogsPlugin.js";
import { UtilityPluginType } from "../types.js";
export async function cleanMessages( export async function cleanMessages(
pluginData: GuildPluginData<UtilityPluginType>, pluginData: GuildPluginData<UtilityPluginType>,

View file

@ -1,11 +1,11 @@
import { GuildBasedChannel, Message, OmitPartialGroupDMChannel, Snowflake, TextBasedChannel } from "discord.js"; import { GuildBasedChannel, Message, OmitPartialGroupDMChannel, Snowflake, TextBasedChannel } from "discord.js";
import { DAYS, getInviteCodesInString } from "../../../utils.js";
import { GuildPluginData } from "knub"; import { GuildPluginData } from "knub";
import { UtilityPluginType } from "../types.js"; import { SavedMessage } from "../../../data/entities/SavedMessage.js";
import { snowflakeToTimestamp } from "../../../utils/snowflakeToTimestamp.js";
import { humanizeDurationShort } from "../../../humanizeDuration.js"; import { humanizeDurationShort } from "../../../humanizeDuration.js";
import { allowTimeout } from "../../../RegExpRunner.js"; import { allowTimeout } from "../../../RegExpRunner.js";
import { SavedMessage } from "../../../data/entities/SavedMessage.js"; import { DAYS, getInviteCodesInString } from "../../../utils.js";
import { snowflakeToTimestamp } from "../../../utils/snowflakeToTimestamp.js";
import { UtilityPluginType } from "../types.js";
const MAX_CLEAN_COUNT = 300; const MAX_CLEAN_COUNT = 300;
const MAX_CLEAN_TIME = 1 * DAYS; const MAX_CLEAN_TIME = 1 * DAYS;
@ -33,7 +33,11 @@ export interface ErrorResult {
export type FetchChannelMessagesToCleanResult = SuccessResult | ErrorResult; export type FetchChannelMessagesToCleanResult = SuccessResult | ErrorResult;
export async function fetchChannelMessagesToClean(pluginData: GuildPluginData<UtilityPluginType>, targetChannel: GuildBasedChannel & TextBasedChannel, opts: FetchChannelMessagesToCleanOpts): Promise<FetchChannelMessagesToCleanResult> { export async function fetchChannelMessagesToClean(
pluginData: GuildPluginData<UtilityPluginType>,
targetChannel: GuildBasedChannel & TextBasedChannel,
opts: FetchChannelMessagesToCleanOpts,
): Promise<FetchChannelMessagesToCleanResult> {
if (opts.count > MAX_CLEAN_COUNT || opts.count <= 0) { if (opts.count > MAX_CLEAN_COUNT || opts.count <= 0) {
return { error: `Clean count must be between 1 and ${MAX_CLEAN_COUNT}` }; return { error: `Clean count must be between 1 and ${MAX_CLEAN_COUNT}` };
} }
@ -75,7 +79,10 @@ export async function fetchChannelMessagesToClean(pluginData: GuildPluginData<Ut
break; break;
} }
if (message.createdTimestamp < timestampCutoff) continue; if (message.createdTimestamp < timestampCutoff) continue;
if (opts.matchContent && !(await pluginData.state.regexRunner.exec(opts.matchContent, contentString).catch(allowTimeout))) { if (
opts.matchContent &&
!(await pluginData.state.regexRunner.exec(opts.matchContent, contentString).catch(allowTimeout))
) {
continue; continue;
} }

View file

@ -2,7 +2,6 @@ import { APIEmbed, ChannelType } from "discord.js";
import { GuildPluginData } from "knub"; import { GuildPluginData } from "knub";
import { import {
EmbedWith, EmbedWith,
GroupDMInvite,
formatNumber, formatNumber,
inviteHasCounts, inviteHasCounts,
isGroupDMInvite, isGroupDMInvite,

View file

@ -1,4 +1,4 @@
import { PluginOptions, guildPlugin } from "knub"; import { guildPlugin } from "knub";
import { GuildLogs } from "../../data/GuildLogs.js"; import { GuildLogs } from "../../data/GuildLogs.js";
import { LogsPlugin } from "../Logs/LogsPlugin.js"; import { LogsPlugin } from "../Logs/LogsPlugin.js";
import { SendWelcomeMessageEvt } from "./events/SendWelcomeMessageEvt.js"; import { SendWelcomeMessageEvt } from "./events/SendWelcomeMessageEvt.js";

View file

@ -1,11 +1,4 @@
import { import { Client, Message, MessageReaction, PartialMessageReaction, PartialUser, User } from "discord.js";
Client,
Message,
MessageReaction,
PartialMessageReaction,
PartialUser,
User
} from "discord.js";
import { ContextResponseOptions, fetchContextChannel, GenericCommandSource } from "../pluginUtils.js"; import { ContextResponseOptions, fetchContextChannel, GenericCommandSource } from "../pluginUtils.js";
import { MINUTES, noop } from "../utils.js"; import { MINUTES, noop } from "../utils.js";
import { Awaitable } from "./typeUtils.js"; import { Awaitable } from "./typeUtils.js";

View file

@ -4,7 +4,7 @@ import {
ButtonStyle, ButtonStyle,
MessageActionRowComponentBuilder, MessageActionRowComponentBuilder,
MessageComponentInteraction, MessageComponentInteraction,
MessageCreateOptions MessageCreateOptions,
} from "discord.js"; } from "discord.js";
import moment from "moment"; import moment from "moment";
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from "uuid";