refactor: convert /backend to ESM
This commit is contained in:
parent
31d74c05aa
commit
5772e27cda
766 changed files with 3473 additions and 3500 deletions
|
@ -1,13 +1,13 @@
|
|||
import { PluginOptions, guildPlugin } from "knub";
|
||||
import { GuildArchives } from "../../data/GuildArchives";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { GuildMutes } from "../../data/GuildMutes";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin";
|
||||
import { SpamVoiceStateUpdateEvt } from "./events/SpamVoiceEvt";
|
||||
import { SpamPluginType, zSpamConfig } from "./types";
|
||||
import { clearOldRecentActions } from "./util/clearOldRecentActions";
|
||||
import { onMessageCreate } from "./util/onMessageCreate";
|
||||
import { GuildArchives } from "../../data/GuildArchives.js";
|
||||
import { GuildLogs } from "../../data/GuildLogs.js";
|
||||
import { GuildMutes } from "../../data/GuildMutes.js";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages.js";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin.js";
|
||||
import { SpamVoiceStateUpdateEvt } from "./events/SpamVoiceEvt.js";
|
||||
import { SpamPluginType, zSpamConfig } from "./types.js";
|
||||
import { clearOldRecentActions } from "./util/clearOldRecentActions.js";
|
||||
import { onMessageCreate } from "./util/onMessageCreate.js";
|
||||
|
||||
const defaultOptions: PluginOptions<SpamPluginType> = {
|
||||
config: {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { RecentActionType, spamEvt } from "../types";
|
||||
import { logAndDetectOtherSpam } from "../util/logAndDetectOtherSpam";
|
||||
import { RecentActionType, spamEvt } from "../types.js";
|
||||
import { logAndDetectOtherSpam } from "../util/logAndDetectOtherSpam.js";
|
||||
|
||||
export const SpamVoiceStateUpdateEvt = spamEvt({
|
||||
event: "voiceStateUpdate",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { ZeppelinPluginInfo } from "../../types";
|
||||
import { trimPluginDescription } from "../../utils";
|
||||
import { zSpamConfig } from "./types";
|
||||
import { ZeppelinPluginInfo } from "../../types.js";
|
||||
import { trimPluginDescription } from "../../utils.js";
|
||||
import { zSpamConfig } from "./types.js";
|
||||
|
||||
export const spamPluginInfo: ZeppelinPluginInfo = {
|
||||
showInDocs: true,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { BasePluginType, guildPluginEventListener } from "knub";
|
||||
import z from "zod";
|
||||
import { GuildArchives } from "../../data/GuildArchives";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { GuildMutes } from "../../data/GuildMutes";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages";
|
||||
import { zSnowflake } from "../../utils";
|
||||
import { GuildArchives } from "../../data/GuildArchives.js";
|
||||
import { GuildLogs } from "../../data/GuildLogs.js";
|
||||
import { GuildMutes } from "../../data/GuildMutes.js";
|
||||
import { GuildSavedMessages } from "../../data/GuildSavedMessages.js";
|
||||
import { zSnowflake } from "../../utils.js";
|
||||
|
||||
const zBaseSingleSpamConfig = z.strictObject({
|
||||
interval: z.number(),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { RecentActionType, SpamPluginType } from "../types";
|
||||
import { RecentActionType, SpamPluginType } from "../types.js";
|
||||
|
||||
export function addRecentAction(
|
||||
pluginData: GuildPluginData<SpamPluginType>,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { SpamPluginType } from "../types";
|
||||
import { SpamPluginType } from "../types.js";
|
||||
|
||||
const MAX_INTERVAL = 300;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { RecentActionType, SpamPluginType } from "../types";
|
||||
import { RecentActionType, SpamPluginType } from "../types.js";
|
||||
|
||||
export function clearRecentUserActions(
|
||||
pluginData: GuildPluginData<SpamPluginType>,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { RecentActionType, SpamPluginType } from "../types";
|
||||
import { RecentActionType, SpamPluginType } from "../types.js";
|
||||
|
||||
export function getRecentActionCount(
|
||||
pluginData: GuildPluginData<SpamPluginType>,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { RecentActionType, SpamPluginType } from "../types";
|
||||
import { RecentActionType, SpamPluginType } from "../types.js";
|
||||
|
||||
export function getRecentActions(
|
||||
pluginData: GuildPluginData<SpamPluginType>,
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import { GuildTextBasedChannel, Snowflake, TextChannel } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import moment from "moment-timezone";
|
||||
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { logger } from "../../../logger";
|
||||
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin";
|
||||
import { MutesPlugin } from "../../../plugins/Mutes/MutesPlugin";
|
||||
import { MuteResult } from "../../../plugins/Mutes/types";
|
||||
import { DBDateFormat, convertDelayStringToMS, noop, resolveMember, trimLines } from "../../../utils";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { RecentActionType, SpamPluginType, TBaseSingleSpamConfig } from "../types";
|
||||
import { addRecentAction } from "./addRecentAction";
|
||||
import { clearRecentUserActions } from "./clearRecentUserActions";
|
||||
import { getRecentActionCount } from "./getRecentActionCount";
|
||||
import { getRecentActions } from "./getRecentActions";
|
||||
import { saveSpamArchives } from "./saveSpamArchives";
|
||||
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError.js";
|
||||
import { CaseTypes } from "../../../data/CaseTypes.js";
|
||||
import { LogType } from "../../../data/LogType.js";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
|
||||
import { logger } from "../../../logger.js";
|
||||
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin.js";
|
||||
import { MutesPlugin } from "../../../plugins/Mutes/MutesPlugin.js";
|
||||
import { MuteResult } from "../../../plugins/Mutes/types.js";
|
||||
import { DBDateFormat, convertDelayStringToMS, noop, resolveMember, trimLines } from "../../../utils.js";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
|
||||
import { RecentActionType, SpamPluginType, TBaseSingleSpamConfig } from "../types.js";
|
||||
import { addRecentAction } from "./addRecentAction.js";
|
||||
import { clearRecentUserActions } from "./clearRecentUserActions.js";
|
||||
import { getRecentActionCount } from "./getRecentActionCount.js";
|
||||
import { getRecentActions } from "./getRecentActions.js";
|
||||
import { saveSpamArchives } from "./saveSpamArchives.js";
|
||||
|
||||
export async function logAndDetectMessageSpam(
|
||||
pluginData: GuildPluginData<SpamPluginType>,
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin";
|
||||
import { MutesPlugin } from "../../../plugins/Mutes/MutesPlugin";
|
||||
import { convertDelayStringToMS, resolveMember } from "../../../utils";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { RecentActionType, SpamPluginType } from "../types";
|
||||
import { addRecentAction } from "./addRecentAction";
|
||||
import { clearRecentUserActions } from "./clearRecentUserActions";
|
||||
import { getRecentActionCount } from "./getRecentActionCount";
|
||||
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError.js";
|
||||
import { CaseTypes } from "../../../data/CaseTypes.js";
|
||||
import { CasesPlugin } from "../../../plugins/Cases/CasesPlugin.js";
|
||||
import { MutesPlugin } from "../../../plugins/Mutes/MutesPlugin.js";
|
||||
import { convertDelayStringToMS, resolveMember } from "../../../utils.js";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
|
||||
import { RecentActionType, SpamPluginType } from "../types.js";
|
||||
import { addRecentAction } from "./addRecentAction.js";
|
||||
import { clearRecentUserActions } from "./clearRecentUserActions.js";
|
||||
import { getRecentActionCount } from "./getRecentActionCount.js";
|
||||
|
||||
export async function logAndDetectOtherSpam(
|
||||
pluginData: GuildPluginData<SpamPluginType>,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Snowflake } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { RecentActionType, SpamPluginType } from "../types";
|
||||
import { logAndDetectMessageSpam } from "./logAndDetectMessageSpam";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
|
||||
import { RecentActionType, SpamPluginType } from "../types.js";
|
||||
import { logAndDetectMessageSpam } from "./logAndDetectMessageSpam.js";
|
||||
|
||||
export async function logCensor(pluginData: GuildPluginData<SpamPluginType>, savedMessage: SavedMessage) {
|
||||
const member = pluginData.guild.members.cache.get(savedMessage.user_id as Snowflake);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { Snowflake } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { getEmojiInString, getRoleMentions, getUrlsInString, getUserMentions } from "../../../utils";
|
||||
import { RecentActionType, SpamPluginType } from "../types";
|
||||
import { logAndDetectMessageSpam } from "./logAndDetectMessageSpam";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
|
||||
import { getEmojiInString, getRoleMentions, getUrlsInString, getUserMentions } from "../../../utils.js";
|
||||
import { RecentActionType, SpamPluginType } from "../types.js";
|
||||
import { logAndDetectMessageSpam } from "./logAndDetectMessageSpam.js";
|
||||
|
||||
export async function onMessageCreate(pluginData: GuildPluginData<SpamPluginType>, savedMessage: SavedMessage) {
|
||||
if (savedMessage.is_bot) return;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { GuildPluginData } from "knub";
|
||||
import moment from "moment-timezone";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage";
|
||||
import { getBaseUrl } from "../../../pluginUtils";
|
||||
import { SpamPluginType } from "../types";
|
||||
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
|
||||
import { getBaseUrl } from "../../../pluginUtils.js";
|
||||
import { SpamPluginType } from "../types.js";
|
||||
|
||||
const SPAM_ARCHIVE_EXPIRY_DAYS = 90;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue