mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Organise all imports, make Mutes depend on Logs
This commit is contained in:
parent
a94e7593ec
commit
6ac9d2f2a2
437 changed files with 1912 additions and 2027 deletions
|
@ -1,13 +1,13 @@
|
|||
import { PluginOptions } from "knub";
|
||||
import { AutoDeletePluginType, ConfigSchema } from "./types";
|
||||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin";
|
||||
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin";
|
||||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { AutoDeletePluginType, ConfigSchema } from "./types";
|
||||
import { onMessageCreate } from "./util/onMessageCreate";
|
||||
import { onMessageDelete } from "./util/onMessageDelete";
|
||||
import { onMessageDeleteBulk } from "./util/onMessageDeleteBulk";
|
||||
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin";
|
||||
|
||||
const defaultOptions: PluginOptions<AutoDeletePluginType> = {
|
||||
config: {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import * as t from "io-ts";
|
||||
import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub";
|
||||
import { tDelayString, MINUTES } from "../../utils";
|
||||
import { BasePluginType } from "knub";
|
||||
import { SavedMessage } from "../../data/entities/SavedMessage";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { SavedMessage } from "../../data/entities/SavedMessage";
|
||||
import { MINUTES, tDelayString } from "../../utils";
|
||||
import Timeout = NodeJS.Timeout;
|
||||
|
||||
export const MAX_DELAY = 5 * MINUTES;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { AutoDeletePluginType } from "../types";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { scheduleNextDeletion } from "./scheduleNextDeletion";
|
||||
import { sorter } from "../../../utils";
|
||||
import { AutoDeletePluginType } from "../types";
|
||||
import { scheduleNextDeletion } from "./scheduleNextDeletion";
|
||||
|
||||
export function addMessageToDeletionQueue(
|
||||
pluginData: GuildPluginData<AutoDeletePluginType>,
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { Permissions, TextChannel } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { AutoDeletePluginType } from "../types";
|
||||
import moment from "moment-timezone";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { resolveUser, stripObjectToScalars, verboseChannelMention } from "../../../utils";
|
||||
import { logger } from "../../../logger";
|
||||
import { scheduleNextDeletion } from "./scheduleNextDeletion";
|
||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
||||
import { resolveUser, stripObjectToScalars, verboseChannelMention } from "../../../utils";
|
||||
import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { Permissions, TextChannel } from "discord.js";
|
||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
||||
import { AutoDeletePluginType } from "../types";
|
||||
import { scheduleNextDeletion } from "./scheduleNextDeletion";
|
||||
|
||||
export async function deleteNextItem(pluginData: GuildPluginData<AutoDeletePluginType>) {
|
||||
const [itemToDelete] = pluginData.state.deletionQueue.splice(0, 1);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { AutoDeletePluginType, MAX_DELAY } from "../types";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { convertDelayStringToMS, resolveMember } from "../../../utils";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { convertDelayStringToMS, resolveMember } from "../../../utils";
|
||||
import { AutoDeletePluginType, MAX_DELAY } from "../types";
|
||||
import { addMessageToDeletionQueue } from "./addMessageToDeletionQueue";
|
||||
|
||||
export async function onMessageCreate(pluginData: GuildPluginData<AutoDeletePluginType>, msg: SavedMessage) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { AutoDeletePluginType } from "../types";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { AutoDeletePluginType } from "../types";
|
||||
import { scheduleNextDeletion } from "./scheduleNextDeletion";
|
||||
|
||||
export function onMessageDelete(pluginData: GuildPluginData<AutoDeletePluginType>, msg: SavedMessage) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { AutoDeletePluginType } from "../types";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { AutoDeletePluginType } from "../types";
|
||||
import { onMessageDelete } from "./onMessageDelete";
|
||||
|
||||
export function onMessageDeleteBulk(pluginData: GuildPluginData<AutoDeletePluginType>, messages: SavedMessage[]) {
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { AutoReactionsPluginType, ConfigSchema } from "./types";
|
||||
import { PluginOptions } from "knub";
|
||||
import { NewAutoReactionsCmd } from "./commands/NewAutoReactionsCmd";
|
||||
import { DisableAutoReactionsCmd } from "./commands/DisableAutoReactionsCmd";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { GuildAutoReactions } from "../../data/GuildAutoReactions";
|
||||
import { AddReactionsEvt } from "./events/AddReactionsEvt";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { trimPluginDescription } from "../../utils";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin";
|
||||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { DisableAutoReactionsCmd } from "./commands/DisableAutoReactionsCmd";
|
||||
import { NewAutoReactionsCmd } from "./commands/NewAutoReactionsCmd";
|
||||
import { AddReactionsEvt } from "./events/AddReactionsEvt";
|
||||
import { AutoReactionsPluginType, ConfigSchema } from "./types";
|
||||
|
||||
const defaultOptions: PluginOptions<AutoReactionsPluginType> = {
|
||||
config: {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { autoReactionsCmd } from "../types";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { autoReactionsCmd } from "../types";
|
||||
|
||||
export const DisableAutoReactionsCmd = autoReactionsCmd({
|
||||
trigger: "auto_reactions disable",
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { autoReactionsCmd } from "../types";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { canUseEmoji, customEmojiRegex, isEmoji } from "../../../utils";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions";
|
||||
|
||||
import { readChannelPermissions } from "../../../utils/readChannelPermissions";
|
||||
import { missingPermissionError } from "../../../utils/missingPermissionError";
|
||||
import { GuildChannel, Permissions } 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";
|
||||
|
||||
|
||||
const requiredPermissions = readChannelPermissions | Permissions.FLAGS.ADD_REACTIONS;
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { autoReactionsEvt } from "../types";
|
||||
import { isDiscordRESTError } from "../../../utils";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
|
||||
import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions";
|
||||
import { readChannelPermissions } from "../../../utils/readChannelPermissions";
|
||||
import { missingPermissionError } from "../../../utils/missingPermissionError";
|
||||
import { GuildChannel, Permissions } from "discord.js";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { isDiscordRESTError } 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";
|
||||
|
||||
|
||||
const p = Permissions.FLAGS;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as t from "io-ts";
|
||||
import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub";
|
||||
import { GuildAutoReactions } from "../../data/GuildAutoReactions";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { GuildAutoReactions } from "../../data/GuildAutoReactions";
|
||||
|
||||
export const ConfigSchema = t.type({
|
||||
can_manage: t.boolean,
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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([
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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([
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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"],
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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!;
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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!;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { ZeppelinGuildPluginBlueprint } from "../ZeppelinPluginBlueprint";
|
||||
import { trimPluginDescription } from "../../utils";
|
||||
import { ZeppelinGuildPluginBlueprint } from "../ZeppelinPluginBlueprint";
|
||||
|
||||
export const pluginInfo: ZeppelinGuildPluginBlueprint["info"] = {
|
||||
prettyName: "Automod",
|
||||
|
|
|
@ -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 {}
|
||||
|
|
|
@ -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 {}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 {}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
import { zeppelinGlobalPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { BotControlPluginType, ConfigSchema } from "./types";
|
||||
import { GuildArchives } from "../../data/GuildArchives";
|
||||
|
||||
import { sendSuccessMessage } from "../../pluginUtils";
|
||||
import { getActiveReload, resetActiveReload } from "./activeReload";
|
||||
import { ReloadGlobalPluginsCmd } from "./commands/ReloadGlobalPluginsCmd";
|
||||
import { ServersCmd } from "./commands/ServersCmd";
|
||||
import { LeaveServerCmd } from "./commands/LeaveServerCmd";
|
||||
import { ReloadServerCmd } from "./commands/ReloadServerCmd";
|
||||
import { TextChannel } from "discord.js";
|
||||
import { AllowedGuilds } from "../../data/AllowedGuilds";
|
||||
import { ApiPermissionAssignments } from "../../data/ApiPermissionAssignments";
|
||||
import { Configs } from "../../data/Configs";
|
||||
import { GuildArchives } from "../../data/GuildArchives";
|
||||
import { sendSuccessMessage } from "../../pluginUtils";
|
||||
import { zeppelinGlobalPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { getActiveReload, resetActiveReload } from "./activeReload";
|
||||
import { AddDashboardUserCmd } from "./commands/AddDashboardUserCmd";
|
||||
import { AllowServerCmd } from "./commands/AllowServerCmd";
|
||||
import { DisallowServerCmd } from "./commands/DisallowServerCmd";
|
||||
import { AddDashboardUserCmd } from "./commands/AddDashboardUserCmd";
|
||||
import { RemoveDashboardUserCmd } from "./commands/RemoveDashboardUserCmd";
|
||||
import { Configs } from "../../data/Configs";
|
||||
import { ApiPermissionAssignments } from "../../data/ApiPermissionAssignments";
|
||||
import { ListDashboardUsersCmd } from "./commands/ListDashboardUsersCmd";
|
||||
import { ListDashboardPermsCmd } from "./commands/ListDashboardPermsCmd";
|
||||
import { EligibleCmd } from "./commands/EligibleCmd";
|
||||
import { TextChannel } from "discord.js";
|
||||
import { LeaveServerCmd } from "./commands/LeaveServerCmd";
|
||||
import { ListDashboardPermsCmd } from "./commands/ListDashboardPermsCmd";
|
||||
import { ListDashboardUsersCmd } from "./commands/ListDashboardUsersCmd";
|
||||
import { ReloadGlobalPluginsCmd } from "./commands/ReloadGlobalPluginsCmd";
|
||||
import { ReloadServerCmd } from "./commands/ReloadServerCmd";
|
||||
import { RemoveDashboardUserCmd } from "./commands/RemoveDashboardUserCmd";
|
||||
import { ServersCmd } from "./commands/ServersCmd";
|
||||
import { BotControlPluginType, ConfigSchema } from "./types";
|
||||
|
||||
|
||||
const defaultOptions = {
|
||||
config: {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { botControlCmd } from "../types";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { ApiPermissions } from "@shared/apiPermissions";
|
||||
import { TextChannel } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const AddDashboardUserCmd = botControlCmd({
|
||||
trigger: ["add_dashboard_user"],
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { botControlCmd } from "../types";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isSnowflake } from "../../../utils";
|
||||
import { ApiPermissions } from "@shared/apiPermissions";
|
||||
import { TextChannel } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { isSnowflake } from "../../../utils";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const AllowServerCmd = botControlCmd({
|
||||
trigger: ["allow_server", "allowserver", "add_server", "addserver"],
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { botControlCmd } from "../types";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { noop } from "../../../utils";
|
||||
import { TextChannel } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { noop } from "../../../utils";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const DisallowServerCmd = botControlCmd({
|
||||
trigger: ["disallow_server", "disallowserver", "remove_server", "removeserver"],
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { botControlCmd } from "../types";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { resolveInvite, verboseUserMention } from "../../../utils";
|
||||
import { TextChannel } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { resolveInvite, verboseUserMention } from "../../../utils";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
const REQUIRED_MEMBER_COUNT = 5000;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { botControlCmd } from "../types";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { TextChannel } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const LeaveServerCmd = botControlCmd({
|
||||
trigger: ["leave_server", "leave_guild"],
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { botControlCmd } from "../types";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { TextChannel } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { createChunkedMessage, resolveUser } from "../../../utils";
|
||||
import { AllowedGuild } from "../../../data/entities/AllowedGuild";
|
||||
import { ApiPermissionAssignment } from "../../../data/entities/ApiPermissionAssignment";
|
||||
import { TextChannel } from "discord.js";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { resolveUser } from "../../../utils";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const ListDashboardPermsCmd = botControlCmd({
|
||||
trigger: ["list_dashboard_permissions", "list_dashboard_perms", "list_dash_permissionss", "list_dash_perms"],
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import { botControlCmd } from "../types";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { ApiPermissions } from "@shared/apiPermissions";
|
||||
import { resolveUser, UnknownUser } from "../../../utils";
|
||||
import { TextChannel } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { resolveUser } from "../../../utils";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const ListDashboardUsersCmd = botControlCmd({
|
||||
trigger: ["list_dashboard_users"],
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { botControlCmd } from "../types";
|
||||
import { TextChannel } from "discord.js";
|
||||
import { isOwnerPreFilter } from "../../../pluginUtils";
|
||||
import { getActiveReload, setActiveReload } from "../activeReload";
|
||||
import { TextChannel } from "discord.js";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const ReloadGlobalPluginsCmd = botControlCmd({
|
||||
trigger: "bot_reload_global_plugins",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { botControlCmd } from "../types";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { TextChannel } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const ReloadServerCmd = botControlCmd({
|
||||
trigger: ["reload_server", "reload_guild"],
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { botControlCmd } from "../types";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { ApiPermissions } from "@shared/apiPermissions";
|
||||
import { TextChannel } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const RemoveDashboardUserCmd = botControlCmd({
|
||||
trigger: ["remove_dashboard_user"],
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { botControlCmd } from "../types";
|
||||
import { isOwnerPreFilter } from "../../../pluginUtils";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import escapeStringRegexp from "escape-string-regexp";
|
||||
import { createChunkedMessage, getUser, sorter } from "../../../utils";
|
||||
import { TextChannel } from "discord.js";
|
||||
import escapeStringRegexp from "escape-string-regexp";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isOwnerPreFilter } from "../../../pluginUtils";
|
||||
import { createChunkedMessage, getUser, sorter } from "../../../utils";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const ServersCmd = botControlCmd({
|
||||
trigger: ["servers", "guilds"],
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import * as t from "io-ts";
|
||||
import { tNullable } from "../../utils";
|
||||
import { BasePluginType, typedGlobalCommand, typedGlobalEventListener } from "knub";
|
||||
import { GuildArchives } from "../../data/GuildArchives";
|
||||
import { AllowedGuilds } from "../../data/AllowedGuilds";
|
||||
import { ApiPermissionAssignments } from "../../data/ApiPermissionAssignments";
|
||||
import { Configs } from "../../data/Configs";
|
||||
import { GuildArchives } from "../../data/GuildArchives";
|
||||
import { tNullable } from "../../utils";
|
||||
|
||||
export const ConfigSchema = t.type({
|
||||
can_use: t.boolean,
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { CaseArgs, CaseNoteArgs, CasesPluginType, ConfigSchema } from "./types";
|
||||
import { createCase } from "./functions/createCase";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { CaseTypes } from "../../data/CaseTypes";
|
||||
import { Case } from "../../data/entities/Case";
|
||||
import { GuildArchives } from "../../data/GuildArchives";
|
||||
import { GuildCases } from "../../data/GuildCases";
|
||||
import { createCaseNote } from "./functions/createCaseNote";
|
||||
import { Case } from "../../data/entities/Case";
|
||||
import { postCaseToCaseLogChannel } from "./functions/postToCaseLogChannel";
|
||||
import { CaseTypes } from "../../data/CaseTypes";
|
||||
import { getCaseTypeAmountForUserId } from "./functions/getCaseTypeAmountForUserId";
|
||||
import { getCaseEmbed } from "./functions/getCaseEmbed";
|
||||
import { trimPluginDescription } from "../../utils";
|
||||
import { getCaseSummary } from "./functions/getCaseSummary";
|
||||
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { mapToPublicFn } from "../../pluginUtils";
|
||||
import { getTotalCasesByMod } from "./functions/getTotalCasesByMod";
|
||||
import { trimPluginDescription } from "../../utils";
|
||||
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin";
|
||||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { createCase } from "./functions/createCase";
|
||||
import { createCaseNote } from "./functions/createCaseNote";
|
||||
import { getCaseEmbed } from "./functions/getCaseEmbed";
|
||||
import { getCaseSummary } from "./functions/getCaseSummary";
|
||||
import { getCaseTypeAmountForUserId } from "./functions/getCaseTypeAmountForUserId";
|
||||
import { getRecentCasesByMod } from "./functions/getRecentCasesByMod";
|
||||
import { getTotalCasesByMod } from "./functions/getTotalCasesByMod";
|
||||
import { postCaseToCaseLogChannel } from "./functions/postToCaseLogChannel";
|
||||
import { CaseArgs, CaseNoteArgs, CasesPluginType, ConfigSchema } from "./types";
|
||||
|
||||
const defaultOptions = {
|
||||
config: {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { CaseArgs, CasesPluginType } from "../types";
|
||||
import { resolveUser } from "../../../utils";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { logger } from "../../../logger";
|
||||
import { resolveUser } from "../../../utils";
|
||||
import { CaseArgs, CasesPluginType } from "../types";
|
||||
import { createCaseNote } from "./createCaseNote";
|
||||
import { postCaseToCaseLogChannel } from "./postToCaseLogChannel";
|
||||
import { logger } from "../../../logger";
|
||||
|
||||
export async function createCase(pluginData: GuildPluginData<CasesPluginType>, args: CaseArgs) {
|
||||
const user = await resolveUser(pluginData.client, args.userId);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { CaseNoteArgs, CasesPluginType } from "../types";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
|
||||
import { resolveCaseId } from "./resolveCaseId";
|
||||
import { postCaseToCaseLogChannel } from "./postToCaseLogChannel";
|
||||
import { resolveUser, UnknownUser } from "../../../utils";
|
||||
import { CaseNoteArgs, CasesPluginType } from "../types";
|
||||
import { postCaseToCaseLogChannel } from "./postToCaseLogChannel";
|
||||
import { resolveCaseId } from "./resolveCaseId";
|
||||
|
||||
export async function createCaseNote(pluginData: GuildPluginData<CasesPluginType>, args: CaseNoteArgs): Promise<void> {
|
||||
const theCase = await pluginData.state.cases.find(resolveCaseId(args.caseId));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { CasesPluginType } from "../types";
|
||||
import { CaseTypes, CaseTypeToName } from "../../../data/CaseTypes";
|
||||
import { caseColors } from "../caseColors";
|
||||
import { CasesPluginType } from "../types";
|
||||
|
||||
export function getCaseColor(pluginData: GuildPluginData<CasesPluginType>, caseType: CaseTypes) {
|
||||
return pluginData.config.get().case_colors?.[CaseTypeToName[caseType]] ?? caseColors[caseType];
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { Case } from "../../../data/entities/Case";
|
||||
|
||||
import { MessageOptions } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import moment from "moment-timezone";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
import { GuildPluginData, helpers } from "knub";
|
||||
import { CasesPluginType } from "../types";
|
||||
import { resolveCaseId } from "./resolveCaseId";
|
||||
import { chunkLines, chunkMessageLines, emptyEmbedValue, messageLink } from "../../../utils";
|
||||
import { getCaseColor } from "./getCaseColor";
|
||||
import { Case } from "../../../data/entities/Case";
|
||||
import { chunkMessageLines, emptyEmbedValue, messageLink } from "../../../utils";
|
||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
||||
import { MessageOptions } from "discord.js";
|
||||
import { CasesPluginType } from "../types";
|
||||
import { getCaseColor } from "./getCaseColor";
|
||||
import { resolveCaseId } from "./resolveCaseId";
|
||||
|
||||
|
||||
export async function getCaseEmbed(
|
||||
pluginData: GuildPluginData<CasesPluginType>,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { CasesPluginType } from "../types";
|
||||
import { CaseTypes, CaseTypeToName } from "../../../data/CaseTypes";
|
||||
import { caseIcons } from "../caseIcons";
|
||||
import { CasesPluginType } from "../types";
|
||||
|
||||
export function getCaseIcon(pluginData: GuildPluginData<CasesPluginType>, caseType: CaseTypes) {
|
||||
return pluginData.config.get().case_icons?.[CaseTypeToName[caseType]] ?? caseIcons[caseType];
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { CasesPluginType } from "../types";
|
||||
import {
|
||||
convertDelayStringToMS,
|
||||
DAYS,
|
||||
DBDateFormat,
|
||||
disableLinkPreviews,
|
||||
emptyEmbedValue,
|
||||
messageLink,
|
||||
} from "../../../utils";
|
||||
import { CaseTypes, CaseTypeToName } from "../../../data/CaseTypes";
|
||||
import { splitMessageIntoChunks } from "knub/dist/helpers";
|
||||
import moment from "moment-timezone";
|
||||
import { Case } from "../../../data/entities/Case";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { humanizeDurationShort } from "../../../humanizeDurationShort";
|
||||
import { caseAbbreviations } from "../caseAbbreviations";
|
||||
import { getCaseIcon } from "./getCaseIcon";
|
||||
import {
|
||||
convertDelayStringToMS,
|
||||
DAYS,
|
||||
DBDateFormat,
|
||||
disableLinkPreviews,
|
||||
|
||||
messageLink
|
||||
} from "../../../utils";
|
||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
||||
import { splitIntoCleanChunks, splitMessageIntoChunks } from "knub/dist/helpers";
|
||||
import { caseAbbreviations } from "../caseAbbreviations";
|
||||
import { CasesPluginType } from "../types";
|
||||
import { getCaseIcon } from "./getCaseIcon";
|
||||
|
||||
const CASE_SUMMARY_REASON_MAX_LENGTH = 300;
|
||||
const INCLUDE_MORE_NOTES_THRESHOLD = 20;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { CasesPluginType } from "../types";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
import { CasesPluginType } from "../types";
|
||||
|
||||
export async function getCaseTypeAmountForUserId(
|
||||
pluginData: GuildPluginData<CasesPluginType>,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { CasesPluginType } from "../types";
|
||||
import { Case } from "../../../data/entities/Case";
|
||||
import { CasesPluginType } from "../types";
|
||||
|
||||
export function getRecentCasesByMod(
|
||||
pluginData: GuildPluginData<CasesPluginType>,
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { FileOptions, Message, MessageOptions, TextChannel } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { CasesPluginType } from "../types";
|
||||
|
||||
import { isDiscordRESTError } from "../../../utils";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { Case } from "../../../data/entities/Case";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { isDiscordRESTError } from "../../../utils";
|
||||
import { CasesPluginType } from "../types";
|
||||
import { getCaseEmbed } from "./getCaseEmbed";
|
||||
import { resolveCaseId } from "./resolveCaseId";
|
||||
import { FileOptions, Message, MessageOptions, TextChannel } from "discord.js";
|
||||
|
||||
|
||||
export async function postToCaseLogChannel(
|
||||
pluginData: GuildPluginData<CasesPluginType>,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import * as t from "io-ts";
|
||||
import { tDelayString, tPartialDictionary, tNullable } from "../../utils";
|
||||
import { BasePluginType } from "knub";
|
||||
import { CaseNameToType, CaseTypes } from "../../data/CaseTypes";
|
||||
import { BasePluginType, typedGuildCommand, typedGuildEventListener } from "knub";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { GuildCases } from "../../data/GuildCases";
|
||||
import { GuildArchives } from "../../data/GuildArchives";
|
||||
import { GuildCases } from "../../data/GuildCases";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { tDelayString, tNullable, tPartialDictionary } from "../../utils";
|
||||
import { tColor } from "../../utils/tColor";
|
||||
|
||||
export const ConfigSchema = t.type({
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { PluginOptions } from "knub";
|
||||
import { ConfigSchema, CensorPluginType } from "./types";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { discardRegExpRunner, getRegExpRunner } from "../../regExpRunners";
|
||||
import { trimPluginDescription } from "../../utils";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin";
|
||||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { CensorPluginType, ConfigSchema } from "./types";
|
||||
import { onMessageCreate } from "./util/onMessageCreate";
|
||||
import { onMessageUpdate } from "./util/onMessageUpdate";
|
||||
import { trimPluginDescription } from "../../utils";
|
||||
import { discardRegExpRunner, getRegExpRunner } from "../../regExpRunners";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin";
|
||||
|
||||
const defaultOptions: PluginOptions<CensorPluginType> = {
|
||||
config: {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import * as t from "io-ts";
|
||||
import { BasePluginType } from "knub";
|
||||
import { tNullable } from "../../utils";
|
||||
import { TRegex } from "../../validatorUtils";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { RegExpRunner } from "../../RegExpRunner";
|
||||
import { tNullable } from "../../utils";
|
||||
import { TRegex } from "../../validatorUtils";
|
||||
|
||||
export const ConfigSchema = t.type({
|
||||
filter_zalgo: t.boolean,
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { CensorPluginType } from "../types";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
|
||||
import { ZalgoRegex } from "../../../data/Zalgo";
|
||||
import { getInviteCodesInString, getUrlsInString, resolveMember, resolveInvite, isGuildInvite } from "../../../utils";
|
||||
import cloneDeep from "lodash.clonedeep";
|
||||
import { censorMessage } from "./censorMessage";
|
||||
import { Invite, MessageEmbed } from "discord.js";
|
||||
import escapeStringRegexp from "escape-string-regexp";
|
||||
import { logger } from "../../../logger";
|
||||
import { GuildPluginData } from "knub";
|
||||
import cloneDeep from "lodash.clonedeep";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { ZalgoRegex } from "../../../data/Zalgo";
|
||||
import { allowTimeout } from "../../../RegExpRunner";
|
||||
import { MessageEmbed, Invite } from "discord.js";
|
||||
import { getInviteCodesInString, getUrlsInString, isGuildInvite, resolveInvite, resolveMember } from "../../../utils";
|
||||
import { CensorPluginType } from "../types";
|
||||
import { censorMessage } from "./censorMessage";
|
||||
|
||||
|
||||
export async function applyFiltersToMsg(
|
||||
pluginData: GuildPluginData<CensorPluginType>,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { TextChannel } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { CensorPluginType } from "../types";
|
||||
import { deactivateMentions, disableCodeBlocks } from "knub/dist/helpers";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { stripObjectToScalars, resolveUser } from "../../../utils";
|
||||
import { disableCodeBlocks, deactivateMentions } from "knub/dist/helpers";
|
||||
import { TextChannel } from "discord.js";
|
||||
import { resolveUser, stripObjectToScalars } from "../../../utils";
|
||||
import { CensorPluginType } from "../types";
|
||||
|
||||
export async function censorMessage(
|
||||
pluginData: GuildPluginData<CensorPluginType>,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { CensorPluginType } from "../types";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { applyFiltersToMsg } from "./applyFiltersToMsg";
|
||||
import { messageLock } from "../../../utils/lockNameHelpers";
|
||||
import { CensorPluginType } from "../types";
|
||||
import { applyFiltersToMsg } from "./applyFiltersToMsg";
|
||||
|
||||
export async function onMessageCreate(pluginData: GuildPluginData<CensorPluginType>, savedMessage: SavedMessage) {
|
||||
if (savedMessage.is_bot) return;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { CensorPluginType } from "../types";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { applyFiltersToMsg } from "./applyFiltersToMsg";
|
||||
import { messageLock } from "../../../utils/lockNameHelpers";
|
||||
import { CensorPluginType } from "../types";
|
||||
import { applyFiltersToMsg } from "./applyFiltersToMsg";
|
||||
|
||||
export async function onMessageUpdate(pluginData: GuildPluginData<CensorPluginType>, savedMessage: SavedMessage) {
|
||||
if (savedMessage.is_bot) return;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { ChannelArchiverPluginType } from "./types";
|
||||
import { ArchiveChannelCmd } from "./commands/ArchiveChannelCmd";
|
||||
import * as t from "io-ts";
|
||||
import { TimeAndDatePlugin } from "../TimeAndDate/TimeAndDatePlugin";
|
||||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { ArchiveChannelCmd } from "./commands/ArchiveChannelCmd";
|
||||
import { ChannelArchiverPluginType } from "./types";
|
||||
|
||||
export const ChannelArchiverPlugin = zeppelinGuildPlugin<ChannelArchiverPluginType>()({
|
||||
name: "channel_archiver",
|
||||
|
|
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