3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-12 04:55:01 +00:00

Organise all imports, make Mutes depend on Logs

This commit is contained in:
Dark 2021-06-06 23:51:32 +02:00
parent a94e7593ec
commit 6ac9d2f2a2
No known key found for this signature in database
GPG key ID: 2CD6ACB6B0A87B8A
437 changed files with 1912 additions and 2027 deletions

View file

@ -1,38 +1,35 @@
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
import { AutomodPluginType, ConfigSchema } from "./types";
import { RunAutomodOnJoinEvt } from "./events/RunAutomodOnJoinEvt";
import { GuildLogs } from "../../data/GuildLogs";
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
import { runAutomodOnMessage } from "./events/runAutomodOnMessage";
import { Queue } from "../../Queue";
import { configUtils, CooldownManager } from "knub";
import { availableTriggers } from "./triggers/availableTriggers";
import { StrictValidationError } from "../../validatorUtils";
import { ConfigPreprocessorFn } from "knub/dist/config/configTypes";
import { availableActions } from "./actions/availableActions";
import { clearOldRecentActions } from "./functions/clearOldRecentActions";
import { disableCodeBlocks, MINUTES, SECONDS } from "../../utils";
import { clearOldRecentSpam } from "./functions/clearOldRecentSpam";
import { GuildAntiraidLevels } from "../../data/GuildAntiraidLevels";
import { GuildArchives } from "../../data/GuildArchives";
import { clearOldRecentNicknameChanges } from "./functions/clearOldNicknameChanges";
import { GuildLogs } from "../../data/GuildLogs";
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
import { Queue } from "../../Queue";
import { discardRegExpRunner, getRegExpRunner } from "../../regExpRunners";
import { MINUTES, SECONDS } from "../../utils";
import { registerEventListenersFromMap } from "../../utils/registerEventListenersFromMap";
import { unregisterEventListenersFromMap } from "../../utils/unregisterEventListenersFromMap";
import { StrictValidationError } from "../../validatorUtils";
import { CountersPlugin } from "../Counters/CountersPlugin";
import { LogsPlugin } from "../Logs/LogsPlugin";
import { ModActionsPlugin } from "../ModActions/ModActionsPlugin";
import { MutesPlugin } from "../Mutes/MutesPlugin";
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
import { availableActions } from "./actions/availableActions";
import { AntiraidClearCmd } from "./commands/AntiraidClearCmd";
import { SetAntiraidCmd } from "./commands/SetAntiraidCmd";
import { ViewAntiraidCmd } from "./commands/ViewAntiraidCmd";
import { pluginInfo } from "./info";
import { RegExpRunner } from "../../RegExpRunner";
import { LogType } from "../../data/LogType";
import { logger } from "../../logger";
import { discardRegExpRunner, getRegExpRunner } from "../../regExpRunners";
import { RunAutomodOnMemberUpdate } from "./events/RunAutomodOnMemberUpdate";
import { CountersPlugin } from "../Counters/CountersPlugin";
import { runAutomodOnCounterTrigger } from "./events/runAutomodOnCounterTrigger";
import { RunAutomodOnJoinEvt } from "./events/RunAutomodOnJoinEvt";
import { RunAutomodOnMemberUpdate } from "./events/RunAutomodOnMemberUpdate";
import { runAutomodOnMessage } from "./events/runAutomodOnMessage";
import { runAutomodOnModAction } from "./events/runAutomodOnModAction";
import { registerEventListenersFromMap } from "../../utils/registerEventListenersFromMap";
import { unregisterEventListenersFromMap } from "../../utils/unregisterEventListenersFromMap";
import { clearOldRecentNicknameChanges } from "./functions/clearOldNicknameChanges";
import { clearOldRecentActions } from "./functions/clearOldRecentActions";
import { clearOldRecentSpam } from "./functions/clearOldRecentSpam";
import { pluginInfo } from "./info";
import { availableTriggers } from "./triggers/availableTriggers";
import { AutomodPluginType, ConfigSchema } from "./types";
const defaultOptions = {
config: {

View file

@ -1,7 +1,7 @@
import * as t from "io-ts";
import { automodAction } from "../helpers";
import { CountersPlugin } from "../../Counters/CountersPlugin";
import { LogType } from "../../../data/LogType";
import { CountersPlugin } from "../../Counters/CountersPlugin";
import { automodAction } from "../helpers";
export const AddToCounterAction = automodAction({
configType: t.type({

View file

@ -1,18 +1,18 @@
import * as t from "io-ts";
import { automodAction } from "../helpers";
import { LogType } from "../../../data/LogType";
import {
createChunkedMessage,
messageLink,
stripObjectToScalars,
tAllowedMentions,
tNormalizedNullOptional,
verboseChannelMention,
} from "../../../utils";
import { renderTemplate, TemplateParseError } from "../../../templateFormatter";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { TextChannel } from "discord.js";
import * as t from "io-ts";
import { erisAllowedMentionsToDjsMentionOptions } from "src/utils/erisAllowedMentionsToDjsMentionOptions";
import { LogType } from "../../../data/LogType";
import { renderTemplate, TemplateParseError } from "../../../templateFormatter";
import {
createChunkedMessage,
messageLink,
stripObjectToScalars,
tAllowedMentions,
tNormalizedNullOptional,
verboseChannelMention
} from "../../../utils";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { automodAction } from "../helpers";
export const AlertAction = automodAction({
configType: t.type({

View file

@ -1,20 +1,20 @@
import * as t from "io-ts";
import { CleanAction } from "./clean";
import { AutomodActionBlueprint } from "../helpers";
import { WarnAction } from "./warn";
import { MuteAction } from "./mute";
import { KickAction } from "./kick";
import { BanAction } from "./ban";
import { AlertAction } from "./alert";
import { ChangeNicknameAction } from "./changeNickname";
import { LogAction } from "./log";
import { AddRolesAction } from "./addRoles";
import { RemoveRolesAction } from "./removeRoles";
import { SetAntiraidLevelAction } from "./setAntiraidLevel";
import { ReplyAction } from "./reply";
import { AddToCounterAction } from "./addToCounter";
import { AlertAction } from "./alert";
import { BanAction } from "./ban";
import { ChangeNicknameAction } from "./changeNickname";
import { CleanAction } from "./clean";
import { KickAction } from "./kick";
import { LogAction } from "./log";
import { MuteAction } from "./mute";
import { RemoveRolesAction } from "./removeRoles";
import { ReplyAction } from "./reply";
import { SetAntiraidLevelAction } from "./setAntiraidLevel";
import { SetCounterAction } from "./setCounter";
import { SetSlowmodeAction } from "./setSlowmode";
import { WarnAction } from "./warn";
export const availableActions: Record<string, AutomodActionBlueprint<any>> = {
clean: CleanAction,

View file

@ -1,18 +1,16 @@
import * as t from "io-ts";
import { automodAction } from "../helpers";
import { LogType } from "../../../data/LogType";
import {
asyncMap,
convertDelayStringToMS,
nonNullish,
resolveMember,
tDelayString,
tNullable,
unique,
convertDelayStringToMS,
nonNullish,
tDelayString,
tNullable,
unique
} from "../../../utils";
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { CaseArgs } from "../../Cases/types";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
import { automodAction } from "../helpers";
export const BanAction = automodAction({
configType: t.type({

View file

@ -1,8 +1,8 @@
import * as t from "io-ts";
import { automodAction } from "../helpers";
import { LogType } from "../../../data/LogType";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { nonNullish, unique } from "../../../utils";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { automodAction } from "../helpers";
export const ChangeNicknameAction = automodAction({
configType: t.union([

View file

@ -1,8 +1,8 @@
import { TextChannel } from "discord.js";
import * as t from "io-ts";
import { automodAction } from "../helpers";
import { LogType } from "../../../data/LogType";
import { noop } from "../../../utils";
import { TextChannel } from "discord.js";
import { automodAction } from "../helpers";
export const CleanAction = automodAction({
configType: t.boolean,

View file

@ -1,10 +1,9 @@
import * as t from "io-ts";
import { automodAction } from "../helpers";
import { LogType } from "../../../data/LogType";
import { asyncMap, nonNullish, resolveMember, tNullable, unique } from "../../../utils";
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { CaseArgs } from "../../Cases/types";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
import { automodAction } from "../helpers";
export const KickAction = automodAction({
configType: t.type({

View file

@ -1,8 +1,8 @@
import * as t from "io-ts";
import { automodAction } from "../helpers";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { LogType } from "../../../data/LogType";
import { stripObjectToScalars, unique } from "../../../utils";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { automodAction } from "../helpers";
export const LogAction = automodAction({
configType: t.boolean,

View file

@ -1,21 +1,19 @@
import * as t from "io-ts";
import { automodAction } from "../helpers";
import { LogType } from "../../../data/LogType";
import {
asyncMap,
convertDelayStringToMS,
nonNullish,
resolveMember,
tDelayString,
tNullable,
unique,
} from "../../../utils";
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { MutesPlugin } from "../../Mutes/MutesPlugin";
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import {
convertDelayStringToMS,
nonNullish,
tDelayString,
tNullable,
unique
} from "../../../utils";
import { CaseArgs } from "../../Cases/types";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { MutesPlugin } from "../../Mutes/MutesPlugin";
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
import { automodAction } from "../helpers";
export const MuteAction = automodAction({
configType: t.type({

View file

@ -1,17 +1,15 @@
import * as t from "io-ts";
import { automodAction } from "../helpers";
import { LogType } from "../../../data/LogType";
import { asyncMap, nonNullish, resolveMember, tNullable, unique } from "../../../utils";
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { getMissingPermissions } from "../../../utils/getMissingPermissions";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { missingPermissionError } from "../../../utils/missingPermissionError";
import { canAssignRole } from "../../../utils/canAssignRole";
import { ignoreRoleChange } from "../functions/ignoredRoleChanges";
import { memberRolesLock } from "../../../utils/lockNameHelpers";
import { Permissions } from "discord.js";
import * as t from "io-ts";
import { LogType } from "../../../data/LogType";
import { nonNullish, unique } 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";
const p = Permissions.FLAGS;

View file

@ -1,23 +1,23 @@
import { MessageOptions, Permissions, TextChannel, User } from "discord.js";
import * as t from "io-ts";
import { automodAction } from "../helpers";
import {
convertDelayStringToMS,
noop,
renderRecursively,
StrictMessageContent,
stripObjectToScalars,
tDelayString,
tMessageContent,
tNullable,
unique,
verboseChannelMention,
} from "../../../utils";
import { AutomodContext } from "../types";
import { renderTemplate } from "../../../templateFormatter";
import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
import { LogType } from "../../../data/LogType";
import { TextChannel, User, Constants, MessageOptions, Permissions } from "discord.js";
import { renderTemplate } from "../../../templateFormatter";
import {
convertDelayStringToMS,
noop,
renderRecursively,
stripObjectToScalars,
tDelayString,
tMessageContent,
tNullable,
unique,
verboseChannelMention
} from "../../../utils";
import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
import { automodAction } from "../helpers";
import { AutomodContext } from "../types";
export const ReplyAction = automodAction({
configType: t.union([

View file

@ -1,7 +1,7 @@
import * as t from "io-ts";
import { automodAction } from "../helpers";
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
import { tNullable } from "../../../utils";
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
import { automodAction } from "../helpers";
export const SetAntiraidLevelAction = automodAction({
configType: tNullable(t.string),

View file

@ -1,7 +1,7 @@
import * as t from "io-ts";
import { automodAction } from "../helpers";
import { CountersPlugin } from "../../Counters/CountersPlugin";
import { LogType } from "../../../data/LogType";
import { CountersPlugin } from "../../Counters/CountersPlugin";
import { automodAction } from "../helpers";
export const SetCounterAction = automodAction({
configType: t.type({

View file

@ -1,9 +1,9 @@
import { TextChannel } from "discord.js";
import * as t from "io-ts";
import { automodAction } from "../helpers";
import { convertDelayStringToMS, isDiscordRESTError, tDelayString, tNullable } from "../../../utils";
import { LogType } from "../../../data/LogType";
import { Constants, TextChannel } from "discord.js";
import { ChannelTypeStrings } from "src/types";
import { LogType } from "../../../data/LogType";
import { convertDelayStringToMS, isDiscordRESTError, tDelayString, tNullable } from "../../../utils";
import { automodAction } from "../helpers";
export const SetSlowmodeAction = automodAction({
configType: t.type({

View file

@ -1,10 +1,9 @@
import * as t from "io-ts";
import { automodAction } from "../helpers";
import { LogType } from "../../../data/LogType";
import { asyncMap, nonNullish, resolveMember, tNullable, unique } from "../../../utils";
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { CaseArgs } from "../../Cases/types";
import { ModActionsPlugin } from "../../ModActions/ModActionsPlugin";
import { resolveActionContactMethods } from "../functions/resolveActionContactMethods";
import { automodAction } from "../helpers";
export const WarnAction = automodAction({
configType: t.type({

View file

@ -1,7 +1,7 @@
import { typedGuildCommand, GuildPluginData } from "knub";
import { AutomodPluginType } from "../types";
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
import { typedGuildCommand } from "knub";
import { sendSuccessMessage } from "../../../pluginUtils";
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
import { AutomodPluginType } from "../types";
export const AntiraidClearCmd = typedGuildCommand<AutomodPluginType>()({
trigger: ["antiraid clear", "antiraid reset", "antiraid none", "antiraid off"],

View file

@ -1,8 +1,8 @@
import { typedGuildCommand, GuildPluginData } from "knub";
import { AutomodPluginType } from "../types";
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { typedGuildCommand } from "knub";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
import { AutomodPluginType } from "../types";
export const SetAntiraidCmd = typedGuildCommand<AutomodPluginType>()({
trigger: "antiraid",

View file

@ -1,8 +1,5 @@
import { typedGuildCommand, GuildPluginData } from "knub";
import { typedGuildCommand } from "knub";
import { AutomodPluginType } from "../types";
import { setAntiraidLevel } from "../functions/setAntiraidLevel";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { commandTypeHelpers as ct } from "../../../commandTypes";
export const ViewAntiraidCmd = typedGuildCommand<AutomodPluginType>()({
trigger: "antiraid",

View file

@ -1,7 +1,7 @@
import { typedGuildEventListener } from "knub";
import { AutomodContext, AutomodPluginType } from "../types";
import { runAutomod } from "../functions/runAutomod";
import { RecentActionType } from "../constants";
import { runAutomod } from "../functions/runAutomod";
import { AutomodContext, AutomodPluginType } from "../types";
export const RunAutomodOnJoinEvt = typedGuildEventListener<AutomodPluginType>()({
event: "guildMemberAdd",

View file

@ -1,9 +1,8 @@
import { typedGuildEventListener } from "knub";
import { AutomodContext, AutomodPluginType } from "../types";
import { RecentActionType } from "../constants";
import { runAutomod } from "../functions/runAutomod";
import isEqual from "lodash.isequal";
import diff from "lodash.difference";
import isEqual from "lodash.isequal";
import { runAutomod } from "../functions/runAutomod";
import { AutomodContext, AutomodPluginType } from "../types";
export const RunAutomodOnMemberUpdate = typedGuildEventListener<AutomodPluginType>()({
event: "guildMemberUpdate",

View file

@ -1,7 +1,7 @@
import { GuildPluginData } from "knub";
import { AutomodContext, AutomodPluginType } from "../types";
import { runAutomod } from "../functions/runAutomod";
import { User } from "discord.js";
import { GuildPluginData } from "knub";
import { runAutomod } from "../functions/runAutomod";
import { AutomodContext, AutomodPluginType } from "../types";
export async function runAutomodOnAntiraidLevel(
pluginData: GuildPluginData<AutomodPluginType>,

View file

@ -1,8 +1,8 @@
import { GuildPluginData } from "knub";
import { AutomodContext, AutomodPluginType } from "../types";
import { runAutomod } from "../functions/runAutomod";
import { resolveMember, resolveUser, UnknownUser } from "../../../utils";
import { CountersPlugin } from "../../Counters/CountersPlugin";
import { runAutomod } from "../functions/runAutomod";
import { AutomodContext, AutomodPluginType } from "../types";
export async function runAutomodOnCounterTrigger(
pluginData: GuildPluginData<AutomodPluginType>,

View file

@ -1,10 +1,10 @@
import { SavedMessage } from "../../../data/entities/SavedMessage";
import { GuildPluginData } from "knub";
import { AutomodContext, AutomodPluginType } from "../types";
import { runAutomod } from "../functions/runAutomod";
import { addRecentActionsFromMessage } from "../functions/addRecentActionsFromMessage";
import moment from "moment-timezone";
import { SavedMessage } from "../../../data/entities/SavedMessage";
import { addRecentActionsFromMessage } from "../functions/addRecentActionsFromMessage";
import { clearRecentActionsForMessage } from "../functions/clearRecentActionsForMessage";
import { runAutomod } from "../functions/runAutomod";
import { AutomodContext, AutomodPluginType } from "../types";
export function runAutomodOnMessage(
pluginData: GuildPluginData<AutomodPluginType>,

View file

@ -1,8 +1,8 @@
import { GuildPluginData } from "knub";
import { AutomodContext, AutomodPluginType } from "../types";
import { runAutomod } from "../functions/runAutomod";
import { resolveMember, resolveUser, UnknownUser } from "../../../utils";
import { ModActionType } from "../../ModActions/types";
import { runAutomod } from "../functions/runAutomod";
import { AutomodContext, AutomodPluginType } from "../types";
export async function runAutomodOnModAction(
pluginData: GuildPluginData<AutomodPluginType>,

View file

@ -1,7 +1,7 @@
import { AutomodContext, AutomodPluginType } from "../types";
import { GuildPluginData } from "knub";
import { RECENT_ACTION_EXPIRY_TIME, RecentActionType } from "../constants";
import { getEmojiInString, getRoleMentions, getUrlsInString, getUserMentions } from "../../../utils";
import { RecentActionType, RECENT_ACTION_EXPIRY_TIME } from "../constants";
import { AutomodContext, AutomodPluginType } from "../types";
export function addRecentActionsFromMessage(pluginData: GuildPluginData<AutomodPluginType>, context: AutomodContext) {
const message = context.message!;

View file

@ -1,7 +1,6 @@
import { AutomodContext, AutomodPluginType, TRule } from "../types";
import { GuildPluginData } from "knub";
import { AutomodTriggerMatchResult } from "../helpers";
import { convertDelayStringToMS } from "../../../utils";
import { AutomodContext, AutomodPluginType, TRule } from "../types";
export function checkAndUpdateCooldown(
pluginData: GuildPluginData<AutomodPluginType>,

View file

@ -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, RECENT_SPAM_EXPIRY_TIME } from "../constants";
export function clearOldRecentNicknameChanges(pluginData: GuildPluginData<AutomodPluginType>) {
const now = Date.now();

View file

@ -1,6 +1,6 @@
import { GuildPluginData } from "knub";
import { AutomodPluginType } from "../types";
import { RECENT_ACTION_EXPIRY_TIME } from "../constants";
import { AutomodPluginType } from "../types";
export function clearOldRecentActions(pluginData: GuildPluginData<AutomodPluginType>) {
const now = Date.now();

View file

@ -1,6 +1,6 @@
import { GuildPluginData } from "knub";
import { AutomodPluginType } from "../types";
import { RECENT_SPAM_EXPIRY_TIME } from "../constants";
import { AutomodPluginType } from "../types";
export function clearOldRecentSpam(pluginData: GuildPluginData<AutomodPluginType>) {
const now = Date.now();

View file

@ -1,7 +1,5 @@
import { AutomodContext, AutomodPluginType } from "../types";
import { GuildPluginData } from "knub";
import { RECENT_ACTION_EXPIRY_TIME, RecentActionType } from "../constants";
import { getEmojiInString, getRoleMentions, getUrlsInString, getUserMentions } from "../../../utils";
import { AutomodContext, AutomodPluginType } from "../types";
export function clearRecentActionsForMessage(pluginData: GuildPluginData<AutomodPluginType>, context: AutomodContext) {
const message = context.message!;

View file

@ -1,13 +1,13 @@
import { RecentActionType } from "../constants";
import { automodTrigger } from "../helpers";
import * as t from "io-ts";
import { SavedMessage } from "../../../data/entities/SavedMessage";
import { humanizeDurationShort } from "../../../humanizeDurationShort";
import { getBaseUrl } from "../../../pluginUtils";
import { convertDelayStringToMS, sorter, tDelayString, tNullable } from "../../../utils";
import { humanizeDurationShort } from "../../../humanizeDurationShort";
import { RecentActionType } from "../constants";
import { automodTrigger } from "../helpers";
import { findRecentSpam } from "./findRecentSpam";
import { getMatchingMessageRecentActions } from "./getMatchingMessageRecentActions";
import * as t from "io-ts";
import { getMessageSpamIdentifier } from "./getSpamIdentifier";
import { SavedMessage } from "../../../data/entities/SavedMessage";
const MessageSpamTriggerConfig = t.type({
amount: t.number,

View file

@ -1,6 +1,6 @@
import { GuildPluginData } from "knub";
import { AutomodPluginType } from "../types";
import { RecentActionType } from "../constants";
import { AutomodPluginType } from "../types";
export function findRecentSpam(
pluginData: GuildPluginData<AutomodPluginType>,

View file

@ -1,9 +1,9 @@
import { GuildPluginData } from "knub";
import { AutomodPluginType } from "../types";
import { SavedMessage } from "../../../data/entities/SavedMessage";
import moment from "moment-timezone";
import { getMatchingRecentActions } from "./getMatchingRecentActions";
import { SavedMessage } from "../../../data/entities/SavedMessage";
import { RecentActionType } from "../constants";
import { AutomodPluginType } from "../types";
import { getMatchingRecentActions } from "./getMatchingRecentActions";
export function getMatchingMessageRecentActions(
pluginData: GuildPluginData<AutomodPluginType>,

View file

@ -1,6 +1,6 @@
import { GuildPluginData } from "knub";
import { AutomodPluginType } from "../types";
import { RecentActionType } from "../constants";
import { AutomodPluginType } from "../types";
export function getMatchingRecentActions(
pluginData: GuildPluginData<AutomodPluginType>,

View file

@ -1,7 +1,7 @@
import { MatchableTextType } from "./matchMultipleTextTypesOnMessage";
import { AutomodContext, AutomodPluginType } from "../types";
import { messageSummary, verboseChannelMention } from "../../../utils";
import { GuildPluginData } from "knub";
import { messageSummary, verboseChannelMention } from "../../../utils";
import { AutomodContext, AutomodPluginType } from "../types";
import { MatchableTextType } from "./matchMultipleTextTypesOnMessage";
export function getTextMatchPartialSummary(
pluginData: GuildPluginData<AutomodPluginType>,

View file

@ -1,6 +1,6 @@
import { GuildPluginData } from "knub";
import { AutomodPluginType } from "../types";
import { MINUTES } from "../../../utils";
import { AutomodPluginType } from "../types";
const IGNORED_ROLE_CHANGE_LIFETIME = 5 * MINUTES;

View file

@ -1,8 +1,8 @@
import { Constants } from "discord.js";
import { GuildPluginData } from "knub";
import { SavedMessage } from "../../../data/entities/SavedMessage";
import { resolveMember } from "../../../utils";
import { GuildPluginData } from "knub";
import { AutomodPluginType } from "../types";
import { Activity, Constants } from "discord.js";
type TextTriggerWithMultipleMatchTypes = {
match_messages: boolean;

View file

@ -1,9 +1,9 @@
import { disableUserNotificationStrings, UserNotificationMethod } from "../../../utils";
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
import { GuildPluginData } from "knub";
import { AutomodPluginType } from "../types";
import { TextChannel } from "discord.js";
import { GuildPluginData } from "knub";
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
import { disableUserNotificationStrings, UserNotificationMethod } from "../../../utils";
import { AutomodPluginType } from "../types";
export function resolveActionContactMethods(
pluginData: GuildPluginData<AutomodPluginType>,

View file

@ -1,11 +1,11 @@
import { GuildPluginData } from "knub";
import { AutomodContext, AutomodPluginType } from "../types";
import { availableTriggers } from "../triggers/availableTriggers";
import { availableActions } from "../actions/availableActions";
import { AutomodTriggerMatchResult } from "../helpers";
import { CleanAction } from "../actions/clean";
import { checkAndUpdateCooldown } from "./checkAndUpdateCooldown";
import { TextChannel } from "discord.js";
import { GuildPluginData } from "knub";
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 { checkAndUpdateCooldown } from "./checkAndUpdateCooldown";
export async function runAutomod(pluginData: GuildPluginData<AutomodPluginType>, context: AutomodContext) {
const userId = context.user?.id || context.member?.id || context.message?.user_id;

View file

@ -1,10 +1,10 @@
import { User } from "discord.js";
import { GuildPluginData } from "knub";
import { AutomodPluginType } from "../types";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { LogType } from "../../../data/LogType";
import { stripObjectToScalars } from "../../../utils";
import { LogsPlugin } from "../../Logs/LogsPlugin";
import { runAutomodOnAntiraidLevel } from "../events/runAutomodOnAntiraidLevel";
import { User } from "discord.js";
import { AutomodPluginType } from "../types";
export async function setAntiraidLevel(
pluginData: GuildPluginData<AutomodPluginType>,

View file

@ -1,6 +1,6 @@
import * as t from "io-ts";
import { GuildPluginData } from "knub";
import { Awaitable } from "knub/dist/utils";
import * as t from "io-ts";
import { AutomodContext, AutomodPluginType } from "./types";
interface BaseAutomodTriggerMatchResult {

View file

@ -1,5 +1,5 @@
import { ZeppelinGuildPluginBlueprint } from "../ZeppelinPluginBlueprint";
import { trimPluginDescription } from "../../utils";
import { ZeppelinGuildPluginBlueprint } from "../ZeppelinPluginBlueprint";
export const pluginInfo: ZeppelinGuildPluginBlueprint["info"] = {
prettyName: "Automod",

View file

@ -1,6 +1,6 @@
import * as t from "io-ts";
import { automodTrigger } from "../helpers";
import { tNullable } from "../../../utils";
import { automodTrigger } from "../helpers";
// tslint:disable-next-line
interface AntiraidLevelTriggerResult {}

View file

@ -1,6 +1,6 @@
import * as t from "io-ts";
import { automodTrigger } from "../helpers";
import { verboseChannelMention } from "../../../utils";
import { automodTrigger } from "../helpers";
// tslint:disable-next-line:no-empty-interface
interface AnyMessageResultType {}

View file

@ -1,32 +1,32 @@
import * as t from "io-ts";
import { MatchWordsTrigger } from "./matchWords";
import { AutomodTriggerBlueprint } from "../helpers";
import { MessageSpamTrigger } from "./messageSpam";
import { MentionSpamTrigger } from "./mentionSpam";
import { LinkSpamTrigger } from "./linkSpam";
import { AntiraidLevelTrigger } from "./antiraidLevel";
import { AnyMessageTrigger } from "./anyMessage";
import { AttachmentSpamTrigger } from "./attachmentSpam";
import { EmojiSpamTrigger } from "./emojiSpam";
import { LineSpamTrigger } from "./lineSpam";
import { BanTrigger } from "./ban";
import { CharacterSpamTrigger } from "./characterSpam";
import { MatchRegexTrigger } from "./matchRegex";
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 { MatchAttachmentTypeTrigger } from "./matchAttachmentType";
import { MemberJoinSpamTrigger } from "./memberJoinSpam";
import { MatchRegexTrigger } from "./matchRegex";
import { MatchWordsTrigger } from "./matchWords";
import { MemberJoinTrigger } from "./memberJoin";
import { MemberJoinSpamTrigger } from "./memberJoinSpam";
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 { CounterTrigger } from "./counterTrigger";
import { NoteTrigger } from "./note";
import { WarnTrigger } from "./warn";
import { MuteTrigger } from "./mute";
import { UnmuteTrigger } from "./unmute";
import { KickTrigger } from "./kick";
import { BanTrigger } from "./ban";
import { UnbanTrigger } from "./unban";
import { AnyMessageTrigger } from "./anyMessage";
import { AntiraidLevelTrigger } from "./antiraidLevel";
import { UnmuteTrigger } from "./unmute";
import { WarnTrigger } from "./warn";
export const availableTriggers: Record<string, AutomodTriggerBlueprint<any, any>> = {
any_message: AnyMessageTrigger,

View file

@ -1,8 +1,6 @@
import * as t from "io-ts";
import { automodTrigger } from "../helpers";
import { consumeIgnoredRoleChange } from "../functions/ignoredRoleChanges";
import { CountersPlugin } from "../../Counters/CountersPlugin";
import { tNullable } from "../../../utils";
import { automodTrigger } from "../helpers";
// tslint:disable-next-line
interface CounterTriggerResult {}

View file

@ -1,12 +1,12 @@
import * as t from "io-ts";
import { automodTrigger } from "../helpers";
import {
asSingleLine,
disableCodeBlocks,
disableInlineCode,
messageSummary,
verboseChannelMention,
asSingleLine,
disableInlineCode,
messageSummary,
verboseChannelMention
} from "../../../utils";
import { automodTrigger } from "../helpers";
interface MatchResultType {
matchedType: string;

View file

@ -1,17 +1,14 @@
import * as t from "io-ts";
import { automodTrigger } from "../helpers";
import {
disableCodeBlocks,
disableInlineCode,
getInviteCodesInString,
GuildInvite,
isGuildInvite,
resolveInvite,
tNullable,
verboseChannelMention,
getInviteCodesInString,
GuildInvite,
isGuildInvite,
resolveInvite,
tNullable
} from "../../../utils";
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage";
import { getTextMatchPartialSummary } from "../functions/getTextMatchPartialSummary";
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage";
import { automodTrigger } from "../helpers";
interface MatchResultType {
type: MatchableTextType;

View file

@ -1,18 +1,15 @@
import * as t from "io-ts";
import escapeStringRegexp from "escape-string-regexp";
import { automodTrigger } from "../helpers";
import * as t from "io-ts";
import { allowTimeout } from "../../../RegExpRunner";
import {
asSingleLine,
disableCodeBlocks,
disableInlineCode,
getUrlsInString,
tNullable,
verboseChannelMention,
disableInlineCode,
getUrlsInString,
tNullable
} from "../../../utils";
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage";
import { TRegex } from "../../../validatorUtils";
import { getTextMatchPartialSummary } from "../functions/getTextMatchPartialSummary";
import { allowTimeout } from "../../../RegExpRunner";
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage";
import { automodTrigger } from "../helpers";
interface MatchResultType {
type: MatchableTextType;

View file

@ -1,12 +1,12 @@
import * as t from "io-ts";
import { automodTrigger } from "../helpers";
import { disableInlineCode, verboseChannelMention } from "../../../utils";
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage";
import { getTextMatchPartialSummary } from "../functions/getTextMatchPartialSummary";
import { allowTimeout } from "../../../RegExpRunner";
import { TRegex } from "../../../validatorUtils";
import { disableInlineCode } from "../../../utils";
import { normalizeText } from "../../../utils/normalizeText";
import { stripMarkdown } from "../../../utils/stripMarkdown";
import { TRegex } from "../../../validatorUtils";
import { getTextMatchPartialSummary } from "../functions/getTextMatchPartialSummary";
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage";
import { automodTrigger } from "../helpers";
interface MatchResultType {
pattern: string;

View file

@ -1,11 +1,11 @@
import * as t from "io-ts";
import escapeStringRegexp from "escape-string-regexp";
import { automodTrigger } from "../helpers";
import { disableInlineCode, verboseChannelMention } from "../../../utils";
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage";
import { getTextMatchPartialSummary } from "../functions/getTextMatchPartialSummary";
import * as t from "io-ts";
import { disableInlineCode } from "../../../utils";
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";
interface MatchResultType {
word: string;

View file

@ -1,6 +1,6 @@
import * as t from "io-ts";
import { automodTrigger } from "../helpers";
import { convertDelayStringToMS, tDelayString } from "../../../utils";
import { automodTrigger } from "../helpers";
export const MemberJoinTrigger = automodTrigger<unknown>()({
configType: t.type({

View file

@ -1,10 +1,10 @@
import * as t from "io-ts";
import { automodTrigger } from "../helpers";
import { convertDelayStringToMS, tDelayString } from "../../../utils";
import { getMatchingRecentActions } from "../functions/getMatchingRecentActions";
import { RecentActionType } from "../constants";
import { sumRecentActionCounts } from "../functions/sumRecentActionCounts";
import { findRecentSpam } from "../functions/findRecentSpam";
import { getMatchingRecentActions } from "../functions/getMatchingRecentActions";
import { sumRecentActionCounts } from "../functions/sumRecentActionCounts";
import { automodTrigger } from "../helpers";
export const MemberJoinSpamTrigger = automodTrigger<unknown>()({
configType: t.type({

View file

@ -1,6 +1,6 @@
import * as t from "io-ts";
import { automodTrigger } from "../helpers";
import { consumeIgnoredRoleChange } from "../functions/ignoredRoleChanges";
import { automodTrigger } from "../helpers";
interface RoleAddedMatchResult {
matchedRoleId: string;

View file

@ -1,6 +1,6 @@
import * as t from "io-ts";
import { automodTrigger } from "../helpers";
import { consumeIgnoredRoleChange } from "../functions/ignoredRoleChanges";
import { automodTrigger } from "../helpers";
interface RoleAddedMatchResult {
matchedRoleId: string;

View file

@ -1,22 +1,22 @@
import { GuildMember, User } from "discord.js";
import * as t from "io-ts";
import { tNullable, UnknownUser } from "../../utils";
import { BasePluginType, CooldownManager } from "knub";
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
import { GuildLogs } from "../../data/GuildLogs";
import { SavedMessage } from "../../data/entities/SavedMessage";
import { AvailableTriggers } from "./triggers/availableTriggers";
import { AvailableActions } from "./actions/availableActions";
import { Queue } from "../../Queue";
import { GuildAntiraidLevels } from "../../data/GuildAntiraidLevels";
import { GuildArchives } from "../../data/GuildArchives";
import { RecentActionType } from "./constants";
import Timeout = NodeJS.Timeout;
import { GuildLogs } from "../../data/GuildLogs";
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
import { Queue } from "../../Queue";
import { RegExpRunner } from "../../RegExpRunner";
import { tNullable } from "../../utils";
import { CounterEvents } from "../Counters/types";
import { ModActionsEvents, ModActionType } from "../ModActions/types";
import { MutesEvents } from "../Mutes/types";
import { GuildMember, User } from "discord.js";
import { AvailableActions } from "./actions/availableActions";
import { RecentActionType } from "./constants";
import { AvailableTriggers } from "./triggers/availableTriggers";
import Timeout = NodeJS.Timeout;
export const Rule = t.type({
enabled: t.boolean,