refactor: convert /backend to ESM
This commit is contained in:
parent
31d74c05aa
commit
5772e27cda
766 changed files with 3473 additions and 3500 deletions
|
@ -1,12 +1,12 @@
|
|||
import { PluginOptions, guildPlugin } from "knub";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin";
|
||||
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin";
|
||||
import { AutoDeletePluginType, zAutoDeleteConfig } from "./types";
|
||||
import { onMessageCreate } from "./util/onMessageCreate";
|
||||
import { onMessageDelete } from "./util/onMessageDelete";
|
||||
import { onMessageDeleteBulk } from "./util/onMessageDeleteBulk";
|
||||
import { GuildLogs } from "../../data/GuildLogs.js";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages.js";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin.js";
|
||||
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin.js";
|
||||
import { AutoDeletePluginType, zAutoDeleteConfig } from "./types.js";
|
||||
import { onMessageCreate } from "./util/onMessageCreate.js";
|
||||
import { onMessageDelete } from "./util/onMessageDelete.js";
|
||||
import { onMessageDeleteBulk } from "./util/onMessageDeleteBulk.js";
|
||||
|
||||
const defaultOptions: PluginOptions<AutoDeletePluginType> = {
|
||||
config: {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ZeppelinPluginInfo } from "../../types";
|
||||
import { ZeppelinPluginInfo } from "../../types.js";
|
||||
|
||||
export const autoDeletePluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { BasePluginType } from "knub";
|
||||
import z from "zod";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { SavedMessage } from "../../data/entities/SavedMessage";
|
||||
import { MINUTES, zDelayString } from "../../utils";
|
||||
import { GuildLogs } from "../../data/GuildLogs.js";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages.js";
|
||||
import { SavedMessage } from "../../data/entities/SavedMessage.js";
|
||||
import { MINUTES, zDelayString } from "../../utils.js";
|
||||
import Timeout = NodeJS.Timeout;
|
||||
|
||||
export const MAX_DELAY = 5 * MINUTES;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { sorter } from "../../../utils";
|
||||
import { AutoDeletePluginType } from "../types";
|
||||
import { scheduleNextDeletion } from "./scheduleNextDeletion";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
|
||||
import { sorter } from "../../../utils.js";
|
||||
import { AutoDeletePluginType } from "../types.js";
|
||||
import { scheduleNextDeletion } from "./scheduleNextDeletion.js";
|
||||
|
||||
export function addMessageToDeletionQueue(
|
||||
pluginData: GuildPluginData<AutoDeletePluginType>,
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { ChannelType, PermissionsBitField, Snowflake } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import moment from "moment-timezone";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { logger } from "../../../logger";
|
||||
import { resolveUser, verboseChannelMention } from "../../../utils";
|
||||
import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
||||
import { AutoDeletePluginType } from "../types";
|
||||
import { scheduleNextDeletion } from "./scheduleNextDeletion";
|
||||
import { LogType } from "../../../data/LogType.js";
|
||||
import { logger } from "../../../logger.js";
|
||||
import { resolveUser, verboseChannelMention } from "../../../utils.js";
|
||||
import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions.js";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
|
||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin.js";
|
||||
import { AutoDeletePluginType } from "../types.js";
|
||||
import { scheduleNextDeletion } from "./scheduleNextDeletion.js";
|
||||
|
||||
export async function deleteNextItem(pluginData: GuildPluginData<AutoDeletePluginType>) {
|
||||
const [itemToDelete] = pluginData.state.deletionQueue.splice(0, 1);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { convertDelayStringToMS, resolveMember } from "../../../utils";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { AutoDeletePluginType, MAX_DELAY } from "../types";
|
||||
import { addMessageToDeletionQueue } from "./addMessageToDeletionQueue";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
|
||||
import { convertDelayStringToMS, resolveMember } from "../../../utils.js";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
|
||||
import { AutoDeletePluginType, MAX_DELAY } from "../types.js";
|
||||
import { addMessageToDeletionQueue } from "./addMessageToDeletionQueue.js";
|
||||
|
||||
export async function onMessageCreate(pluginData: GuildPluginData<AutoDeletePluginType>, msg: SavedMessage) {
|
||||
const member = await resolveMember(pluginData.client, pluginData.guild, msg.user_id);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { AutoDeletePluginType } from "../types";
|
||||
import { scheduleNextDeletion } from "./scheduleNextDeletion";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
|
||||
import { AutoDeletePluginType } from "../types.js";
|
||||
import { scheduleNextDeletion } from "./scheduleNextDeletion.js";
|
||||
|
||||
export function onMessageDelete(pluginData: GuildPluginData<AutoDeletePluginType>, msg: SavedMessage) {
|
||||
const indexToDelete = pluginData.state.deletionQueue.findIndex((item) => item.message.id === msg.id);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { AutoDeletePluginType } from "../types";
|
||||
import { onMessageDelete } from "./onMessageDelete";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
|
||||
import { AutoDeletePluginType } from "../types.js";
|
||||
import { onMessageDelete } from "./onMessageDelete.js";
|
||||
|
||||
export function onMessageDeleteBulk(pluginData: GuildPluginData<AutoDeletePluginType>, messages: SavedMessage[]) {
|
||||
for (const msg of messages) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { AutoDeletePluginType } from "../types";
|
||||
import { deleteNextItem } from "./deleteNextItem";
|
||||
import { AutoDeletePluginType } from "../types.js";
|
||||
import { deleteNextItem } from "./deleteNextItem.js";
|
||||
|
||||
export function scheduleNextDeletion(pluginData: GuildPluginData<AutoDeletePluginType>) {
|
||||
if (pluginData.state.deletionQueue.length === 0) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { PluginOptions, guildPlugin } from "knub";
|
||||
import { GuildAutoReactions } from "../../data/GuildAutoReactions";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin";
|
||||
import { DisableAutoReactionsCmd } from "./commands/DisableAutoReactionsCmd";
|
||||
import { NewAutoReactionsCmd } from "./commands/NewAutoReactionsCmd";
|
||||
import { AddReactionsEvt } from "./events/AddReactionsEvt";
|
||||
import { AutoReactionsPluginType, zAutoReactionsConfig } from "./types";
|
||||
import { GuildAutoReactions } from "../../data/GuildAutoReactions.js";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages.js";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin.js";
|
||||
import { DisableAutoReactionsCmd } from "./commands/DisableAutoReactionsCmd.js";
|
||||
import { NewAutoReactionsCmd } from "./commands/NewAutoReactionsCmd.js";
|
||||
import { AddReactionsEvt } from "./events/AddReactionsEvt.js";
|
||||
import { AutoReactionsPluginType, zAutoReactionsConfig } from "./types.js";
|
||||
|
||||
const defaultOptions: PluginOptions<AutoReactionsPluginType> = {
|
||||
config: {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { autoReactionsCmd } from "../types";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils.js";
|
||||
import { autoReactionsCmd } from "../types.js";
|
||||
|
||||
export const DisableAutoReactionsCmd = autoReactionsCmd({
|
||||
trigger: "auto_reactions disable",
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { PermissionsBitField } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { canUseEmoji, customEmojiRegex, isEmoji } from "../../../utils";
|
||||
import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions";
|
||||
import { missingPermissionError } from "../../../utils/missingPermissionError";
|
||||
import { readChannelPermissions } from "../../../utils/readChannelPermissions";
|
||||
import { autoReactionsCmd } from "../types";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils.js";
|
||||
import { canUseEmoji, customEmojiRegex, isEmoji } from "../../../utils.js";
|
||||
import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions.js";
|
||||
import { missingPermissionError } from "../../../utils/missingPermissionError.js";
|
||||
import { readChannelPermissions } from "../../../utils/readChannelPermissions.js";
|
||||
import { autoReactionsCmd } from "../types.js";
|
||||
|
||||
const requiredPermissions = readChannelPermissions | PermissionsBitField.Flags.AddReactions;
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { GuildTextBasedChannel, PermissionsBitField } from "discord.js";
|
||||
import { AutoReaction } from "../../../data/entities/AutoReaction";
|
||||
import { isDiscordAPIError } from "../../../utils";
|
||||
import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions";
|
||||
import { missingPermissionError } from "../../../utils/missingPermissionError";
|
||||
import { readChannelPermissions } from "../../../utils/readChannelPermissions";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { autoReactionsEvt } from "../types";
|
||||
import { AutoReaction } from "../../../data/entities/AutoReaction.js";
|
||||
import { isDiscordAPIError } from "../../../utils.js";
|
||||
import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions.js";
|
||||
import { missingPermissionError } from "../../../utils/missingPermissionError.js";
|
||||
import { readChannelPermissions } from "../../../utils/readChannelPermissions.js";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
|
||||
import { autoReactionsEvt } from "../types.js";
|
||||
|
||||
const p = PermissionsBitField.Flags;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { ZeppelinPluginInfo } from "../../types";
|
||||
import { trimPluginDescription } from "../../utils";
|
||||
import { ZeppelinPluginInfo } from "../../types.js";
|
||||
import { trimPluginDescription } from "../../utils.js";
|
||||
|
||||
export const autoReactionsInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { BasePluginType, guildPluginEventListener, guildPluginMessageCommand } from "knub";
|
||||
import z from "zod";
|
||||
import { GuildAutoReactions } from "../../data/GuildAutoReactions";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { AutoReaction } from "../../data/entities/AutoReaction";
|
||||
import { GuildAutoReactions } from "../../data/GuildAutoReactions.js";
|
||||
import { GuildLogs } from "../../data/GuildLogs.js";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages.js";
|
||||
import { AutoReaction } from "../../data/entities/AutoReaction.js";
|
||||
|
||||
export const zAutoReactionsConfig = z.strictObject({
|
||||
can_manage: z.boolean(),
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
import { CooldownManager, guildPlugin } from "knub";
|
||||
import { Queue } from "../../Queue";
|
||||
import { GuildAntiraidLevels } from "../../data/GuildAntiraidLevels";
|
||||
import { GuildArchives } from "../../data/GuildArchives";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { discardRegExpRunner, getRegExpRunner } from "../../regExpRunners";
|
||||
import { MINUTES, SECONDS } from "../../utils";
|
||||
import { registerEventListenersFromMap } from "../../utils/registerEventListenersFromMap";
|
||||
import { unregisterEventListenersFromMap } from "../../utils/unregisterEventListenersFromMap";
|
||||
import { CountersPlugin } from "../Counters/CountersPlugin";
|
||||
import { InternalPosterPlugin } from "../InternalPoster/InternalPosterPlugin";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin";
|
||||
import { ModActionsPlugin } from "../ModActions/ModActionsPlugin";
|
||||
import { MutesPlugin } from "../Mutes/MutesPlugin";
|
||||
import { PhishermanPlugin } from "../Phisherman/PhishermanPlugin";
|
||||
import { RoleManagerPlugin } from "../RoleManager/RoleManagerPlugin";
|
||||
import { AntiraidClearCmd } from "./commands/AntiraidClearCmd";
|
||||
import { SetAntiraidCmd } from "./commands/SetAntiraidCmd";
|
||||
import { ViewAntiraidCmd } from "./commands/ViewAntiraidCmd";
|
||||
import { RunAutomodOnJoinEvt, RunAutomodOnLeaveEvt } from "./events/RunAutomodOnJoinLeaveEvt";
|
||||
import { RunAutomodOnMemberUpdate } from "./events/RunAutomodOnMemberUpdate";
|
||||
import { runAutomodOnCounterTrigger } from "./events/runAutomodOnCounterTrigger";
|
||||
import { runAutomodOnMessage } from "./events/runAutomodOnMessage";
|
||||
import { runAutomodOnModAction } from "./events/runAutomodOnModAction";
|
||||
import { Queue } from "../../Queue.js";
|
||||
import { GuildAntiraidLevels } from "../../data/GuildAntiraidLevels.js";
|
||||
import { GuildArchives } from "../../data/GuildArchives.js";
|
||||
import { GuildLogs } from "../../data/GuildLogs.js";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages.js";
|
||||
import { discardRegExpRunner, getRegExpRunner } from "../../regExpRunners.js";
|
||||
import { MINUTES, SECONDS } from "../../utils.js";
|
||||
import { registerEventListenersFromMap } from "../../utils/registerEventListenersFromMap.js";
|
||||
import { unregisterEventListenersFromMap } from "../../utils/unregisterEventListenersFromMap.js";
|
||||
import { CountersPlugin } from "../Counters/CountersPlugin.js";
|
||||
import { InternalPosterPlugin } from "../InternalPoster/InternalPosterPlugin.js";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin.js";
|
||||
import { ModActionsPlugin } from "../ModActions/ModActionsPlugin.js";
|
||||
import { MutesPlugin } from "../Mutes/MutesPlugin.js";
|
||||
import { PhishermanPlugin } from "../Phisherman/PhishermanPlugin.js";
|
||||
import { RoleManagerPlugin } from "../RoleManager/RoleManagerPlugin.js";
|
||||
import { AntiraidClearCmd } from "./commands/AntiraidClearCmd.js";
|
||||
import { SetAntiraidCmd } from "./commands/SetAntiraidCmd.js";
|
||||
import { ViewAntiraidCmd } from "./commands/ViewAntiraidCmd.js";
|
||||
import { RunAutomodOnJoinEvt, RunAutomodOnLeaveEvt } from "./events/RunAutomodOnJoinLeaveEvt.js";
|
||||
import { RunAutomodOnMemberUpdate } from "./events/RunAutomodOnMemberUpdate.js";
|
||||
import { runAutomodOnCounterTrigger } from "./events/runAutomodOnCounterTrigger.js";
|
||||
import { runAutomodOnMessage } from "./events/runAutomodOnMessage.js";
|
||||
import { runAutomodOnModAction } from "./events/runAutomodOnModAction.js";
|
||||
import {
|
||||
RunAutomodOnThreadCreate,
|
||||
RunAutomodOnThreadDelete,
|
||||
RunAutomodOnThreadUpdate,
|
||||
} from "./events/runAutomodOnThreadEvents";
|
||||
import { clearOldRecentNicknameChanges } from "./functions/clearOldNicknameChanges";
|
||||
import { clearOldRecentActions } from "./functions/clearOldRecentActions";
|
||||
import { clearOldRecentSpam } from "./functions/clearOldRecentSpam";
|
||||
import { AutomodPluginType, zAutomodConfig } from "./types";
|
||||
} from "./events/runAutomodOnThreadEvents.js";
|
||||
import { clearOldRecentNicknameChanges } from "./functions/clearOldNicknameChanges.js";
|
||||
import { clearOldRecentActions } from "./functions/clearOldRecentActions.js";
|
||||
import { clearOldRecentSpam } from "./functions/clearOldRecentSpam.js";
|
||||
import { AutomodPluginType, zAutomodConfig } from "./types.js";
|
||||
|
||||
const defaultOptions = {
|
||||
config: {
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { PermissionFlagsBits, Snowflake } from "discord.js";
|
||||
import z from "zod";
|
||||
import { nonNullish, unique, zSnowflake } from "../../../utils";
|
||||
import { canAssignRole } from "../../../utils/canAssignRole";
|
||||
import { getMissingPermissions } from "../../../utils/getMissingPermissions";
|
||||
import { missingPermissionError } from "../../../utils/missingPermissionError";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { RoleManagerPlugin } from "../../RoleManager/RoleManagerPlugin";
|
||||
import { ignoreRoleChange } from "../functions/ignoredRoleChanges";
|
||||
import { automodAction } from "../helpers";
|
||||
import { nonNullish, unique, zSnowflake } from "../../../utils.js";
|
||||
import { canAssignRole } from "../../../utils/canAssignRole.js";
|
||||
import { getMissingPermissions } from "../../../utils/getMissingPermissions.js";
|
||||
import { missingPermissionError } from "../../../utils/missingPermissionError.js";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
|
||||
import { RoleManagerPlugin } from "../../RoleManager/RoleManagerPlugin.js";
|
||||
import { ignoreRoleChange } from "../functions/ignoredRoleChanges.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
const p = PermissionFlagsBits;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import z from "zod";
|
||||
import { zBoundedCharacters } from "../../../utils";
|
||||
import { CountersPlugin } from "../../Counters/CountersPlugin";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { automodAction } from "../helpers";
|
||||
import { zBoundedCharacters } from "../../../utils.js";
|
||||
import { CountersPlugin } from "../../Counters/CountersPlugin.js";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
const configSchema = z.object({
|
||||
counter: zBoundedCharacters(0, 100),
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { Snowflake } from "discord.js";
|
||||
import z from "zod";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { LogType } from "../../../data/LogType.js";
|
||||
import {
|
||||
createTypedTemplateSafeValueContainer,
|
||||
renderTemplate,
|
||||
TemplateParseError,
|
||||
TemplateSafeValueContainer,
|
||||
} from "../../../templateFormatter";
|
||||
} from "../../../templateFormatter.js";
|
||||
import {
|
||||
chunkMessageLines,
|
||||
isTruthy,
|
||||
|
@ -17,13 +17,13 @@ import {
|
|||
zBoundedCharacters,
|
||||
zNullishToUndefined,
|
||||
zSnowflake,
|
||||
} from "../../../utils";
|
||||
import { erisAllowedMentionsToDjsMentionOptions } from "../../../utils/erisAllowedMentionsToDjsMentionOptions";
|
||||
import { messageIsEmpty } from "../../../utils/messageIsEmpty";
|
||||
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
|
||||
import { InternalPosterPlugin } from "../../InternalPoster/InternalPosterPlugin";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { automodAction } from "../helpers";
|
||||
} from "../../../utils.js";
|
||||
import { erisAllowedMentionsToDjsMentionOptions } from "../../../utils/erisAllowedMentionsToDjsMentionOptions.js";
|
||||
import { messageIsEmpty } from "../../../utils/messageIsEmpty.js";
|
||||
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects.js";
|
||||
import { InternalPosterPlugin } from "../../InternalPoster/InternalPosterPlugin.js";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
const configSchema = z.object({
|
||||
channel: zSnowflake,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { AnyThreadChannel } from "discord.js";
|
||||
import z from "zod";
|
||||
import { noop } from "../../../utils";
|
||||
import { automodAction } from "../helpers";
|
||||
import { noop } from "../../../utils.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
const configSchema = z.strictObject({});
|
||||
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
import { AutomodActionBlueprint } from "../helpers";
|
||||
import { AddRolesAction } from "./addRoles";
|
||||
import { AddToCounterAction } from "./addToCounter";
|
||||
import { AlertAction } from "./alert";
|
||||
import { ArchiveThreadAction } from "./archiveThread";
|
||||
import { BanAction } from "./ban";
|
||||
import { ChangeNicknameAction } from "./changeNickname";
|
||||
import { ChangePermsAction } from "./changePerms";
|
||||
import { CleanAction } from "./clean";
|
||||
import { KickAction } from "./kick";
|
||||
import { LogAction } from "./log";
|
||||
import { MuteAction } from "./mute";
|
||||
import { PauseInvitesAction } from "./pauseInvites";
|
||||
import { RemoveRolesAction } from "./removeRoles";
|
||||
import { ReplyAction } from "./reply";
|
||||
import { SetAntiraidLevelAction } from "./setAntiraidLevel";
|
||||
import { SetCounterAction } from "./setCounter";
|
||||
import { SetSlowmodeAction } from "./setSlowmode";
|
||||
import { StartThreadAction } from "./startThread";
|
||||
import { WarnAction } from "./warn";
|
||||
import { AutomodActionBlueprint } from "../helpers.js";
|
||||
import { AddRolesAction } from "./addRoles.js";
|
||||
import { AddToCounterAction } from "./addToCounter.js";
|
||||
import { AlertAction } from "./alert.js";
|
||||
import { ArchiveThreadAction } from "./archiveThread.js";
|
||||
import { BanAction } from "./ban.js";
|
||||
import { ChangeNicknameAction } from "./changeNickname.js";
|
||||
import { ChangePermsAction } from "./changePerms.js";
|
||||
import { CleanAction } from "./clean.js";
|
||||
import { KickAction } from "./kick.js";
|
||||
import { LogAction } from "./log.js";
|
||||
import { MuteAction } from "./mute.js";
|
||||
import { PauseInvitesAction } from "./pauseInvites.js";
|
||||
import { RemoveRolesAction } from "./removeRoles.js";
|
||||
import { ReplyAction } from "./reply.js";
|
||||
import { SetAntiraidLevelAction } from "./setAntiraidLevel.js";
|
||||
import { SetCounterAction } from "./setCounter.js";
|
||||
import { SetSlowmodeAction } from "./setSlowmode.js";
|
||||
import { StartThreadAction } from "./startThread.js";
|
||||
import { WarnAction } from "./warn.js";
|
||||
|
||||
export const availableActions = {
|
||||
clean: CleanAction,
|
||||
|
|
|
@ -6,12 +6,12 @@ import {
|
|||
zBoundedCharacters,
|
||||
zDelayString,
|
||||
zSnowflake,
|
||||
} from "../../../utils";
|
||||
import { CaseArgs } from "../../Cases/types";
|
||||
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
|
||||
import { zNotify } from "../constants";
|
||||
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
|
||||
import { automodAction } from "../helpers";
|
||||
} from "../../../utils.js";
|
||||
import { CaseArgs } from "../../Cases/types.js";
|
||||
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin.js";
|
||||
import { zNotify } from "../constants.js";
|
||||
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
const configSchema = z.strictObject({
|
||||
reason: zBoundedCharacters(0, 4000).nullable().default(null),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import z from "zod";
|
||||
import { nonNullish, unique, zBoundedCharacters } from "../../../utils";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { automodAction } from "../helpers";
|
||||
import { nonNullish, unique, zBoundedCharacters } from "../../../utils.js";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
export const ChangeNicknameAction = automodAction({
|
||||
configSchema: z.union([
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import { PermissionsBitField, PermissionsString } from "discord.js";
|
||||
import { U } from "ts-toolbelt";
|
||||
import z from "zod";
|
||||
import { TemplateParseError, TemplateSafeValueContainer, renderTemplate } from "../../../templateFormatter";
|
||||
import { isValidSnowflake, keys, noop, zBoundedCharacters } from "../../../utils";
|
||||
import { TemplateParseError, TemplateSafeValueContainer, renderTemplate } from "../../../templateFormatter.js";
|
||||
import { isValidSnowflake, keys, noop, zBoundedCharacters } from "../../../utils.js";
|
||||
import {
|
||||
guildToTemplateSafeGuild,
|
||||
savedMessageToTemplateSafeSavedMessage,
|
||||
userToTemplateSafeUser,
|
||||
} from "../../../utils/templateSafeObjects";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { automodAction } from "../helpers";
|
||||
} from "../../../utils/templateSafeObjects.js";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
type LegacyPermMap = Record<string, keyof (typeof PermissionsBitField)["Flags"]>;
|
||||
const legacyPermMap = {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { GuildTextBasedChannel, Snowflake } from "discord.js";
|
||||
import z from "zod";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { noop } from "../../../utils";
|
||||
import { automodAction } from "../helpers";
|
||||
import { LogType } from "../../../data/LogType.js";
|
||||
import { noop } from "../../../utils.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
export const CleanAction = automodAction({
|
||||
configSchema: z.boolean().default(false),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import z from "zod";
|
||||
import { zBoundedCharacters } from "../../../utils";
|
||||
import { automodAction } from "../helpers";
|
||||
import { zBoundedCharacters } from "../../../utils.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
export const ExampleAction = automodAction({
|
||||
configSchema: z.strictObject({
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import z from "zod";
|
||||
import { asyncMap, nonNullish, resolveMember, unique, zBoundedCharacters, zSnowflake } from "../../../utils";
|
||||
import { CaseArgs } from "../../Cases/types";
|
||||
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
|
||||
import { zNotify } from "../constants";
|
||||
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
|
||||
import { automodAction } from "../helpers";
|
||||
import { asyncMap, nonNullish, resolveMember, unique, zBoundedCharacters, zSnowflake } from "../../../utils.js";
|
||||
import { CaseArgs } from "../../Cases/types.js";
|
||||
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin.js";
|
||||
import { zNotify } from "../constants.js";
|
||||
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
export const KickAction = automodAction({
|
||||
configSchema: z.strictObject({
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import z from "zod";
|
||||
import { isTruthy, unique } from "../../../utils";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { automodAction } from "../helpers";
|
||||
import { isTruthy, unique } from "../../../utils.js";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
export const LogAction = automodAction({
|
||||
configSchema: z.boolean().default(true),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import z from "zod";
|
||||
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
|
||||
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError.js";
|
||||
import {
|
||||
convertDelayStringToMS,
|
||||
nonNullish,
|
||||
|
@ -7,13 +7,13 @@ import {
|
|||
zBoundedCharacters,
|
||||
zDelayString,
|
||||
zSnowflake,
|
||||
} from "../../../utils";
|
||||
import { CaseArgs } from "../../Cases/types";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { MutesPlugin } from "../../Mutes/MutesPlugin";
|
||||
import { zNotify } from "../constants";
|
||||
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
|
||||
import { automodAction } from "../helpers";
|
||||
} from "../../../utils.js";
|
||||
import { CaseArgs } from "../../Cases/types.js";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
|
||||
import { MutesPlugin } from "../../Mutes/MutesPlugin.js";
|
||||
import { zNotify } from "../constants.js";
|
||||
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
export const MuteAction = automodAction({
|
||||
configSchema: z.strictObject({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { GuildFeature } from "discord.js";
|
||||
import z from "zod";
|
||||
import { automodAction } from "../helpers";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
export const PauseInvitesAction = automodAction({
|
||||
configSchema: z.strictObject({
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { PermissionFlagsBits, Snowflake } from "discord.js";
|
||||
import z from "zod";
|
||||
import { nonNullish, unique, zSnowflake } from "../../../utils";
|
||||
import { canAssignRole } from "../../../utils/canAssignRole";
|
||||
import { getMissingPermissions } from "../../../utils/getMissingPermissions";
|
||||
import { memberRolesLock } from "../../../utils/lockNameHelpers";
|
||||
import { missingPermissionError } from "../../../utils/missingPermissionError";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { ignoreRoleChange } from "../functions/ignoredRoleChanges";
|
||||
import { automodAction } from "../helpers";
|
||||
import { nonNullish, unique, zSnowflake } from "../../../utils.js";
|
||||
import { canAssignRole } from "../../../utils/canAssignRole.js";
|
||||
import { getMissingPermissions } from "../../../utils/getMissingPermissions.js";
|
||||
import { memberRolesLock } from "../../../utils/lockNameHelpers.js";
|
||||
import { missingPermissionError } from "../../../utils/missingPermissionError.js";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
|
||||
import { ignoreRoleChange } from "../functions/ignoredRoleChanges.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
const p = PermissionFlagsBits;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { GuildTextBasedChannel, MessageCreateOptions, PermissionsBitField, Snowflake, User } from "discord.js";
|
||||
import z from "zod";
|
||||
import { TemplateParseError, TemplateSafeValueContainer, renderTemplate } from "../../../templateFormatter";
|
||||
import { TemplateParseError, TemplateSafeValueContainer, renderTemplate } from "../../../templateFormatter.js";
|
||||
import {
|
||||
convertDelayStringToMS,
|
||||
noop,
|
||||
|
@ -11,13 +11,13 @@ import {
|
|||
zBoundedCharacters,
|
||||
zDelayString,
|
||||
zMessageContent,
|
||||
} from "../../../utils";
|
||||
import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
|
||||
import { messageIsEmpty } from "../../../utils/messageIsEmpty";
|
||||
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { automodAction } from "../helpers";
|
||||
import { AutomodContext } from "../types";
|
||||
} from "../../../utils.js";
|
||||
import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions.js";
|
||||
import { messageIsEmpty } from "../../../utils/messageIsEmpty.js";
|
||||
import { userToTemplateSafeUser } from "../../../utils/templateSafeObjects.js";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
import { AutomodContext } from "../types.js";
|
||||
|
||||
export const ReplyAction = automodAction({
|
||||
configSchema: z.union([
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { zBoundedCharacters } from "../../../utils";
|
||||
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
|
||||
import { automodAction } from "../helpers";
|
||||
import { zBoundedCharacters } from "../../../utils.js";
|
||||
import { setAntiraidLevel } from "../functions/setAntiraidLevel.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
export const SetAntiraidLevelAction = automodAction({
|
||||
configSchema: zBoundedCharacters(0, 100).nullable(),
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import z from "zod";
|
||||
import { MAX_COUNTER_VALUE, MIN_COUNTER_VALUE } from "../../../data/GuildCounters";
|
||||
import { zBoundedCharacters } from "../../../utils";
|
||||
import { CountersPlugin } from "../../Counters/CountersPlugin";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { automodAction } from "../helpers";
|
||||
import { MAX_COUNTER_VALUE, MIN_COUNTER_VALUE } from "../../../data/GuildCounters.js";
|
||||
import { zBoundedCharacters } from "../../../utils.js";
|
||||
import { CountersPlugin } from "../../Counters/CountersPlugin.js";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
export const SetCounterAction = automodAction({
|
||||
configSchema: z.strictObject({
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { ChannelType, GuildTextBasedChannel, Snowflake } from "discord.js";
|
||||
import z from "zod";
|
||||
import { convertDelayStringToMS, isDiscordAPIError, zDelayString, zSnowflake } from "../../../utils";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { automodAction } from "../helpers";
|
||||
import { convertDelayStringToMS, isDiscordAPIError, zDelayString, zSnowflake } from "../../../utils.js";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
export const SetSlowmodeAction = automodAction({
|
||||
configSchema: z.strictObject({
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { ChannelType, GuildTextThreadCreateOptions, ThreadAutoArchiveDuration, ThreadChannel } from "discord.js";
|
||||
import z from "zod";
|
||||
import { TemplateParseError, TemplateSafeValueContainer, renderTemplate } from "../../../templateFormatter";
|
||||
import { MINUTES, convertDelayStringToMS, noop, zBoundedCharacters, zDelayString } from "../../../utils";
|
||||
import { savedMessageToTemplateSafeSavedMessage, userToTemplateSafeUser } from "../../../utils/templateSafeObjects";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { automodAction } from "../helpers";
|
||||
import { TemplateParseError, TemplateSafeValueContainer, renderTemplate } from "../../../templateFormatter.js";
|
||||
import { MINUTES, convertDelayStringToMS, noop, zBoundedCharacters, zDelayString } from "../../../utils.js";
|
||||
import { savedMessageToTemplateSafeSavedMessage, userToTemplateSafeUser } from "../../../utils/templateSafeObjects.js";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
const validThreadAutoArchiveDurations: ThreadAutoArchiveDuration[] = [
|
||||
ThreadAutoArchiveDuration.OneHour,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import z from "zod";
|
||||
import { asyncMap, nonNullish, resolveMember, unique, zBoundedCharacters, zSnowflake } from "../../../utils";
|
||||
import { CaseArgs } from "../../Cases/types";
|
||||
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
|
||||
import { zNotify } from "../constants";
|
||||
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
|
||||
import { automodAction } from "../helpers";
|
||||
import { asyncMap, nonNullish, resolveMember, unique, zBoundedCharacters, zSnowflake } from "../../../utils.js";
|
||||
import { CaseArgs } from "../../Cases/types.js";
|
||||
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin.js";
|
||||
import { zNotify } from "../constants.js";
|
||||
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods.js";
|
||||
import { automodAction } from "../helpers.js";
|
||||
|
||||
export const WarnAction = automodAction({
|
||||
configSchema: z.strictObject({
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { guildPluginMessageCommand } from "knub";
|
||||
import { sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
|
||||
import { AutomodPluginType } from "../types";
|
||||
import { sendSuccessMessage } from "../../../pluginUtils.js";
|
||||
import { setAntiraidLevel } from "../functions/setAntiraidLevel.js";
|
||||
import { AutomodPluginType } from "../types.js";
|
||||
|
||||
export const AntiraidClearCmd = guildPluginMessageCommand<AutomodPluginType>()({
|
||||
trigger: ["antiraid clear", "antiraid reset", "antiraid none", "antiraid off"],
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { guildPluginMessageCommand } from "knub";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
|
||||
import { AutomodPluginType } from "../types";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils.js";
|
||||
import { setAntiraidLevel } from "../functions/setAntiraidLevel.js";
|
||||
import { AutomodPluginType } from "../types.js";
|
||||
|
||||
export const SetAntiraidCmd = guildPluginMessageCommand<AutomodPluginType>()({
|
||||
trigger: "antiraid",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { guildPluginMessageCommand } from "knub";
|
||||
import { AutomodPluginType } from "../types";
|
||||
import { AutomodPluginType } from "../types.js";
|
||||
|
||||
export const ViewAntiraidCmd = guildPluginMessageCommand<AutomodPluginType>()({
|
||||
trigger: "antiraid",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import z from "zod";
|
||||
import { MINUTES, SECONDS } from "../../utils";
|
||||
import { MINUTES, SECONDS } from "../../utils.js";
|
||||
|
||||
export const RECENT_SPAM_EXPIRY_TIME = 10 * SECONDS;
|
||||
export const RECENT_ACTION_EXPIRY_TIME = 5 * MINUTES;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { guildPluginEventListener } from "knub";
|
||||
import { RecentActionType } from "../constants";
|
||||
import { runAutomod } from "../functions/runAutomod";
|
||||
import { AutomodContext, AutomodPluginType } from "../types";
|
||||
import { RecentActionType } from "../constants.js";
|
||||
import { runAutomod } from "../functions/runAutomod.js";
|
||||
import { AutomodContext, AutomodPluginType } from "../types.js";
|
||||
|
||||
export const RunAutomodOnJoinEvt = guildPluginEventListener<AutomodPluginType>()({
|
||||
event: "guildMemberAdd",
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { guildPluginEventListener } from "knub";
|
||||
import diff from "lodash.difference";
|
||||
import isEqual from "lodash.isequal";
|
||||
import { runAutomod } from "../functions/runAutomod";
|
||||
import { AutomodContext, AutomodPluginType } from "../types";
|
||||
import diff from "lodash/difference.js";
|
||||
import isEqual from "lodash/isEqual.js";
|
||||
import { runAutomod } from "../functions/runAutomod.js";
|
||||
import { AutomodContext, AutomodPluginType } from "../types.js";
|
||||
|
||||
export const RunAutomodOnMemberUpdate = guildPluginEventListener<AutomodPluginType>()({
|
||||
event: "guildMemberUpdate",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { User } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { runAutomod } from "../functions/runAutomod";
|
||||
import { AutomodContext, AutomodPluginType } from "../types";
|
||||
import { runAutomod } from "../functions/runAutomod.js";
|
||||
import { AutomodContext, AutomodPluginType } from "../types.js";
|
||||
|
||||
export async function runAutomodOnAntiraidLevel(
|
||||
pluginData: GuildPluginData<AutomodPluginType>,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { resolveMember, resolveUser, UnknownUser } from "../../../utils";
|
||||
import { CountersPlugin } from "../../Counters/CountersPlugin";
|
||||
import { runAutomod } from "../functions/runAutomod";
|
||||
import { AutomodContext, AutomodPluginType } from "../types";
|
||||
import { resolveMember, resolveUser, UnknownUser } from "../../../utils.js";
|
||||
import { CountersPlugin } from "../../Counters/CountersPlugin.js";
|
||||
import { runAutomod } from "../functions/runAutomod.js";
|
||||
import { AutomodContext, AutomodPluginType } from "../types.js";
|
||||
|
||||
export async function runAutomodOnCounterTrigger(
|
||||
pluginData: GuildPluginData<AutomodPluginType>,
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import moment from "moment-timezone";
|
||||
import { performance } from "perf_hooks";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { profilingEnabled } from "../../../utils/easyProfiler";
|
||||
import { addRecentActionsFromMessage } from "../functions/addRecentActionsFromMessage";
|
||||
import { clearRecentActionsForMessage } from "../functions/clearRecentActionsForMessage";
|
||||
import { runAutomod } from "../functions/runAutomod";
|
||||
import { AutomodContext, AutomodPluginType } from "../types";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
|
||||
import { profilingEnabled } from "../../../utils/easyProfiler.js";
|
||||
import { addRecentActionsFromMessage } from "../functions/addRecentActionsFromMessage.js";
|
||||
import { clearRecentActionsForMessage } from "../functions/clearRecentActionsForMessage.js";
|
||||
import { runAutomod } from "../functions/runAutomod.js";
|
||||
import { AutomodContext, AutomodPluginType } from "../types.js";
|
||||
|
||||
export async function runAutomodOnMessage(
|
||||
pluginData: GuildPluginData<AutomodPluginType>,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { resolveMember, resolveUser, UnknownUser } from "../../../utils";
|
||||
import { ModActionType } from "../../ModActions/types";
|
||||
import { runAutomod } from "../functions/runAutomod";
|
||||
import { AutomodContext, AutomodPluginType } from "../types";
|
||||
import { resolveMember, resolveUser, UnknownUser } from "../../../utils.js";
|
||||
import { ModActionType } from "../../ModActions/types.js";
|
||||
import { runAutomod } from "../functions/runAutomod.js";
|
||||
import { AutomodContext, AutomodPluginType } from "../types.js";
|
||||
|
||||
export async function runAutomodOnModAction(
|
||||
pluginData: GuildPluginData<AutomodPluginType>,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { guildPluginEventListener } from "knub";
|
||||
import { RecentActionType } from "../constants";
|
||||
import { runAutomod } from "../functions/runAutomod";
|
||||
import { AutomodContext, AutomodPluginType } from "../types";
|
||||
import { RecentActionType } from "../constants.js";
|
||||
import { runAutomod } from "../functions/runAutomod.js";
|
||||
import { AutomodContext, AutomodPluginType } from "../types.js";
|
||||
|
||||
export const RunAutomodOnThreadCreate = guildPluginEventListener<AutomodPluginType>()({
|
||||
event: "threadCreate",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { getEmojiInString, getRoleMentions, getUrlsInString, getUserMentions } from "../../../utils";
|
||||
import { RecentActionType } from "../constants";
|
||||
import { AutomodContext, AutomodPluginType } from "../types";
|
||||
import { getEmojiInString, getRoleMentions, getUrlsInString, getUserMentions } from "../../../utils.js";
|
||||
import { RecentActionType } from "../constants.js";
|
||||
import { AutomodContext, AutomodPluginType } from "../types.js";
|
||||
|
||||
export function addRecentActionsFromMessage(pluginData: GuildPluginData<AutomodPluginType>, context: AutomodContext) {
|
||||
const message = context.message!;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { convertDelayStringToMS } from "../../../utils";
|
||||
import { AutomodContext, AutomodPluginType, TRule } from "../types";
|
||||
import { convertDelayStringToMS } from "../../../utils.js";
|
||||
import { AutomodContext, AutomodPluginType, TRule } from "../types.js";
|
||||
|
||||
export function applyCooldown(pluginData: GuildPluginData<AutomodPluginType>, rule: TRule, context: AutomodContext) {
|
||||
const cooldownKey = `${rule.name}-${context.user?.id}`;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { AutomodContext, AutomodPluginType, TRule } from "../types";
|
||||
import { AutomodContext, AutomodPluginType, TRule } from "../types.js";
|
||||
|
||||
export function checkCooldown(pluginData: GuildPluginData<AutomodPluginType>, rule: TRule, context: AutomodContext) {
|
||||
const cooldownKey = `${rule.name}-${context.user?.id}`;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { RECENT_NICKNAME_CHANGE_EXPIRY_TIME } from "../constants";
|
||||
import { AutomodPluginType } from "../types";
|
||||
import { RECENT_NICKNAME_CHANGE_EXPIRY_TIME } from "../constants.js";
|
||||
import { AutomodPluginType } from "../types.js";
|
||||
|
||||
export function clearOldRecentNicknameChanges(pluginData: GuildPluginData<AutomodPluginType>) {
|
||||
const now = Date.now();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { startProfiling } from "../../../utils/easyProfiler";
|
||||
import { RECENT_ACTION_EXPIRY_TIME } from "../constants";
|
||||
import { AutomodPluginType } from "../types";
|
||||
import { startProfiling } from "../../../utils/easyProfiler.js";
|
||||
import { RECENT_ACTION_EXPIRY_TIME } from "../constants.js";
|
||||
import { AutomodPluginType } from "../types.js";
|
||||
|
||||
export function clearOldRecentActions(pluginData: GuildPluginData<AutomodPluginType>) {
|
||||
const stopProfiling = startProfiling(pluginData.getKnubInstance().profiler, "automod:fns:clearOldRecentActions");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { startProfiling } from "../../../utils/easyProfiler";
|
||||
import { RECENT_SPAM_EXPIRY_TIME } from "../constants";
|
||||
import { AutomodPluginType } from "../types";
|
||||
import { startProfiling } from "../../../utils/easyProfiler.js";
|
||||
import { RECENT_SPAM_EXPIRY_TIME } from "../constants.js";
|
||||
import { AutomodPluginType } from "../types.js";
|
||||
|
||||
export function clearOldRecentSpam(pluginData: GuildPluginData<AutomodPluginType>) {
|
||||
const stopProfiling = startProfiling(pluginData.getKnubInstance().profiler, "automod:fns:clearOldRecentSpam");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { startProfiling } from "../../../utils/easyProfiler";
|
||||
import { AutomodContext, AutomodPluginType } from "../types";
|
||||
import { startProfiling } from "../../../utils/easyProfiler.js";
|
||||
import { AutomodContext, AutomodPluginType } from "../types.js";
|
||||
|
||||
export function clearRecentActionsForMessage(pluginData: GuildPluginData<AutomodPluginType>, context: AutomodContext) {
|
||||
const stopProfiling = startProfiling(
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import z from "zod";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { humanizeDurationShort } from "../../../humanizeDurationShort";
|
||||
import { getBaseUrl } from "../../../pluginUtils";
|
||||
import { convertDelayStringToMS, sorter, zDelayString } from "../../../utils";
|
||||
import { RecentActionType } from "../constants";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { findRecentSpam } from "./findRecentSpam";
|
||||
import { getMatchingMessageRecentActions } from "./getMatchingMessageRecentActions";
|
||||
import { getMessageSpamIdentifier } from "./getSpamIdentifier";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
|
||||
import { humanizeDurationShort } from "../../../humanizeDurationShort.js";
|
||||
import { getBaseUrl } from "../../../pluginUtils.js";
|
||||
import { convertDelayStringToMS, sorter, zDelayString } from "../../../utils.js";
|
||||
import { RecentActionType } from "../constants.js";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
import { findRecentSpam } from "./findRecentSpam.js";
|
||||
import { getMatchingMessageRecentActions } from "./getMatchingMessageRecentActions.js";
|
||||
import { getMessageSpamIdentifier } from "./getSpamIdentifier.js";
|
||||
|
||||
export interface TMessageSpamMatchResultType {
|
||||
archiveId: string;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { startProfiling } from "../../../utils/easyProfiler";
|
||||
import { RecentActionType } from "../constants";
|
||||
import { AutomodPluginType } from "../types";
|
||||
import { startProfiling } from "../../../utils/easyProfiler.js";
|
||||
import { RecentActionType } from "../constants.js";
|
||||
import { AutomodPluginType } from "../types.js";
|
||||
|
||||
export function findRecentSpam(
|
||||
pluginData: GuildPluginData<AutomodPluginType>,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import moment from "moment-timezone";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { startProfiling } from "../../../utils/easyProfiler";
|
||||
import { RecentActionType } from "../constants";
|
||||
import { AutomodPluginType } from "../types";
|
||||
import { getMatchingRecentActions } from "./getMatchingRecentActions";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
|
||||
import { startProfiling } from "../../../utils/easyProfiler.js";
|
||||
import { RecentActionType } from "../constants.js";
|
||||
import { AutomodPluginType } from "../types.js";
|
||||
import { getMatchingRecentActions } from "./getMatchingRecentActions.js";
|
||||
|
||||
export function getMatchingMessageRecentActions(
|
||||
pluginData: GuildPluginData<AutomodPluginType>,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { startProfiling } from "../../../utils/easyProfiler";
|
||||
import { RecentActionType } from "../constants";
|
||||
import { AutomodPluginType } from "../types";
|
||||
import { startProfiling } from "../../../utils/easyProfiler.js";
|
||||
import { RecentActionType } from "../constants.js";
|
||||
import { AutomodPluginType } from "../types.js";
|
||||
|
||||
export function getMatchingRecentActions(
|
||||
pluginData: GuildPluginData<AutomodPluginType>,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
|
||||
|
||||
export function getMessageSpamIdentifier(message: SavedMessage, perChannel: boolean) {
|
||||
return perChannel ? `${message.channel_id}-${message.user_id}` : message.user_id;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { ActivityType, Snowflake } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { messageSummary, verboseChannelMention } from "../../../utils";
|
||||
import { AutomodContext, AutomodPluginType } from "../types";
|
||||
import { MatchableTextType } from "./matchMultipleTextTypesOnMessage";
|
||||
import { messageSummary, verboseChannelMention } from "../../../utils.js";
|
||||
import { AutomodContext, AutomodPluginType } from "../types.js";
|
||||
import { MatchableTextType } from "./matchMultipleTextTypesOnMessage.js";
|
||||
|
||||
export function getTextMatchPartialSummary(
|
||||
pluginData: GuildPluginData<AutomodPluginType>,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { MINUTES } from "../../../utils";
|
||||
import { AutomodPluginType } from "../types";
|
||||
import { MINUTES } from "../../../utils.js";
|
||||
import { AutomodPluginType } from "../types.js";
|
||||
|
||||
const IGNORED_ROLE_CHANGE_LIFETIME = 5 * MINUTES;
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { ActivityType, Embed } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { renderUsername, resolveMember } from "../../../utils";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
|
||||
import { renderUsername, resolveMember } from "../../../utils.js";
|
||||
import { DeepMutable } from "../../../utils/typeUtils.js";
|
||||
import { AutomodPluginType } from "../types";
|
||||
import { AutomodPluginType } from "../types.js";
|
||||
|
||||
type TextTriggerWithMultipleMatchTypes = {
|
||||
match_messages: boolean;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Snowflake } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
|
||||
import { UserNotificationMethod, disableUserNotificationStrings } from "../../../utils";
|
||||
import { AutomodPluginType } from "../types";
|
||||
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError.js";
|
||||
import { UserNotificationMethod, disableUserNotificationStrings } from "../../../utils.js";
|
||||
import { AutomodPluginType } from "../types.js";
|
||||
|
||||
export function resolveActionContactMethods(
|
||||
pluginData: GuildPluginData<AutomodPluginType>,
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { GuildTextBasedChannel, Snowflake } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { performance } from "perf_hooks";
|
||||
import { calculateBlocking, profilingEnabled } from "../../../utils/easyProfiler";
|
||||
import { availableActions } from "../actions/availableActions";
|
||||
import { CleanAction } from "../actions/clean";
|
||||
import { AutomodTriggerMatchResult } from "../helpers";
|
||||
import { availableTriggers } from "../triggers/availableTriggers";
|
||||
import { AutomodContext, AutomodPluginType } from "../types";
|
||||
import { applyCooldown } from "./applyCooldown";
|
||||
import { checkCooldown } from "./checkCooldown";
|
||||
import { calculateBlocking, profilingEnabled } from "../../../utils/easyProfiler.js";
|
||||
import { availableActions } from "../actions/availableActions.js";
|
||||
import { CleanAction } from "../actions/clean.js";
|
||||
import { AutomodTriggerMatchResult } from "../helpers.js";
|
||||
import { availableTriggers } from "../triggers/availableTriggers.js";
|
||||
import { AutomodContext, AutomodPluginType } from "../types.js";
|
||||
import { applyCooldown } from "./applyCooldown.js";
|
||||
import { checkCooldown } from "./checkCooldown.js";
|
||||
|
||||
export async function runAutomod(pluginData: GuildPluginData<AutomodPluginType>, context: AutomodContext) {
|
||||
const userId = context.user?.id || context.member?.id || context.message?.user_id;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { User } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { runAutomodOnAntiraidLevel } from "../events/runAutomodOnAntiraidLevel";
|
||||
import { AutomodPluginType } from "../types";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
|
||||
import { runAutomodOnAntiraidLevel } from "../events/runAutomodOnAntiraidLevel.js";
|
||||
import { AutomodPluginType } from "../types.js";
|
||||
|
||||
export async function setAntiraidLevel(
|
||||
pluginData: GuildPluginData<AutomodPluginType>,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { RecentAction } from "../types";
|
||||
import { RecentAction } from "../types.js";
|
||||
|
||||
export function sumRecentActionCounts(actions: RecentAction[]) {
|
||||
return actions.reduce((total, action) => total + action.count, 0);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import z, { ZodTypeAny } from "zod";
|
||||
import { Awaitable } from "../../utils/typeUtils";
|
||||
import { AutomodContext, AutomodPluginType } from "./types";
|
||||
import { Awaitable } from "../../utils/typeUtils.js";
|
||||
import { AutomodContext, AutomodPluginType } from "./types.js";
|
||||
|
||||
interface BaseAutomodTriggerMatchResult {
|
||||
extraContexts?: AutomodContext[];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { ZeppelinPluginInfo } from "../../types";
|
||||
import { trimPluginDescription } from "../../utils";
|
||||
import { ZeppelinPluginInfo } from "../../types.js";
|
||||
import { trimPluginDescription } from "../../utils.js";
|
||||
|
||||
export const automodPluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import z from "zod";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
interface AntiraidLevelTriggerResult {}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Snowflake } from "discord.js";
|
||||
import z from "zod";
|
||||
import { verboseChannelMention } from "../../../utils";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { verboseChannelMention } from "../../../utils.js";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
interface AnyMessageResultType {}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { RecentActionType } from "../constants";
|
||||
import { createMessageSpamTrigger } from "../functions/createMessageSpamTrigger";
|
||||
import { RecentActionType } from "../constants.js";
|
||||
import { createMessageSpamTrigger } from "../functions/createMessageSpamTrigger.js";
|
||||
|
||||
export const AttachmentSpamTrigger = createMessageSpamTrigger(RecentActionType.Attachment, "attachment");
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
import { AutomodTriggerBlueprint } from "../helpers";
|
||||
import { AntiraidLevelTrigger } from "./antiraidLevel";
|
||||
import { AnyMessageTrigger } from "./anyMessage";
|
||||
import { AttachmentSpamTrigger } from "./attachmentSpam";
|
||||
import { BanTrigger } from "./ban";
|
||||
import { CharacterSpamTrigger } from "./characterSpam";
|
||||
import { CounterTrigger } from "./counterTrigger";
|
||||
import { EmojiSpamTrigger } from "./emojiSpam";
|
||||
import { KickTrigger } from "./kick";
|
||||
import { LineSpamTrigger } from "./lineSpam";
|
||||
import { LinkSpamTrigger } from "./linkSpam";
|
||||
import { MatchAttachmentTypeTrigger } from "./matchAttachmentType";
|
||||
import { MatchInvitesTrigger } from "./matchInvites";
|
||||
import { MatchLinksTrigger } from "./matchLinks";
|
||||
import { MatchMimeTypeTrigger } from "./matchMimeType";
|
||||
import { MatchRegexTrigger } from "./matchRegex";
|
||||
import { MatchWordsTrigger } from "./matchWords";
|
||||
import { MemberJoinTrigger } from "./memberJoin";
|
||||
import { MemberJoinSpamTrigger } from "./memberJoinSpam";
|
||||
import { MemberLeaveTrigger } from "./memberLeave";
|
||||
import { MentionSpamTrigger } from "./mentionSpam";
|
||||
import { MessageSpamTrigger } from "./messageSpam";
|
||||
import { MuteTrigger } from "./mute";
|
||||
import { NoteTrigger } from "./note";
|
||||
import { RoleAddedTrigger } from "./roleAdded";
|
||||
import { RoleRemovedTrigger } from "./roleRemoved";
|
||||
import { StickerSpamTrigger } from "./stickerSpam";
|
||||
import { ThreadArchiveTrigger } from "./threadArchive";
|
||||
import { ThreadCreateTrigger } from "./threadCreate";
|
||||
import { ThreadCreateSpamTrigger } from "./threadCreateSpam";
|
||||
import { ThreadDeleteTrigger } from "./threadDelete";
|
||||
import { ThreadUnarchiveTrigger } from "./threadUnarchive";
|
||||
import { UnbanTrigger } from "./unban";
|
||||
import { UnmuteTrigger } from "./unmute";
|
||||
import { WarnTrigger } from "./warn";
|
||||
import { AutomodTriggerBlueprint } from "../helpers.js";
|
||||
import { AntiraidLevelTrigger } from "./antiraidLevel.js";
|
||||
import { AnyMessageTrigger } from "./anyMessage.js";
|
||||
import { AttachmentSpamTrigger } from "./attachmentSpam.js";
|
||||
import { BanTrigger } from "./ban.js";
|
||||
import { CharacterSpamTrigger } from "./characterSpam.js";
|
||||
import { CounterTrigger } from "./counterTrigger.js";
|
||||
import { EmojiSpamTrigger } from "./emojiSpam.js";
|
||||
import { KickTrigger } from "./kick.js";
|
||||
import { LineSpamTrigger } from "./lineSpam.js";
|
||||
import { LinkSpamTrigger } from "./linkSpam.js";
|
||||
import { MatchAttachmentTypeTrigger } from "./matchAttachmentType.js";
|
||||
import { MatchInvitesTrigger } from "./matchInvites.js";
|
||||
import { MatchLinksTrigger } from "./matchLinks.js";
|
||||
import { MatchMimeTypeTrigger } from "./matchMimeType.js";
|
||||
import { MatchRegexTrigger } from "./matchRegex.js";
|
||||
import { MatchWordsTrigger } from "./matchWords.js";
|
||||
import { MemberJoinTrigger } from "./memberJoin.js";
|
||||
import { MemberJoinSpamTrigger } from "./memberJoinSpam.js";
|
||||
import { MemberLeaveTrigger } from "./memberLeave.js";
|
||||
import { MentionSpamTrigger } from "./mentionSpam.js";
|
||||
import { MessageSpamTrigger } from "./messageSpam.js";
|
||||
import { MuteTrigger } from "./mute.js";
|
||||
import { NoteTrigger } from "./note.js";
|
||||
import { RoleAddedTrigger } from "./roleAdded.js";
|
||||
import { RoleRemovedTrigger } from "./roleRemoved.js";
|
||||
import { StickerSpamTrigger } from "./stickerSpam.js";
|
||||
import { ThreadArchiveTrigger } from "./threadArchive.js";
|
||||
import { ThreadCreateTrigger } from "./threadCreate.js";
|
||||
import { ThreadCreateSpamTrigger } from "./threadCreateSpam.js";
|
||||
import { ThreadDeleteTrigger } from "./threadDelete.js";
|
||||
import { ThreadUnarchiveTrigger } from "./threadUnarchive.js";
|
||||
import { UnbanTrigger } from "./unban.js";
|
||||
import { UnmuteTrigger } from "./unmute.js";
|
||||
import { WarnTrigger } from "./warn.js";
|
||||
|
||||
export const availableTriggers: Record<string, AutomodTriggerBlueprint<any, any>> = {
|
||||
any_message: AnyMessageTrigger,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import z from "zod";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface BanTriggerResultType {}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { RecentActionType } from "../constants";
|
||||
import { createMessageSpamTrigger } from "../functions/createMessageSpamTrigger";
|
||||
import { RecentActionType } from "../constants.js";
|
||||
import { createMessageSpamTrigger } from "../functions/createMessageSpamTrigger.js";
|
||||
|
||||
export const CharacterSpamTrigger = createMessageSpamTrigger(RecentActionType.Character, "character");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import z from "zod";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
// tslint:disable-next-line
|
||||
interface CounterTriggerResult {}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { RecentActionType } from "../constants";
|
||||
import { createMessageSpamTrigger } from "../functions/createMessageSpamTrigger";
|
||||
import { RecentActionType } from "../constants.js";
|
||||
import { createMessageSpamTrigger } from "../functions/createMessageSpamTrigger.js";
|
||||
|
||||
export const EmojiSpamTrigger = createMessageSpamTrigger(RecentActionType.Emoji, "emoji");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import z from "zod";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
interface ExampleMatchResultType {
|
||||
isBanana: boolean;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import z from "zod";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface KickTriggerResultType {}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { RecentActionType } from "../constants";
|
||||
import { createMessageSpamTrigger } from "../functions/createMessageSpamTrigger";
|
||||
import { RecentActionType } from "../constants.js";
|
||||
import { createMessageSpamTrigger } from "../functions/createMessageSpamTrigger.js";
|
||||
|
||||
export const LineSpamTrigger = createMessageSpamTrigger(RecentActionType.Line, "line");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { RecentActionType } from "../constants";
|
||||
import { createMessageSpamTrigger } from "../functions/createMessageSpamTrigger";
|
||||
import { RecentActionType } from "../constants.js";
|
||||
import { createMessageSpamTrigger } from "../functions/createMessageSpamTrigger.js";
|
||||
|
||||
export const LinkSpamTrigger = createMessageSpamTrigger(RecentActionType.Link, "link");
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { escapeInlineCode, Snowflake } from "discord.js";
|
||||
import { extname } from "path";
|
||||
import z from "zod";
|
||||
import { asSingleLine, messageSummary, verboseChannelMention } from "../../../utils";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { asSingleLine, messageSummary, verboseChannelMention } from "../../../utils.js";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
interface MatchResultType {
|
||||
matchedType: string;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import z from "zod";
|
||||
import { getInviteCodesInString, GuildInvite, isGuildInvite, resolveInvite, zSnowflake } from "../../../utils";
|
||||
import { getTextMatchPartialSummary } from "../functions/getTextMatchPartialSummary";
|
||||
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { getInviteCodesInString, GuildInvite, isGuildInvite, resolveInvite, zSnowflake } from "../../../utils.js";
|
||||
import { getTextMatchPartialSummary } from "../functions/getTextMatchPartialSummary.js";
|
||||
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage.js";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
interface MatchResultType {
|
||||
type: MatchableTextType;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { escapeInlineCode } from "discord.js";
|
||||
import z from "zod";
|
||||
import { allowTimeout } from "../../../RegExpRunner";
|
||||
import { phishermanDomainIsSafe } from "../../../data/Phisherman";
|
||||
import { getUrlsInString, zRegex } from "../../../utils";
|
||||
import { mergeRegexes } from "../../../utils/mergeRegexes";
|
||||
import { mergeWordsIntoRegex } from "../../../utils/mergeWordsIntoRegex";
|
||||
import { PhishermanPlugin } from "../../Phisherman/PhishermanPlugin";
|
||||
import { getTextMatchPartialSummary } from "../functions/getTextMatchPartialSummary";
|
||||
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { allowTimeout } from "../../../RegExpRunner.js";
|
||||
import { phishermanDomainIsSafe } from "../../../data/Phisherman.js";
|
||||
import { getUrlsInString, zRegex } from "../../../utils.js";
|
||||
import { mergeRegexes } from "../../../utils/mergeRegexes.js";
|
||||
import { mergeWordsIntoRegex } from "../../../utils/mergeWordsIntoRegex.js";
|
||||
import { PhishermanPlugin } from "../../Phisherman/PhishermanPlugin.js";
|
||||
import { getTextMatchPartialSummary } from "../functions/getTextMatchPartialSummary.js";
|
||||
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage.js";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
interface MatchResultType {
|
||||
type: MatchableTextType;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { escapeInlineCode } from "discord.js";
|
||||
import z from "zod";
|
||||
import { asSingleLine, messageSummary, verboseChannelMention } from "../../../utils";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { asSingleLine, messageSummary, verboseChannelMention } from "../../../utils.js";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
interface MatchResultType {
|
||||
matchedType: string;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import z from "zod";
|
||||
import { allowTimeout } from "../../../RegExpRunner";
|
||||
import { zRegex } from "../../../utils";
|
||||
import { mergeRegexes } from "../../../utils/mergeRegexes";
|
||||
import { normalizeText } from "../../../utils/normalizeText";
|
||||
import { stripMarkdown } from "../../../utils/stripMarkdown";
|
||||
import { getTextMatchPartialSummary } from "../functions/getTextMatchPartialSummary";
|
||||
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { allowTimeout } from "../../../RegExpRunner.js";
|
||||
import { zRegex } from "../../../utils.js";
|
||||
import { mergeRegexes } from "../../../utils/mergeRegexes.js";
|
||||
import { normalizeText } from "../../../utils/normalizeText.js";
|
||||
import { stripMarkdown } from "../../../utils/stripMarkdown.js";
|
||||
import { getTextMatchPartialSummary } from "../functions/getTextMatchPartialSummary.js";
|
||||
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage.js";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
interface MatchResultType {
|
||||
pattern: string;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import escapeStringRegexp from "escape-string-regexp";
|
||||
import z from "zod";
|
||||
import { normalizeText } from "../../../utils/normalizeText";
|
||||
import { stripMarkdown } from "../../../utils/stripMarkdown";
|
||||
import { getTextMatchPartialSummary } from "../functions/getTextMatchPartialSummary";
|
||||
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { normalizeText } from "../../../utils/normalizeText.js";
|
||||
import { stripMarkdown } from "../../../utils/stripMarkdown.js";
|
||||
import { getTextMatchPartialSummary } from "../functions/getTextMatchPartialSummary.js";
|
||||
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage.js";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
interface MatchResultType {
|
||||
word: string;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import z from "zod";
|
||||
import { convertDelayStringToMS, zDelayString } from "../../../utils";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { convertDelayStringToMS, zDelayString } from "../../../utils.js";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
const configSchema = z.strictObject({
|
||||
only_new: z.boolean().default(false),
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import z from "zod";
|
||||
import { convertDelayStringToMS, zDelayString } from "../../../utils";
|
||||
import { RecentActionType } from "../constants";
|
||||
import { findRecentSpam } from "../functions/findRecentSpam";
|
||||
import { getMatchingRecentActions } from "../functions/getMatchingRecentActions";
|
||||
import { sumRecentActionCounts } from "../functions/sumRecentActionCounts";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { convertDelayStringToMS, zDelayString } from "../../../utils.js";
|
||||
import { RecentActionType } from "../constants.js";
|
||||
import { findRecentSpam } from "../functions/findRecentSpam.js";
|
||||
import { getMatchingRecentActions } from "../functions/getMatchingRecentActions.js";
|
||||
import { sumRecentActionCounts } from "../functions/sumRecentActionCounts.js";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
const configSchema = z.strictObject({
|
||||
amount: z.number().int(),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import z from "zod";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
const configSchema = z.strictObject({});
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { RecentActionType } from "../constants";
|
||||
import { createMessageSpamTrigger } from "../functions/createMessageSpamTrigger";
|
||||
import { RecentActionType } from "../constants.js";
|
||||
import { createMessageSpamTrigger } from "../functions/createMessageSpamTrigger.js";
|
||||
|
||||
export const MentionSpamTrigger = createMessageSpamTrigger(RecentActionType.Mention, "mention");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { RecentActionType } from "../constants";
|
||||
import { createMessageSpamTrigger } from "../functions/createMessageSpamTrigger";
|
||||
import { RecentActionType } from "../constants.js";
|
||||
import { createMessageSpamTrigger } from "../functions/createMessageSpamTrigger.js";
|
||||
|
||||
export const MessageSpamTrigger = createMessageSpamTrigger(RecentActionType.Message, "message");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import z from "zod";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface MuteTriggerResultType {}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import z from "zod";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface NoteTriggerResultType {}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Snowflake } from "discord.js";
|
||||
import z from "zod";
|
||||
import { renderUsername, zSnowflake } from "../../../utils";
|
||||
import { consumeIgnoredRoleChange } from "../functions/ignoredRoleChanges";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { renderUsername, zSnowflake } from "../../../utils.js";
|
||||
import { consumeIgnoredRoleChange } from "../functions/ignoredRoleChanges.js";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
interface RoleAddedMatchResult {
|
||||
matchedRoleId: string;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Snowflake } from "discord.js";
|
||||
import z from "zod";
|
||||
import { renderUsername, zSnowflake } from "../../../utils";
|
||||
import { consumeIgnoredRoleChange } from "../functions/ignoredRoleChanges";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { renderUsername, zSnowflake } from "../../../utils.js";
|
||||
import { consumeIgnoredRoleChange } from "../functions/ignoredRoleChanges.js";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
interface RoleAddedMatchResult {
|
||||
matchedRoleId: string;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { RecentActionType } from "../constants";
|
||||
import { createMessageSpamTrigger } from "../functions/createMessageSpamTrigger";
|
||||
import { RecentActionType } from "../constants.js";
|
||||
import { createMessageSpamTrigger } from "../functions/createMessageSpamTrigger.js";
|
||||
|
||||
export const StickerSpamTrigger = createMessageSpamTrigger(RecentActionType.Sticker, "sticker");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { User, escapeBold, type Snowflake } from "discord.js";
|
||||
import z from "zod";
|
||||
import { renderUsername } from "../../../utils";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { renderUsername } from "../../../utils.js";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
interface ThreadArchiveResult {
|
||||
matchedThreadId: Snowflake;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { User, escapeBold, type Snowflake } from "discord.js";
|
||||
import z from "zod";
|
||||
import { renderUsername } from "../../../utils.js";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
interface ThreadCreateResult {
|
||||
matchedThreadId: Snowflake;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import z from "zod";
|
||||
import { convertDelayStringToMS, zDelayString } from "../../../utils";
|
||||
import { RecentActionType } from "../constants";
|
||||
import { findRecentSpam } from "../functions/findRecentSpam";
|
||||
import { getMatchingRecentActions } from "../functions/getMatchingRecentActions";
|
||||
import { sumRecentActionCounts } from "../functions/sumRecentActionCounts";
|
||||
import { automodTrigger } from "../helpers";
|
||||
import { convertDelayStringToMS, zDelayString } from "../../../utils.js";
|
||||
import { RecentActionType } from "../constants.js";
|
||||
import { findRecentSpam } from "../functions/findRecentSpam.js";
|
||||
import { getMatchingRecentActions } from "../functions/getMatchingRecentActions.js";
|
||||
import { sumRecentActionCounts } from "../functions/sumRecentActionCounts.js";
|
||||
import { automodTrigger } from "../helpers.js";
|
||||
|
||||
const configSchema = z.strictObject({
|
||||
amount: z.number().int(),
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue