start moving types into shared library

This commit is contained in:
JandereDev 2022-07-09 09:45:15 +02:00
parent 5223456264
commit fe62ee88cd
Signed by: Lea
GPG key ID: 5D5E18ACB990F57A
36 changed files with 40 additions and 42 deletions

View file

@ -3,7 +3,7 @@ import { client, dbs } from "../../..";
import CommandCategory from "../../../struct/commands/CommandCategory"; import CommandCategory from "../../../struct/commands/CommandCategory";
import SimpleCommand from "../../../struct/commands/SimpleCommand"; import SimpleCommand from "../../../struct/commands/SimpleCommand";
import MessageCommandContext from "../../../struct/MessageCommandContext"; import MessageCommandContext from "../../../struct/MessageCommandContext";
import PendingLogin from "../../../struct/PendingLogin"; import PendingLogin from "automod/types/PendingLogin";
import logger from "../../logger"; import logger from "../../logger";
import { DEFAULT_PREFIX } from "../../modules/command_handler"; import { DEFAULT_PREFIX } from "../../modules/command_handler";

View file

@ -3,7 +3,7 @@ import { client, dbs } from "../../..";
import CommandCategory from "../../../struct/commands/CommandCategory"; import CommandCategory from "../../../struct/commands/CommandCategory";
import SimpleCommand from "../../../struct/commands/SimpleCommand"; import SimpleCommand from "../../../struct/commands/SimpleCommand";
import MessageCommandContext from "../../../struct/MessageCommandContext"; import MessageCommandContext from "../../../struct/MessageCommandContext";
import ServerConfig from "../../../struct/ServerConfig"; import ServerConfig from "automod/types/ServerConfig";
import { isBotManager, NO_MANAGER_MSG, parseUser } from "../../util"; import { isBotManager, NO_MANAGER_MSG, parseUser } from "../../util";
const SYNTAX = '/whitelist add @user; /whitelist remove @user; /whitelist list'; const SYNTAX = '/whitelist add @user; /whitelist remove @user; /whitelist list';

View file

@ -1,7 +1,7 @@
import { ulid } from "ulid"; import { ulid } from "ulid";
import { client } from "../../../index"; import { client } from "../../../index";
import Infraction from "../../../struct/antispam/Infraction"; import Infraction from "automod/types/antispam/Infraction";
import InfractionType from "../../../struct/antispam/InfractionType"; import InfractionType from "automod/types/antispam/InfractionType";
import SimpleCommand from "../../../struct/commands/SimpleCommand"; import SimpleCommand from "../../../struct/commands/SimpleCommand";
import { fetchUsername, logModAction } from "../../modules/mod_logs"; import { fetchUsername, logModAction } from "../../modules/mod_logs";
import { storeTempBan } from "../../modules/tempbans"; import { storeTempBan } from "../../modules/tempbans";

View file

@ -2,8 +2,8 @@ import { User } from "@janderedev/revolt.js";
import { SendableEmbed } from "revolt-api"; import { SendableEmbed } from "revolt-api";
import { ulid } from "ulid"; import { ulid } from "ulid";
import { client } from "../../../"; import { client } from "../../../";
import Infraction from "../../../struct/antispam/Infraction"; import Infraction from "automod/types/antispam/Infraction";
import InfractionType from "../../../struct/antispam/InfractionType"; import InfractionType from "automod/types/antispam/InfractionType";
import CommandCategory from "../../../struct/commands/CommandCategory"; import CommandCategory from "../../../struct/commands/CommandCategory";
import SimpleCommand from "../../../struct/commands/SimpleCommand"; import SimpleCommand from "../../../struct/commands/SimpleCommand";
import logger from "../../logger"; import logger from "../../logger";

View file

@ -1,8 +1,8 @@
import SimpleCommand from "../../../struct/commands/SimpleCommand"; import SimpleCommand from "../../../struct/commands/SimpleCommand";
import { dedupeArray, embed, EmbedColor, generateInfractionDMEmbed, getDmChannel, isModerator, NO_MANAGER_MSG, parseUserOrId, sanitizeMessageContent, storeInfraction } from "../../util"; import { dedupeArray, embed, EmbedColor, generateInfractionDMEmbed, getDmChannel, isModerator, NO_MANAGER_MSG, parseUserOrId, sanitizeMessageContent, storeInfraction } from "../../util";
import Infraction from "../../../struct/antispam/Infraction"; import Infraction from "automod/types/antispam/Infraction";
import { ulid } from "ulid"; import { ulid } from "ulid";
import InfractionType from "../../../struct/antispam/InfractionType"; import InfractionType from "automod/types/antispam/InfractionType";
import { fetchUsername, logModAction } from "../../modules/mod_logs"; import { fetchUsername, logModAction } from "../../modules/mod_logs";
import CommandCategory from "../../../struct/commands/CommandCategory"; import CommandCategory from "../../../struct/commands/CommandCategory";
import { SendableEmbed } from "revolt-api"; import { SendableEmbed } from "revolt-api";

View file

@ -1,7 +1,7 @@
import SimpleCommand from "../../../struct/commands/SimpleCommand"; import SimpleCommand from "../../../struct/commands/SimpleCommand";
import { client, dbs } from "../../.."; import { dbs } from "../../..";
import Infraction from "../../../struct/antispam/Infraction"; import Infraction from "automod/types/antispam/Infraction";
import InfractionType from "../../../struct/antispam/InfractionType"; import InfractionType from "automod/types/antispam/InfractionType";
import { isModerator, NO_MANAGER_MSG, parseUserOrId, uploadFile } from "../../util"; import { isModerator, NO_MANAGER_MSG, parseUserOrId, uploadFile } from "../../util";
import Day from 'dayjs'; import Day from 'dayjs';
import RelativeTime from 'dayjs/plugin/relativeTime'; import RelativeTime from 'dayjs/plugin/relativeTime';

View file

@ -1,10 +1,10 @@
import { Message } from "@janderedev/revolt.js/dist/maps/Messages"; import { Message } from "@janderedev/revolt.js/dist/maps/Messages";
import { ulid } from "ulid"; import { ulid } from "ulid";
import { dbs } from "../.."; import { dbs } from "../..";
import AntispamRule from "../../struct/antispam/AntispamRule"; import AntispamRule from "automod/types/antispam/AntispamRule";
import Infraction from "../../struct/antispam/Infraction"; import Infraction from "automod/types/antispam/Infraction";
import InfractionType from "../../struct/antispam/InfractionType"; import InfractionType from "automod/types/antispam/InfractionType";
import ModerationAction from "../../struct/antispam/ModerationAction"; import ModerationAction from "automod/types/antispam/ModerationAction";
import logger from "../logger"; import logger from "../logger";
import { isModerator, storeInfraction } from "../util"; import { isModerator, storeInfraction } from "../util";

View file

@ -1,7 +1,7 @@
import { Member } from "@janderedev/revolt.js/dist/maps/Members"; import { Member } from "@janderedev/revolt.js/dist/maps/Members";
import { User } from "@janderedev/revolt.js/dist/maps/Users"; import { User } from "@janderedev/revolt.js/dist/maps/Users";
import { client, dbs } from "../../.."; import { client, dbs } from "../../..";
import ServerConfig from "../../../struct/ServerConfig"; import ServerConfig from "automod/types/ServerConfig";
import { getPermissionLevel } from "../../util"; import { getPermissionLevel } from "../../util";
import { wsEvents, WSResponse } from "../api_communication"; import { wsEvents, WSResponse } from "../api_communication";

View file

@ -8,7 +8,7 @@ import crypto from 'crypto';
import { client as bot, dbs } from '../..'; import { client as bot, dbs } from '../..';
import { EventEmitter } from "events"; import { EventEmitter } from "events";
import { parseUser } from "../util"; import { parseUser } from "../util";
import PendingLogin from "../../struct/PendingLogin"; import PendingLogin from "automod/types/PendingLogin";
import { ulid } from "ulid"; import { ulid } from "ulid";
const wsEvents = new EventEmitter(); const wsEvents = new EventEmitter();

View file

@ -1,5 +1,5 @@
import { Message } from "@janderedev/revolt.js/dist/maps/Messages"; import { Message } from "@janderedev/revolt.js/dist/maps/Messages";
import CustomRuleAction from "../../../../struct/antispam/CustomRuleAction"; import CustomRuleAction from "automod/types/antispam/CustomRuleAction";
async function execute(message: Message, action: CustomRuleAction) { async function execute(message: Message, action: CustomRuleAction) {
setTimeout(() => message.delete().catch(console.warn), (action.duration ?? 0) * 1000); setTimeout(() => message.delete().catch(console.warn), (action.duration ?? 0) * 1000);

View file

@ -1,6 +1,6 @@
import { Message } from "@janderedev/revolt.js/dist/maps/Messages"; import { Message } from "@janderedev/revolt.js/dist/maps/Messages";
import { client } from "../../../.."; import { client } from "../../../..";
import CustomRuleAction from "../../../../struct/antispam/CustomRuleAction"; import CustomRuleAction from "automod/types/antispam/CustomRuleAction";
async function execute(message: Message, action: CustomRuleAction) { async function execute(message: Message, action: CustomRuleAction) {
let text = action.text || "Error: No text specified for `sendMessage` action"; let text = action.text || "Error: No text specified for `sendMessage` action";

View file

@ -1,9 +1,9 @@
import { Message } from "@janderedev/revolt.js/dist/maps/Messages"; import { Message } from "@janderedev/revolt.js/dist/maps/Messages";
import CustomRuleAction from "../../../../struct/antispam/CustomRuleAction"; import CustomRuleAction from "automod/types/antispam/CustomRuleAction";
import { storeInfraction } from '../../../util'; import { storeInfraction } from '../../../util';
import Infraction from "../../../../struct/antispam/Infraction"; import Infraction from "automod/types/antispam/Infraction";
import { ulid } from "ulid"; import { ulid } from "ulid";
import InfractionType from "../../../../struct/antispam/InfractionType"; import InfractionType from "automod/types/antispam/InfractionType";
async function execute(message: Message, action: CustomRuleAction) { async function execute(message: Message, action: CustomRuleAction) {
let warnMsg = action.text let warnMsg = action.text

View file

@ -1,6 +1,6 @@
import { Message } from "@janderedev/revolt.js/dist/maps/Messages"; import { Message } from "@janderedev/revolt.js/dist/maps/Messages";
import { client } from "../../.."; import { client } from "../../..";
import CustomRuleTrigger from "../../../struct/antispam/CustomRuleTrigger"; import CustomRuleTrigger from "automod/types/antispam/CustomRuleTrigger";
import VM from 'vm'; import VM from 'vm';
let ruleTimeouts: Map<string, number> = new Map(); let ruleTimeouts: Map<string, number> = new Map();

View file

@ -1,8 +1,8 @@
import { ulid } from "ulid"; import { ulid } from "ulid";
import crypto from "crypto"; import crypto from "crypto";
import { client, dbs } from "../.."; import { client, dbs } from "../..";
import Infraction from "../../struct/antispam/Infraction"; import Infraction from "automod/types/antispam/Infraction";
import InfractionType from "../../struct/antispam/InfractionType"; import InfractionType from "automod/types/antispam/InfractionType";
import { BLACKLIST_BAN_REASON, BLACKLIST_MESSAGE } from "../commands/admin/botadm"; import { BLACKLIST_BAN_REASON, BLACKLIST_MESSAGE } from "../commands/admin/botadm";
import logger from "../logger"; import logger from "../logger";
import { hasPermForChannel, storeInfraction } from "../util"; import { hasPermForChannel, storeInfraction } from "../util";

View file

@ -1,9 +1,7 @@
import { Member } from "@janderedev/revolt.js/dist/maps/Members"; import { Member } from "@janderedev/revolt.js/dist/maps/Members";
import { Server } from "@janderedev/revolt.js/dist/maps/Servers"; import { Server } from "@janderedev/revolt.js/dist/maps/Servers";
import { client, dbs } from "../.."; import { client, dbs } from "../..";
import Infraction from "../../struct/antispam/Infraction"; import LogMessage from "automod/types/LogMessage";
import LogMessage from "../../struct/LogMessage";
import ServerConfig from "../../struct/ServerConfig";
import logger from "../logger"; import logger from "../logger";
import { getAutumnURL, sanitizeMessageContent, sendLogMessage } from "../util"; import { getAutumnURL, sanitizeMessageContent, sendLogMessage } from "../util";

View file

@ -1,6 +1,6 @@
import { FindResult } from "monk"; import { FindResult } from "monk";
import { client, dbs } from "../.."; import { client, dbs } from "../..";
import TempBan from "../../struct/TempBan"; import TempBan from "automod/types/TempBan";
import logger from "../logger"; import logger from "../logger";
// Array of ban IDs which should not get processed in this session // Array of ban IDs which should not get processed in this session

View file

@ -1,12 +1,12 @@
import { Member } from "@janderedev/revolt.js/dist/maps/Members"; import { Member } from "@janderedev/revolt.js/dist/maps/Members";
import { User } from "@janderedev/revolt.js/dist/maps/Users"; import { User } from "@janderedev/revolt.js/dist/maps/Users";
import { client, dbs } from ".."; import { client, dbs } from "..";
import Infraction from "../struct/antispam/Infraction"; import Infraction from "automod/types/antispam/Infraction";
import FormData from 'form-data'; import FormData from 'form-data';
import axios from 'axios'; import axios from 'axios';
import { Server } from "@janderedev/revolt.js/dist/maps/Servers"; import { Server } from "@janderedev/revolt.js/dist/maps/Servers";
import LogConfig from "../struct/LogConfig"; import LogConfig from "automod/types/LogConfig";
import LogMessage from "../struct/LogMessage"; import LogMessage from "automod/types/LogMessage";
import { ColorResolvable, MessageEmbed } from "discord.js"; import { ColorResolvable, MessageEmbed } from "discord.js";
import logger from "./logger"; import logger from "./logger";
import { ulid } from "ulid"; import { ulid } from "ulid";
@ -16,7 +16,7 @@ import { Message } from "@janderedev/revolt.js/dist/maps/Messages";
import { isSudo } from "./commands/admin/botadm"; import { isSudo } from "./commands/admin/botadm";
import { SendableEmbed } from "revolt-api"; import { SendableEmbed } from "revolt-api";
import MessageCommandContext from "../struct/MessageCommandContext"; import MessageCommandContext from "../struct/MessageCommandContext";
import ServerConfig from "../struct/ServerConfig"; import ServerConfig from "automod/types/ServerConfig";
const NO_MANAGER_MSG = '🔒 Missing permission'; const NO_MANAGER_MSG = '🔒 Missing permission';
const ULID_REGEX = /^[0-9A-HJ-KM-NP-TV-Z]{26}$/i; const ULID_REGEX = /^[0-9A-HJ-KM-NP-TV-Z]{26}$/i;

View file

@ -4,15 +4,15 @@ config();
import logger from './bot/logger'; import logger from './bot/logger';
import AutomodClient, { login } from './struct/AutomodClient'; import AutomodClient, { login } from './struct/AutomodClient';
import MongoDB from './bot/db'; import MongoDB from './bot/db';
import DbUser from './struct/DbUser'; import DbUser from 'automod/types/DbUser';
import ServerConfig from './struct/ServerConfig'; import ServerConfig from 'automod/types/ServerConfig';
import Infraction from './struct/antispam/Infraction'; import Infraction from 'automod/types/antispam/Infraction';
import PendingLogin from './struct/PendingLogin'; import PendingLogin from 'automod/types/PendingLogin';
import TempBan from './struct/TempBan'; import TempBan from 'automod/types/TempBan';
import { VoteEntry } from './bot/commands/moderation/votekick'; import { VoteEntry } from './bot/commands/moderation/votekick';
import BridgeRequest from './struct/BridgeRequest'; import BridgeRequest from 'automod/types/BridgeRequest';
import BridgeConfig from './struct/BridgeConfig'; import BridgeConfig from 'automod/types/BridgeConfig';
import BridgedMessage from './struct/BridgedMessage'; import BridgedMessage from 'automod/types/BridgedMessage';
logger.info('Initializing client'); logger.info('Initializing client');

View file

@ -1,6 +1,6 @@
import CommandCategory from "./CommandCategory"; import CommandCategory from "./CommandCategory";
import MessageCommandContext from "../MessageCommandContext"; import MessageCommandContext from "../MessageCommandContext";
import ServerConfig from "../ServerConfig"; import ServerConfig from "automod/types/ServerConfig";
/** /**
* A basic command, consisting of basic attributes * A basic command, consisting of basic attributes