3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-14 21:31:50 +00:00

refactor: convert /backend to ESM

This commit is contained in:
Dragory 2024-04-09 20:57:18 +03:00
parent 31d74c05aa
commit 5772e27cda
No known key found for this signature in database
766 changed files with 3473 additions and 3500 deletions

View file

@ -3,6 +3,7 @@
"version": "0.0.1",
"description": "",
"private": true,
"type": "module",
"scripts": {
"watch": "tsc-watch --build --onSuccess \"node start-dev.js\"",
"watch-yaml-parse-test": "tsc-watch --build --onSuccess \"node dist/yamlParseTest.js\"",
@ -48,12 +49,7 @@
"knub": "^32.0.0-next.21",
"knub-command-manager": "^9.1.0",
"last-commit-log": "^2.1.0",
"lodash.chunk": "^4.2.0",
"lodash.clonedeep": "^4.5.0",
"lodash.difference": "^4.5.0",
"lodash.intersection": "^4.4.0",
"lodash.isequal": "^4.5.0",
"lodash.pick": "^4.4.0",
"lodash": "^4.17.21",
"moment-timezone": "^0.5.21",
"multer": "^1.4.5-lts.1",
"mysql2": "^3.9.3",
@ -87,7 +83,6 @@
"@types/lodash.at": "^4.6.3",
"@types/moment-timezone": "^0.5.6",
"@types/multer": "^1.4.7",
"@types/node": "^18.16.3",
"@types/passport": "^1.0.0",
"@types/passport-oauth2": "^1.4.8",
"@types/passport-strategy": "^0.2.35",

View file

@ -1,4 +1,4 @@
import { SECONDS } from "./utils";
import { SECONDS } from "./utils.js";
type InternalQueueFn = () => Promise<void>;
type AnyFn = (...args: any[]) => any;

View file

@ -1,4 +1,4 @@
import { Queue } from "./Queue";
import { Queue } from "./Queue.js";
type Listener = (...args: any[]) => void;

View file

@ -1,7 +1,7 @@
import { EventEmitter } from "events";
import { CooldownManager } from "knub";
import { RegExpWorker, TimeoutError } from "regexp-worker";
import { MINUTES, SECONDS } from "./utils";
import { MINUTES, SECONDS } from "./utils.js";
import Timeout = NodeJS.Timeout;
const isTimeoutError = (a): a is TimeoutError => {

View file

@ -1,7 +1,7 @@
import express, { Request, Response } from "express";
import moment from "moment-timezone";
import { GuildArchives } from "../data/GuildArchives";
import { notFound } from "./responses";
import { GuildArchives } from "../data/GuildArchives.js";
import { notFound } from "./responses.js";
export function initArchives(router: express.Router) {
const archives = new GuildArchives(null);

View file

@ -1,15 +1,15 @@
import express, { Request, Response } from "express";
import https from "https";
import pick from "lodash.pick";
import pick from "lodash/pick.js";
import passport from "passport";
import { Strategy as CustomStrategy } from "passport-custom";
import OAuth2Strategy from "passport-oauth2";
import { ApiLogins } from "../data/ApiLogins";
import { ApiPermissionAssignments } from "../data/ApiPermissionAssignments";
import { ApiUserInfo } from "../data/ApiUserInfo";
import { ApiUserInfoData } from "../data/entities/ApiUserInfo";
import { env } from "../env";
import { ok } from "./responses";
import { ApiLogins } from "../data/ApiLogins.js";
import { ApiPermissionAssignments } from "../data/ApiPermissionAssignments.js";
import { ApiUserInfo } from "../data/ApiUserInfo.js";
import { ApiUserInfoData } from "../data/entities/ApiUserInfo.js";
import { env } from "../env.js";
import { ok } from "./responses.js";
interface IPassportApiUser {
apiKey: string;

View file

@ -1,9 +1,9 @@
import express from "express";
import z from "zod";
import { guildPlugins } from "../plugins/availablePlugins";
import { guildPluginInfo } from "../plugins/pluginInfo";
import { indentLines } from "../utils";
import { notFound } from "./responses";
import { guildPlugins } from "../plugins/availablePlugins.js";
import { guildPluginInfo } from "../plugins/pluginInfo.js";
import { indentLines } from "../utils.js";
import { notFound } from "./responses.js";
function isZodObject(schema: z.ZodTypeAny): schema is z.ZodObject<any> {
return schema._def.typeName === "ZodObject";

View file

@ -1,20 +1,22 @@
import { ApiPermissions } from "@zeppelinbot/shared";
import express, { Request, Response } from "express";
import { YAMLException } from "js-yaml";
import jsYaml from "js-yaml";
import moment from "moment-timezone";
import { Queue } from "../Queue";
import { validateGuildConfig } from "../configValidator";
import { AllowedGuilds } from "../data/AllowedGuilds";
import { ApiAuditLog } from "../data/ApiAuditLog";
import { ApiPermissionAssignments, ApiPermissionTypes } from "../data/ApiPermissionAssignments";
import { Configs } from "../data/Configs";
import { AuditLogEventTypes } from "../data/apiAuditLogTypes";
import { isSnowflake } from "../utils";
import { loadYamlSafely } from "../utils/loadYamlSafely";
import { ObjectAliasError } from "../utils/validateNoObjectAliases";
import { apiTokenAuthHandlers } from "./auth";
import { hasGuildPermission, requireGuildPermission } from "./permissions";
import { clientError, ok, serverError, unauthorized } from "./responses";
import { Queue } from "../Queue.js";
import { validateGuildConfig } from "../configValidator.js";
import { AllowedGuilds } from "../data/AllowedGuilds.js";
import { ApiAuditLog } from "../data/ApiAuditLog.js";
import { ApiPermissionAssignments, ApiPermissionTypes } from "../data/ApiPermissionAssignments.js";
import { Configs } from "../data/Configs.js";
import { AuditLogEventTypes } from "../data/apiAuditLogTypes.js";
import { isSnowflake } from "../utils.js";
import { loadYamlSafely } from "../utils/loadYamlSafely.js";
import { ObjectAliasError } from "../utils/validateNoObjectAliases.js";
import { apiTokenAuthHandlers } from "./auth.js";
import { hasGuildPermission, requireGuildPermission } from "./permissions.js";
import { clientError, ok, serverError, unauthorized } from "./responses.js";
const YAMLException = jsYaml.YAMLException;
const apiPermissionAssignments = new ApiPermissionAssignments();
const auditLog = new ApiAuditLog();

View file

@ -2,12 +2,12 @@ import { ApiPermissions } from "@zeppelinbot/shared";
import express, { Request, Response } from "express";
import moment from "moment-timezone";
import { z } from "zod";
import { GuildCases } from "../../data/GuildCases";
import { Case } from "../../data/entities/Case";
import { MINUTES } from "../../utils";
import { requireGuildPermission } from "../permissions";
import { rateLimit } from "../rateLimits";
import { clientError, ok } from "../responses";
import { GuildCases } from "../../data/GuildCases.js";
import { Case } from "../../data/entities/Case.js";
import { MINUTES } from "../../utils.js";
import { requireGuildPermission } from "../permissions.js";
import { rateLimit } from "../rateLimits.js";
import { clientError, ok } from "../responses.js";
const caseHandlingModeSchema = z.union([
z.literal("replace"),

View file

@ -1,7 +1,7 @@
import express from "express";
import { apiTokenAuthHandlers } from "../auth";
import { initGuildsImportExportAPI } from "./importExport";
import { initGuildsMiscAPI } from "./misc";
import { apiTokenAuthHandlers } from "../auth.js";
import { initGuildsImportExportAPI } from "./importExport.js";
import { initGuildsMiscAPI } from "./misc.js";
export function initGuildsAPI(router: express.Router) {
const guildRouter = express.Router();

View file

@ -1,19 +1,21 @@
import { ApiPermissions } from "@zeppelinbot/shared";
import express, { Request, Response } from "express";
import { YAMLException } from "js-yaml";
import jsYaml from "js-yaml";
import moment from "moment-timezone";
import { Queue } from "../../Queue";
import { validateGuildConfig } from "../../configValidator";
import { AllowedGuilds } from "../../data/AllowedGuilds";
import { ApiAuditLog } from "../../data/ApiAuditLog";
import { ApiPermissionAssignments, ApiPermissionTypes } from "../../data/ApiPermissionAssignments";
import { Configs } from "../../data/Configs";
import { AuditLogEventTypes } from "../../data/apiAuditLogTypes";
import { isSnowflake } from "../../utils";
import { loadYamlSafely } from "../../utils/loadYamlSafely";
import { ObjectAliasError } from "../../utils/validateNoObjectAliases";
import { hasGuildPermission, requireGuildPermission } from "../permissions";
import { clientError, ok, serverError, unauthorized } from "../responses";
import { Queue } from "../../Queue.js";
import { validateGuildConfig } from "../../configValidator.js";
import { AllowedGuilds } from "../../data/AllowedGuilds.js";
import { ApiAuditLog } from "../../data/ApiAuditLog.js";
import { ApiPermissionAssignments, ApiPermissionTypes } from "../../data/ApiPermissionAssignments.js";
import { Configs } from "../../data/Configs.js";
import { AuditLogEventTypes } from "../../data/apiAuditLogTypes.js";
import { isSnowflake } from "../../utils.js";
import { loadYamlSafely } from "../../utils/loadYamlSafely.js";
import { ObjectAliasError } from "../../utils/validateNoObjectAliases.js";
import { hasGuildPermission, requireGuildPermission } from "../permissions.js";
import { clientError, ok, serverError, unauthorized } from "../responses.js";
const YAMLException = jsYaml.YAMLException;
const apiPermissionAssignments = new ApiPermissionAssignments();
const auditLog = new ApiAuditLog();

View file

@ -1,10 +1,10 @@
// KEEP THIS AS FIRST IMPORT
// See comment in module for details
import "../threadsSignalFix";
import "../threadsSignalFix.js";
import { connect } from "../data/db";
import { env } from "../env";
import { setIsAPI } from "../globals";
import { connect } from "../data/db.js";
import { env } from "../env.js";
import { setIsAPI } from "../globals.js";
if (!env.KEY) {
// tslint:disable-next-line:no-console

View file

@ -1,8 +1,8 @@
import { ApiPermissions, hasPermission, permissionArrToSet } from "@zeppelinbot/shared";
import { Request, Response } from "express";
import { ApiPermissionAssignments } from "../data/ApiPermissionAssignments";
import { isStaff } from "../staff";
import { unauthorized } from "./responses";
import { ApiPermissionAssignments } from "../data/ApiPermissionAssignments.js";
import { isStaff } from "../staff.js";
import { unauthorized } from "./responses.js";
const apiPermissionAssignments = new ApiPermissionAssignments();

View file

@ -1,5 +1,5 @@
import { Request, Response } from "express";
import { error } from "./responses";
import { error } from "./responses.js";
const lastRequestsByKey: Map<string, number> = new Map();

View file

@ -1,6 +1,6 @@
import express, { Request, Response } from "express";
import { isStaff } from "../staff";
import { apiTokenAuthHandlers } from "./auth";
import { isStaff } from "../staff.js";
import { apiTokenAuthHandlers } from "./auth.js";
export function initStaff(app: express.Express) {
const staffRouter = express.Router();

View file

@ -2,13 +2,13 @@ import cors from "cors";
import express from "express";
import multer from "multer";
import { TokenError } from "passport-oauth2";
import { env } from "../env";
import { initArchives } from "./archives";
import { initAuth } from "./auth";
import { initDocs } from "./docs";
import { initGuildsAPI } from "./guilds/index";
import { clientError, error, notFound } from "./responses";
import { startBackgroundTasks } from "./tasks";
import { env } from "../env.js";
import { initArchives } from "./archives.js";
import { initAuth } from "./auth.js";
import { initDocs } from "./docs.js";
import { initGuildsAPI } from "./guilds/index.js";
import { clientError, error, notFound } from "./responses.js";
import { startBackgroundTasks } from "./tasks.js";
const apiPathPrefix = env.API_PATH_PREFIX || (env.NODE_ENV === "development" ? "/api" : "");

View file

@ -1,5 +1,5 @@
import { ApiPermissionAssignments } from "../data/ApiPermissionAssignments";
import { MINUTES } from "../utils";
import { ApiPermissionAssignments } from "../data/ApiPermissionAssignments.js";
import { MINUTES } from "../utils.js";
export function startBackgroundTasks() {
// Clear expired API permissions every minute

View file

@ -24,9 +24,9 @@ import {
resolveUserId,
roleMentionRegex,
UnknownUser,
} from "./utils";
import { isValidTimezone } from "./utils/isValidTimezone";
import { MessageTarget, resolveMessageTarget } from "./utils/resolveMessageTarget";
} from "./utils.js";
import { isValidTimezone } from "./utils/isValidTimezone.js";
import { MessageTarget, resolveMessageTarget } from "./utils/resolveMessageTarget.js";
export const commandTypes = {
...messageCommandBaseTypeConverters,

View file

@ -1,9 +1,9 @@
import { ConfigValidationError, GuildPluginBlueprint, PluginConfigManager } from "knub";
import moment from "moment-timezone";
import { ZodError } from "zod";
import { guildPlugins } from "./plugins/availablePlugins";
import { ZeppelinGuildConfig, zZeppelinGuildConfig } from "./types";
import { formatZodIssue } from "./utils/formatZodIssue";
import { guildPlugins } from "./plugins/availablePlugins.js";
import { ZeppelinGuildConfig, zZeppelinGuildConfig } from "./types.js";
import { formatZodIssue } from "./utils/formatZodIssue.js";
const pluginNameToPlugin = new Map<string, GuildPluginBlueprint<any, any>>();
for (const plugin of guildPlugins) {

View file

@ -1,10 +1,10 @@
import moment from "moment-timezone";
import { Repository } from "typeorm";
import { DBDateFormat } from "../utils";
import { ApiPermissionTypes } from "./ApiPermissionAssignments";
import { BaseRepository } from "./BaseRepository";
import { dataSource } from "./dataSource";
import { AllowedGuild } from "./entities/AllowedGuild";
import { DBDateFormat } from "../utils.js";
import { ApiPermissionTypes } from "./ApiPermissionAssignments.js";
import { BaseRepository } from "./BaseRepository.js";
import { dataSource } from "./dataSource.js";
import { AllowedGuild } from "./entities/AllowedGuild.js";
export class AllowedGuilds extends BaseRepository {
private allowedGuilds: Repository<AllowedGuild>;

View file

@ -1,8 +1,8 @@
import { Repository } from "typeorm/index";
import { BaseRepository } from "./BaseRepository";
import { AuditLogEventData, AuditLogEventType } from "./apiAuditLogTypes";
import { dataSource } from "./dataSource";
import { ApiAuditLogEntry } from "./entities/ApiAuditLogEntry";
import { Repository } from "typeorm";
import { BaseRepository } from "./BaseRepository.js";
import { AuditLogEventData, AuditLogEventType } from "./apiAuditLogTypes.js";
import { dataSource } from "./dataSource.js";
import { ApiAuditLogEntry } from "./entities/ApiAuditLogEntry.js";
export class ApiAuditLog extends BaseRepository {
private auditLog: Repository<ApiAuditLogEntry<any>>;

View file

@ -3,10 +3,10 @@ import moment from "moment-timezone";
import { Repository } from "typeorm";
// tslint:disable-next-line:no-submodule-imports
import { v4 as uuidv4 } from "uuid";
import { DAYS, DBDateFormat } from "../utils";
import { BaseRepository } from "./BaseRepository";
import { dataSource } from "./dataSource";
import { ApiLogin } from "./entities/ApiLogin";
import { DAYS, DBDateFormat } from "../utils.js";
import { BaseRepository } from "./BaseRepository.js";
import { dataSource } from "./dataSource.js";
import { ApiLogin } from "./entities/ApiLogin.js";
const LOGIN_EXPIRY_TIME = 1 * DAYS;

View file

@ -1,10 +1,10 @@
import { ApiPermissions } from "@zeppelinbot/shared";
import { Repository } from "typeorm";
import { ApiAuditLog } from "./ApiAuditLog";
import { BaseRepository } from "./BaseRepository";
import { AuditLogEventTypes } from "./apiAuditLogTypes";
import { dataSource } from "./dataSource";
import { ApiPermissionAssignment } from "./entities/ApiPermissionAssignment";
import { ApiAuditLog } from "./ApiAuditLog.js";
import { BaseRepository } from "./BaseRepository.js";
import { AuditLogEventTypes } from "./apiAuditLogTypes.js";
import { dataSource } from "./dataSource.js";
import { ApiPermissionAssignment } from "./entities/ApiPermissionAssignment.js";
export enum ApiPermissionTypes {
User = "USER",

View file

@ -1,9 +1,9 @@
import moment from "moment-timezone";
import { Repository } from "typeorm";
import { DBDateFormat } from "../utils";
import { BaseRepository } from "./BaseRepository";
import { dataSource } from "./dataSource";
import { ApiUserInfoData, ApiUserInfo as ApiUserInfoEntity } from "./entities/ApiUserInfo";
import { DBDateFormat } from "../utils.js";
import { BaseRepository } from "./BaseRepository.js";
import { dataSource } from "./dataSource.js";
import { ApiUserInfoData, ApiUserInfo as ApiUserInfoEntity } from "./entities/ApiUserInfo.js";
export class ApiUserInfo extends BaseRepository {
private apiUserInfo: Repository<ApiUserInfoEntity>;

View file

@ -1,7 +1,7 @@
import { Repository } from "typeorm";
import { BaseRepository } from "./BaseRepository";
import { dataSource } from "./dataSource";
import { ArchiveEntry } from "./entities/ArchiveEntry";
import { BaseRepository } from "./BaseRepository.js";
import { dataSource } from "./dataSource.js";
import { ArchiveEntry } from "./entities/ArchiveEntry.js";
export class Archives extends BaseRepository {
protected archives: Repository<ArchiveEntry>;

View file

@ -1,4 +1,4 @@
import { BaseRepository } from "./BaseRepository";
import { BaseRepository } from "./BaseRepository.js";
export class BaseGuildRepository<TEntity = unknown> extends BaseRepository<TEntity> {
private static guildInstances: Map<string, any>;

View file

@ -1,4 +1,4 @@
import { asyncMap } from "../utils/async";
import { asyncMap } from "../utils/async.js";
export class BaseRepository<TEntity = unknown> {
private nextRelations: string[];

View file

@ -1,10 +1,10 @@
import { Repository } from "typeorm";
import { isAPI } from "../globals";
import { HOURS, SECONDS } from "../utils";
import { BaseRepository } from "./BaseRepository";
import { cleanupConfigs } from "./cleanup/configs";
import { dataSource } from "./dataSource";
import { Config } from "./entities/Config";
import { isAPI } from "../globals.js";
import { HOURS, SECONDS } from "../utils.js";
import { BaseRepository } from "./BaseRepository.js";
import { cleanupConfigs } from "./cleanup/configs.js";
import { dataSource } from "./dataSource.js";
import { Config } from "./entities/Config.js";
const CLEANUP_INTERVAL = 1 * HOURS;

View file

@ -1,7 +1,7 @@
import { Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { AntiraidLevel } from "./entities/AntiraidLevel";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { AntiraidLevel } from "./entities/AntiraidLevel.js";
export class GuildAntiraidLevels extends BaseGuildRepository {
protected antiraidLevels: Repository<AntiraidLevel>;

View file

@ -1,15 +1,15 @@
import { Guild, Snowflake } from "discord.js";
import moment from "moment-timezone";
import { Repository } from "typeorm";
import { TemplateSafeValueContainer, renderTemplate } from "../templateFormatter";
import { renderUsername, trimLines } from "../utils";
import { decrypt, encrypt } from "../utils/crypt";
import { isDefaultSticker } from "../utils/isDefaultSticker";
import { channelToTemplateSafeChannel, guildToTemplateSafeGuild } from "../utils/templateSafeObjects";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { ArchiveEntry } from "./entities/ArchiveEntry";
import { SavedMessage } from "./entities/SavedMessage";
import { TemplateSafeValueContainer, renderTemplate } from "../templateFormatter.js";
import { renderUsername, trimLines } from "../utils.js";
import { decrypt, encrypt } from "../utils/crypt.js";
import { isDefaultSticker } from "../utils/isDefaultSticker.js";
import { channelToTemplateSafeChannel, guildToTemplateSafeGuild } from "../utils/templateSafeObjects.js";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { ArchiveEntry } from "./entities/ArchiveEntry.js";
import { SavedMessage } from "./entities/SavedMessage.js";
const DEFAULT_EXPIRY_DAYS = 30;

View file

@ -1,7 +1,7 @@
import { Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { AutoReaction } from "./entities/AutoReaction";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { AutoReaction } from "./entities/AutoReaction.js";
export class GuildAutoReactions extends BaseGuildRepository {
private autoReactions: Repository<AutoReaction>;

View file

@ -1,6 +1,6 @@
import { getRepository, Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { ButtonRole } from "./entities/ButtonRole";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { ButtonRole } from "./entities/ButtonRole.js";
export class GuildButtonRoles extends BaseGuildRepository {
private buttonRoles: Repository<ButtonRole>;

View file

@ -1,11 +1,11 @@
import { In, InsertResult, Repository } from "typeorm";
import { Queue } from "../Queue";
import { chunkArray } from "../utils";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { CaseTypes } from "./CaseTypes";
import { dataSource } from "./dataSource";
import { Case } from "./entities/Case";
import { CaseNote } from "./entities/CaseNote";
import { Queue } from "../Queue.js";
import { chunkArray } from "../utils.js";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { CaseTypes } from "./CaseTypes.js";
import { dataSource } from "./dataSource.js";
import { Case } from "./entities/Case.js";
import { CaseNote } from "./entities/CaseNote.js";
export class GuildCases extends BaseGuildRepository {
private cases: Repository<Case>;

View file

@ -1,7 +1,7 @@
import { DeleteResult, InsertResult, Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { ContextMenuLink } from "./entities/ContextMenuLink";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { ContextMenuLink } from "./entities/ContextMenuLink.js";
export class GuildContextMenuLinks extends BaseGuildRepository {
private contextLinks: Repository<ContextMenuLink>;

View file

@ -1,13 +1,13 @@
import moment from "moment-timezone";
import { FindOptionsWhere, In, IsNull, Not, Repository } from "typeorm";
import { Queue } from "../Queue";
import { DAYS, DBDateFormat, HOURS, MINUTES } from "../utils";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { Counter } from "./entities/Counter";
import { CounterTrigger, TriggerComparisonOp, isValidCounterComparisonOp } from "./entities/CounterTrigger";
import { CounterTriggerState } from "./entities/CounterTriggerState";
import { CounterValue } from "./entities/CounterValue";
import { Queue } from "../Queue.js";
import { DAYS, DBDateFormat, HOURS, MINUTES } from "../utils.js";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { Counter } from "./entities/Counter.js";
import { CounterTrigger, TriggerComparisonOp, isValidCounterComparisonOp } from "./entities/CounterTrigger.js";
import { CounterTriggerState } from "./entities/CounterTriggerState.js";
import { CounterValue } from "./entities/CounterValue.js";
const DELETE_UNUSED_COUNTERS_AFTER = 1 * DAYS;
const DELETE_UNUSED_COUNTER_TRIGGERS_AFTER = 1 * DAYS;

View file

@ -1,8 +1,8 @@
import { Mute } from "./entities/Mute";
import { Reminder } from "./entities/Reminder";
import { ScheduledPost } from "./entities/ScheduledPost";
import { Tempban } from "./entities/Tempban";
import { VCAlert } from "./entities/VCAlert";
import { Mute } from "./entities/Mute.js";
import { Reminder } from "./entities/Reminder.js";
import { ScheduledPost } from "./entities/ScheduledPost.js";
import { Tempban } from "./entities/Tempban.js";
import { VCAlert } from "./entities/VCAlert.js";
interface GuildEventArgs extends Record<string, unknown[]> {
expiredMute: [Mute];

View file

@ -1,5 +1,5 @@
import * as events from "events";
import { LogType } from "./LogType";
import { LogType } from "./LogType.js";
// Use the same instance for the same guild, even if a new instance is created
const guildInstances: Map<string, GuildLogs> = new Map();

View file

@ -1,10 +1,10 @@
import moment from "moment-timezone";
import { Repository } from "typeorm";
import { Blocker } from "../Blocker";
import { DBDateFormat, MINUTES } from "../utils";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { MemberCacheItem } from "./entities/MemberCacheItem";
import { Blocker } from "../Blocker.js";
import { DBDateFormat, MINUTES } from "../utils.js";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { MemberCacheItem } from "./entities/MemberCacheItem.js";
const SAVE_PENDING_BLOCKER_KEY = "save-pending" as const;

View file

@ -1,7 +1,7 @@
import { Repository } from "typeorm/index";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { MemberTimezone } from "./entities/MemberTimezone";
import { Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { MemberTimezone } from "./entities/MemberTimezone.js";
export class GuildMemberTimezones extends BaseGuildRepository {
protected memberTimezones: Repository<MemberTimezone>;

View file

@ -1,10 +1,10 @@
import moment from "moment-timezone";
import { Brackets, Repository } from "typeorm";
import { DBDateFormat } from "../utils";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { MuteTypes } from "./MuteTypes";
import { dataSource } from "./dataSource";
import { Mute } from "./entities/Mute";
import { DBDateFormat } from "../utils.js";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { MuteTypes } from "./MuteTypes.js";
import { dataSource } from "./dataSource.js";
import { Mute } from "./entities/Mute.js";
export type AddMuteParams = {
userId: Mute["user_id"];

View file

@ -1,10 +1,10 @@
import { In, Repository } from "typeorm";
import { isAPI } from "../globals";
import { MINUTES, SECONDS } from "../utils";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { cleanupNicknames } from "./cleanup/nicknames";
import { dataSource } from "./dataSource";
import { NicknameHistoryEntry } from "./entities/NicknameHistoryEntry";
import { isAPI } from "../globals.js";
import { MINUTES, SECONDS } from "../utils.js";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { cleanupNicknames } from "./cleanup/nicknames.js";
import { dataSource } from "./dataSource.js";
import { NicknameHistoryEntry } from "./entities/NicknameHistoryEntry.js";
const CLEANUP_INTERVAL = 5 * MINUTES;

View file

@ -1,7 +1,7 @@
import { Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { PersistedData } from "./entities/PersistedData";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { PersistedData } from "./entities/PersistedData.js";
export class GuildPersistedData extends BaseGuildRepository {
private persistedData: Repository<PersistedData>;

View file

@ -1,7 +1,7 @@
import { Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { PingableRole } from "./entities/PingableRole";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { PingableRole } from "./entities/PingableRole.js";
export class GuildPingableRoles extends BaseGuildRepository {
private pingableRoles: Repository<PingableRole>;

View file

@ -1,7 +1,7 @@
import { Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { ReactionRole } from "./entities/ReactionRole";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { ReactionRole } from "./entities/ReactionRole.js";
export class GuildReactionRoles extends BaseGuildRepository {
private reactionRoles: Repository<ReactionRole>;

View file

@ -1,7 +1,7 @@
import { Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { Reminder } from "./entities/Reminder";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { Reminder } from "./entities/Reminder.js";
export class GuildReminders extends BaseGuildRepository {
private reminders: Repository<Reminder>;

View file

@ -1,7 +1,7 @@
import { Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { RoleButtonsItem } from "./entities/RoleButtonsItem";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { RoleButtonsItem } from "./entities/RoleButtonsItem.js";
export class GuildRoleButtons extends BaseGuildRepository {
private roleButtons: Repository<RoleButtonsItem>;

View file

@ -1,7 +1,7 @@
import { Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { RoleQueueItem } from "./entities/RoleQueueItem";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { RoleQueueItem } from "./entities/RoleQueueItem.js";
export class GuildRoleQueue extends BaseGuildRepository {
private roleQueue: Repository<RoleQueueItem>;

View file

@ -1,14 +1,14 @@
import { GuildChannel, Message } from "discord.js";
import moment from "moment-timezone";
import { Repository } from "typeorm";
import { QueuedEventEmitter } from "../QueuedEventEmitter";
import { noop } from "../utils";
import { asyncMap } from "../utils/async";
import { decryptJson, encryptJson } from "../utils/cryptHelpers";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { buildEntity } from "./buildEntity";
import { dataSource } from "./dataSource";
import { ISavedMessageData, SavedMessage } from "./entities/SavedMessage";
import { QueuedEventEmitter } from "../QueuedEventEmitter.js";
import { noop } from "../utils.js";
import { asyncMap } from "../utils/async.js";
import { decryptJson, encryptJson } from "../utils/cryptHelpers.js";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { buildEntity } from "./buildEntity.js";
import { dataSource } from "./dataSource.js";
import { ISavedMessageData, SavedMessage } from "./entities/SavedMessage.js";
export class GuildSavedMessages extends BaseGuildRepository<SavedMessage> {
private messages: Repository<SavedMessage>;

View file

@ -1,7 +1,7 @@
import { Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { ScheduledPost } from "./entities/ScheduledPost";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { ScheduledPost } from "./entities/ScheduledPost.js";
export class GuildScheduledPosts extends BaseGuildRepository {
private scheduledPosts: Repository<ScheduledPost>;

View file

@ -1,9 +1,9 @@
import moment from "moment-timezone";
import { Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { SlowmodeChannel } from "./entities/SlowmodeChannel";
import { SlowmodeUser } from "./entities/SlowmodeUser";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { SlowmodeChannel } from "./entities/SlowmodeChannel.js";
import { SlowmodeUser } from "./entities/SlowmodeUser.js";
export class GuildSlowmodes extends BaseGuildRepository {
private slowmodeChannels: Repository<SlowmodeChannel>;

View file

@ -1,7 +1,7 @@
import { Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { StarboardMessage } from "./entities/StarboardMessage";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { StarboardMessage } from "./entities/StarboardMessage.js";
export class GuildStarboardMessages extends BaseGuildRepository {
private allStarboardMessages: Repository<StarboardMessage>;

View file

@ -1,7 +1,7 @@
import { Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { StarboardReaction } from "./entities/StarboardReaction";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { StarboardReaction } from "./entities/StarboardReaction.js";
export class GuildStarboardReactions extends BaseGuildRepository {
private allStarboardReactions: Repository<StarboardReaction>;

View file

@ -1,7 +1,7 @@
import { Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { StatValue } from "./entities/StatValue";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { StatValue } from "./entities/StatValue.js";
export class GuildStats extends BaseGuildRepository {
private stats: Repository<StatValue>;

View file

@ -1,8 +1,8 @@
import { Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { Tag } from "./entities/Tag";
import { TagResponse } from "./entities/TagResponse";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { Tag } from "./entities/Tag.js";
import { TagResponse } from "./entities/TagResponse.js";
export class GuildTags extends BaseGuildRepository {
private tags: Repository<Tag>;

View file

@ -1,8 +1,8 @@
import moment from "moment-timezone";
import { Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { Tempban } from "./entities/Tempban";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { Tempban } from "./entities/Tempban.js";
export class GuildTempbans extends BaseGuildRepository {
private tempbans: Repository<Tempban>;

View file

@ -1,7 +1,7 @@
import { Repository } from "typeorm";
import { BaseGuildRepository } from "./BaseGuildRepository";
import { dataSource } from "./dataSource";
import { VCAlert } from "./entities/VCAlert";
import { BaseGuildRepository } from "./BaseGuildRepository.js";
import { dataSource } from "./dataSource.js";
import { VCAlert } from "./entities/VCAlert.js";
export class GuildVCAlerts extends BaseGuildRepository {
private allAlerts: Repository<VCAlert>;

View file

@ -1,9 +1,9 @@
import moment from "moment-timezone";
import { Repository } from "typeorm";
import { DAYS } from "../utils";
import { BaseRepository } from "./BaseRepository";
import { dataSource } from "./dataSource";
import { MemberCacheItem } from "./entities/MemberCacheItem";
import { DAYS } from "../utils.js";
import { BaseRepository } from "./BaseRepository.js";
import { dataSource } from "./dataSource.js";
import { MemberCacheItem } from "./entities/MemberCacheItem.js";
const STALE_PERIOD = 90 * DAYS;

View file

@ -1,10 +1,10 @@
import moment from "moment-timezone";
import { Repository } from "typeorm";
import { DAYS, DBDateFormat } from "../utils";
import { BaseRepository } from "./BaseRepository";
import { MuteTypes } from "./MuteTypes";
import { dataSource } from "./dataSource";
import { Mute } from "./entities/Mute";
import { DAYS, DBDateFormat } from "../utils.js";
import { BaseRepository } from "./BaseRepository.js";
import { MuteTypes } from "./MuteTypes.js";
import { dataSource } from "./dataSource.js";
import { Mute } from "./entities/Mute.js";
const OLD_EXPIRED_MUTE_THRESHOLD = 7 * DAYS;

View file

@ -1,12 +1,12 @@
import crypto from "crypto";
import moment from "moment-timezone";
import { Repository } from "typeorm";
import { env } from "../env";
import { DAYS, DBDateFormat, HOURS, MINUTES } from "../utils";
import { dataSource } from "./dataSource";
import { PhishermanCacheEntry } from "./entities/PhishermanCacheEntry";
import { PhishermanKeyCacheEntry } from "./entities/PhishermanKeyCacheEntry";
import { PhishermanDomainInfo, PhishermanUnknownDomain } from "./types/phisherman";
import { env } from "../env.js";
import { DAYS, DBDateFormat, HOURS, MINUTES } from "../utils.js";
import { dataSource } from "./dataSource.js";
import { PhishermanCacheEntry } from "./entities/PhishermanCacheEntry.js";
import { PhishermanKeyCacheEntry } from "./entities/PhishermanKeyCacheEntry.js";
import { PhishermanDomainInfo, PhishermanUnknownDomain } from "./types/phisherman.js";
const API_URL = "https://api.phisherman.gg";
const MASTER_API_KEY = env.PHISHERMAN_API_KEY;

View file

@ -1,9 +1,9 @@
import moment from "moment-timezone";
import { Repository } from "typeorm";
import { DBDateFormat } from "../utils";
import { BaseRepository } from "./BaseRepository";
import { dataSource } from "./dataSource";
import { Reminder } from "./entities/Reminder";
import { DBDateFormat } from "../utils.js";
import { BaseRepository } from "./BaseRepository.js";
import { dataSource } from "./dataSource.js";
import { Reminder } from "./entities/Reminder.js";
export class Reminders extends BaseRepository {
private reminders: Repository<Reminder>;

View file

@ -1,9 +1,9 @@
import moment from "moment-timezone";
import { Repository } from "typeorm";
import { DBDateFormat } from "../utils";
import { BaseRepository } from "./BaseRepository";
import { dataSource } from "./dataSource";
import { ScheduledPost } from "./entities/ScheduledPost";
import { DBDateFormat } from "../utils.js";
import { BaseRepository } from "./BaseRepository.js";
import { dataSource } from "./dataSource.js";
import { ScheduledPost } from "./entities/ScheduledPost.js";
export class ScheduledPosts extends BaseRepository {
private scheduledPosts: Repository<ScheduledPost>;

View file

@ -1,7 +1,7 @@
import { Repository } from "typeorm";
import { BaseRepository } from "./BaseRepository";
import { dataSource } from "./dataSource";
import { Supporter } from "./entities/Supporter";
import { BaseRepository } from "./BaseRepository.js";
import { dataSource } from "./dataSource.js";
import { Supporter } from "./entities/Supporter.js";
export class Supporters extends BaseRepository {
private supporters: Repository<Supporter>;

View file

@ -1,9 +1,9 @@
import moment from "moment-timezone";
import { Repository } from "typeorm";
import { DBDateFormat } from "../utils";
import { BaseRepository } from "./BaseRepository";
import { dataSource } from "./dataSource";
import { Tempban } from "./entities/Tempban";
import { DBDateFormat } from "../utils.js";
import { BaseRepository } from "./BaseRepository.js";
import { dataSource } from "./dataSource.js";
import { Tempban } from "./entities/Tempban.js";
export class Tempbans extends BaseRepository {
private tempbans: Repository<Tempban>;

View file

@ -1,10 +1,10 @@
import { In, Repository } from "typeorm";
import { isAPI } from "../globals";
import { MINUTES, SECONDS } from "../utils";
import { BaseRepository } from "./BaseRepository";
import { cleanupUsernames } from "./cleanup/usernames";
import { dataSource } from "./dataSource";
import { UsernameHistoryEntry } from "./entities/UsernameHistoryEntry";
import { isAPI } from "../globals.js";
import { MINUTES, SECONDS } from "../utils.js";
import { BaseRepository } from "./BaseRepository.js";
import { cleanupUsernames } from "./cleanup/usernames.js";
import { dataSource } from "./dataSource.js";
import { UsernameHistoryEntry } from "./entities/UsernameHistoryEntry.js";
const CLEANUP_INTERVAL = 5 * MINUTES;

View file

@ -1,9 +1,9 @@
import moment from "moment-timezone";
import { Repository } from "typeorm";
import { DBDateFormat } from "../utils";
import { BaseRepository } from "./BaseRepository";
import { dataSource } from "./dataSource";
import { VCAlert } from "./entities/VCAlert";
import { DBDateFormat } from "../utils.js";
import { BaseRepository } from "./BaseRepository.js";
import { dataSource } from "./dataSource.js";
import { VCAlert } from "./entities/VCAlert.js";
export class VCAlerts extends BaseRepository {
private allAlerts: Repository<VCAlert>;

View file

@ -1,8 +1,8 @@
import { Repository } from "typeorm";
import { decrypt, encrypt } from "../utils/crypt";
import { BaseRepository } from "./BaseRepository";
import { dataSource } from "./dataSource";
import { Webhook } from "./entities/Webhook";
import { decrypt, encrypt } from "../utils/crypt.js";
import { BaseRepository } from "./BaseRepository.js";
import { dataSource } from "./dataSource.js";
import { Webhook } from "./entities/Webhook.js";
export class Webhooks extends BaseRepository {
repository: Repository<Webhook> = dataSource.getRepository(Webhook);

View file

@ -1,4 +1,4 @@
import { ApiPermissionTypes } from "./ApiPermissionAssignments";
import { ApiPermissionTypes } from "./ApiPermissionAssignments.js";
export const AuditLogEventTypes = {
ADD_API_PERMISSION: "ADD_API_PERMISSION" as const,

View file

@ -1,8 +1,8 @@
import moment from "moment-timezone";
import { In } from "typeorm";
import { DBDateFormat } from "../../utils";
import { dataSource } from "../dataSource";
import { Config } from "../entities/Config";
import { DBDateFormat } from "../../utils.js";
import { dataSource } from "../dataSource.js";
import { Config } from "../entities/Config.js";
const CLEAN_PER_LOOP = 50;

View file

@ -1,8 +1,8 @@
import moment from "moment-timezone";
import { In } from "typeorm";
import { DAYS, DBDateFormat, MINUTES, SECONDS, sleep } from "../../utils";
import { dataSource } from "../dataSource";
import { SavedMessage } from "../entities/SavedMessage";
import { DAYS, DBDateFormat, MINUTES, SECONDS, sleep } from "../../utils.js";
import { dataSource } from "../dataSource.js";
import { SavedMessage } from "../entities/SavedMessage.js";
/**
* How long message edits, deletions, etc. will include the original message content.

View file

@ -1,8 +1,8 @@
import moment from "moment-timezone";
import { In } from "typeorm";
import { DAYS, DBDateFormat } from "../../utils";
import { dataSource } from "../dataSource";
import { NicknameHistoryEntry } from "../entities/NicknameHistoryEntry";
import { DAYS, DBDateFormat } from "../../utils.js";
import { dataSource } from "../dataSource.js";
import { NicknameHistoryEntry } from "../entities/NicknameHistoryEntry.js";
export const NICKNAME_RETENTION_PERIOD = 30 * DAYS;
const CLEAN_PER_LOOP = 500;

View file

@ -1,8 +1,8 @@
import moment from "moment-timezone";
import { In } from "typeorm";
import { DAYS, DBDateFormat } from "../../utils";
import { dataSource } from "../dataSource";
import { UsernameHistoryEntry } from "../entities/UsernameHistoryEntry";
import { DAYS, DBDateFormat } from "../../utils.js";
import { dataSource } from "../dataSource.js";
import { UsernameHistoryEntry } from "../entities/UsernameHistoryEntry.js";
export const USERNAME_RETENTION_PERIOD = 30 * DAYS;
const CLEAN_PER_LOOP = 500;

View file

@ -1,8 +1,8 @@
import moment from "moment-timezone";
import path from "path";
import { DataSource } from "typeorm";
import { env } from "../env";
import { backendDir } from "../paths";
import { env } from "../env.js";
import { backendDir } from "../paths.js";
moment.tz.setDefault("UTC");

View file

@ -1,5 +1,5 @@
import { SimpleError } from "../SimpleError";
import { dataSource } from "./dataSource";
import { SimpleError } from "../SimpleError.js";
import { dataSource } from "./dataSource.js";
let connectionPromise: Promise<void>;

View file

@ -1,5 +1,5 @@
import { Column, Entity, PrimaryColumn } from "typeorm";
import { AuditLogEventData, AuditLogEventType } from "../apiAuditLogTypes";
import { AuditLogEventData, AuditLogEventType } from "../apiAuditLogTypes.js";
@Entity("api_audit_log")
export class ApiAuditLogEntry<TEventType extends AuditLogEventType> {

View file

@ -1,5 +1,5 @@
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
import { ApiUserInfo } from "./ApiUserInfo";
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn, Relation } from "typeorm";
import { ApiUserInfo } from "./ApiUserInfo.js";
@Entity("api_logins")
export class ApiLogin {
@ -21,5 +21,5 @@ export class ApiLogin {
@ManyToOne(() => ApiUserInfo, (userInfo) => userInfo.logins)
@JoinColumn({ name: "user_id" })
userInfo: ApiUserInfo;
userInfo: Relation<ApiUserInfo>;
}

View file

@ -1,6 +1,6 @@
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
import { ApiPermissionTypes } from "../ApiPermissionAssignments";
import { ApiUserInfo } from "./ApiUserInfo";
import { ApiPermissionTypes } from "../ApiPermissionAssignments.js";
import { ApiUserInfo } from "./ApiUserInfo.js";
@Entity("api_permissions")
export class ApiPermissionAssignment {

View file

@ -1,6 +1,6 @@
import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm";
import { ApiLogin } from "./ApiLogin";
import { ApiPermissionAssignment } from "./ApiPermissionAssignment";
import { Column, Entity, OneToMany, PrimaryColumn, Relation } from "typeorm";
import { ApiLogin } from "./ApiLogin.js";
import { ApiPermissionAssignment } from "./ApiPermissionAssignment.js";
export interface ApiUserInfoData {
username: string;
@ -21,8 +21,8 @@ export class ApiUserInfo {
updated_at: string;
@OneToMany(() => ApiLogin, (login) => login.userInfo)
logins: ApiLogin[];
logins: Relation<ApiLogin[]>;
@OneToMany(() => ApiPermissionAssignment, (p) => p.userInfo)
permissionAssignments: ApiPermissionAssignment[];
permissionAssignments: Relation<ApiPermissionAssignment[]>;
}

View file

@ -1,5 +1,5 @@
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { CaseNote } from "./CaseNote";
import { Column, Entity, OneToMany, PrimaryGeneratedColumn, Relation } from "typeorm";
import { CaseNote } from "./CaseNote.js";
@Entity("cases")
export class Case {
@ -36,5 +36,5 @@ export class Case {
@Column({ type: String, nullable: true }) log_message_id: string | null;
@OneToMany(() => CaseNote, (note) => note.case)
notes: CaseNote[];
notes: Relation<CaseNote[]>;
}

View file

@ -1,5 +1,5 @@
import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
import { Case } from "./Case";
import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, Relation } from "typeorm";
import { Case } from "./Case.js";
@Entity("case_notes")
export class CaseNote {
@ -17,5 +17,5 @@ export class CaseNote {
@ManyToOne(() => Case, (theCase) => theCase.notes)
@JoinColumn({ name: "case_id" })
case: Case;
case: Relation<Case>;
}

View file

@ -1,5 +1,5 @@
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
import { ApiUserInfo } from "./ApiUserInfo";
import { ApiUserInfo } from "./ApiUserInfo.js";
@Entity("configs")
export class Config {

View file

@ -1,5 +1,5 @@
import { Column, Entity, PrimaryColumn } from "typeorm";
import { PhishermanDomainInfo } from "../types/phisherman";
import { PhishermanDomainInfo } from "../types/phisherman.js";
@Entity("phisherman_cache")
export class PhishermanCacheEntry {

View file

@ -1,4 +1,4 @@
import { Snowflake, StickerFormatType, StickerType } from "discord.js";
import { EmbedType, Snowflake, StickerFormatType, StickerType } from "discord.js";
import { Column, Entity, PrimaryColumn } from "typeorm";
export interface ISavedMessageAttachmentData {
@ -14,6 +14,7 @@ export interface ISavedMessageAttachmentData {
export interface ISavedMessageEmbedData {
title: string | null;
type?: EmbedType;
description: string | null;
url: string | null;
timestamp: number | null;

View file

@ -1,6 +1,6 @@
import { Attachment } from "discord.js";
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
import { StrictMessageContent } from "../../utils";
import { StrictMessageContent } from "../../utils.js";
@Entity("scheduled_posts")
export class ScheduledPost {

View file

@ -1,5 +1,5 @@
import { Column, Entity, JoinColumn, OneToOne, PrimaryColumn } from "typeorm";
import { SavedMessage } from "./SavedMessage";
import { SavedMessage } from "./SavedMessage.js";
@Entity("starboard_messages")
export class StarboardMessage {

View file

@ -1,5 +1,5 @@
import { Column, Entity, JoinColumn, OneToOne, PrimaryColumn } from "typeorm";
import { SavedMessage } from "./SavedMessage";
import { SavedMessage } from "./SavedMessage.js";
@Entity("starboard_reactions")
export class StarboardReaction {

View file

@ -1,6 +1,6 @@
import { Repository } from "typeorm";
import { dataSource } from "./dataSource";
import { SavedMessage } from "./entities/SavedMessage";
import { dataSource } from "./dataSource.js";
import { SavedMessage } from "./entities/SavedMessage.js";
let repository: Repository<SavedMessage>;

View file

@ -1,7 +1,7 @@
// tslint:disable:no-console
import { lazyMemoize, MINUTES } from "../../utils";
import { Archives } from "../Archives";
import { lazyMemoize, MINUTES } from "../../utils.js";
import { Archives } from "../Archives.js";
const LOOP_INTERVAL = 15 * MINUTES;
const getArchivesRepository = lazyMemoize(() => new Archives());

View file

@ -1,7 +1,7 @@
// tslint:disable:no-console
import { HOURS, lazyMemoize } from "../../utils";
import { MemberCache } from "../MemberCache";
import { HOURS, lazyMemoize } from "../../utils.js";
import { MemberCache } from "../MemberCache.js";
const LOOP_INTERVAL = 6 * HOURS;
const getMemberCacheRepository = lazyMemoize(() => new MemberCache());

View file

@ -1,10 +1,10 @@
// tslint:disable:no-console
import moment from "moment-timezone";
import { lazyMemoize, MINUTES, SECONDS } from "../../utils";
import { Mute } from "../entities/Mute";
import { emitGuildEvent, hasGuildEventListener } from "../GuildEvents";
import { Mutes, TIMEOUT_RENEWAL_THRESHOLD } from "../Mutes";
import { lazyMemoize, MINUTES, SECONDS } from "../../utils.js";
import { Mute } from "../entities/Mute.js";
import { emitGuildEvent, hasGuildEventListener } from "../GuildEvents.js";
import { Mutes, TIMEOUT_RENEWAL_THRESHOLD } from "../Mutes.js";
import Timeout = NodeJS.Timeout;
const LOOP_INTERVAL = 15 * MINUTES;

View file

@ -1,10 +1,10 @@
// tslint:disable:no-console
import moment from "moment-timezone";
import { lazyMemoize, MINUTES } from "../../utils";
import { Tempban } from "../entities/Tempban";
import { emitGuildEvent, hasGuildEventListener } from "../GuildEvents";
import { Tempbans } from "../Tempbans";
import { lazyMemoize, MINUTES } from "../../utils.js";
import { Tempban } from "../entities/Tempban.js";
import { emitGuildEvent, hasGuildEventListener } from "../GuildEvents.js";
import { Tempbans } from "../Tempbans.js";
import Timeout = NodeJS.Timeout;
const LOOP_INTERVAL = 15 * MINUTES;

View file

@ -1,10 +1,10 @@
// tslint:disable:no-console
import moment from "moment-timezone";
import { lazyMemoize, MINUTES } from "../../utils";
import { VCAlert } from "../entities/VCAlert";
import { emitGuildEvent, hasGuildEventListener } from "../GuildEvents";
import { VCAlerts } from "../VCAlerts";
import { lazyMemoize, MINUTES } from "../../utils.js";
import { VCAlert } from "../entities/VCAlert.js";
import { emitGuildEvent, hasGuildEventListener } from "../GuildEvents.js";
import { VCAlerts } from "../VCAlerts.js";
import Timeout = NodeJS.Timeout;
const LOOP_INTERVAL = 15 * MINUTES;

View file

@ -1,7 +1,7 @@
// tslint:disable:no-console
import { lazyMemoize, MINUTES } from "../../utils";
import { MemberCache } from "../MemberCache";
import { lazyMemoize, MINUTES } from "../../utils.js";
import { MemberCache } from "../MemberCache.js";
const LOOP_INTERVAL = 5 * MINUTES;
const getMemberCacheRepository = lazyMemoize(() => new MemberCache());

View file

@ -1,11 +1,11 @@
// tslint:disable:no-console
import { MINUTES } from "../../utils";
import { MINUTES } from "../../utils.js";
import {
deleteStalePhishermanCacheEntries,
deleteStalePhishermanKeyCacheEntries,
reportTrackedDomainsToPhisherman,
} from "../Phisherman";
} from "../Phisherman.js";
const CACHE_CLEANUP_LOOP_INTERVAL = 15 * MINUTES;
const REPORT_LOOP_INTERVAL = 15 * MINUTES;

View file

@ -1,7 +1,7 @@
// tslint:disable:no-console
import { MINUTES } from "../../utils";
import { cleanupMessages } from "../cleanup/messages";
import { MINUTES } from "../../utils.js";
import { cleanupMessages } from "../cleanup/messages.js";
const LOOP_INTERVAL = 5 * MINUTES;

View file

@ -1,10 +1,10 @@
// tslint:disable:no-console
import moment from "moment-timezone";
import { lazyMemoize, MINUTES } from "../../utils";
import { Reminder } from "../entities/Reminder";
import { emitGuildEvent, hasGuildEventListener } from "../GuildEvents";
import { Reminders } from "../Reminders";
import { lazyMemoize, MINUTES } from "../../utils.js";
import { Reminder } from "../entities/Reminder.js";
import { emitGuildEvent, hasGuildEventListener } from "../GuildEvents.js";
import { Reminders } from "../Reminders.js";
import Timeout = NodeJS.Timeout;
const LOOP_INTERVAL = 15 * MINUTES;

View file

@ -1,10 +1,10 @@
// tslint:disable:no-console
import moment from "moment-timezone";
import { lazyMemoize, MINUTES } from "../../utils";
import { ScheduledPost } from "../entities/ScheduledPost";
import { emitGuildEvent, hasGuildEventListener } from "../GuildEvents";
import { ScheduledPosts } from "../ScheduledPosts";
import { lazyMemoize, MINUTES } from "../../utils.js";
import { ScheduledPost } from "../entities/ScheduledPost.js";
import { emitGuildEvent, hasGuildEventListener } from "../GuildEvents.js";
import { ScheduledPosts } from "../ScheduledPosts.js";
import Timeout = NodeJS.Timeout;
const LOOP_INTERVAL = 15 * MINUTES;

View file

@ -1,4 +1,4 @@
import { AdvancedConsoleLogger } from "typeorm/logger/AdvancedConsoleLogger";
import { AdvancedConsoleLogger } from "typeorm";
let groupedQueryStats: Map<string, number> = new Map();

View file

@ -2,7 +2,7 @@ import dotenv from "dotenv";
import fs from "fs";
import path from "path";
import { z } from "zod";
import { rootDir } from "./paths";
import { rootDir } from "./paths.js";
const envType = z.object({
KEY: z.string().length(32),

View file

@ -1,7 +1,7 @@
import { z } from "zod";
import zodToJsonSchema from "zod-to-json-schema";
import { guildPluginInfo } from "./plugins/pluginInfo";
import { zZeppelinGuildConfig } from "./types";
import { zodToJsonSchema } from "zod-to-json-schema";
import { guildPluginInfo } from "./plugins/pluginInfo.js";
import { zZeppelinGuildConfig } from "./types.js";
const pluginSchemaMap = Object.entries(guildPluginInfo).reduce((map, [pluginName, pluginInfo]) => {
if (pluginInfo.configSchema) {

View file

@ -1,6 +1,6 @@
// KEEP THIS AS FIRST IMPORT
// See comment in module for details
import "./threadsSignalFix";
import "./threadsSignalFix.js";
import {
Client,
@ -17,37 +17,37 @@ import { Knub, PluginError, PluginLoadError, PluginNotLoadedError } from "knub";
import moment from "moment-timezone";
import { performance } from "perf_hooks";
import process from "process";
import { DiscordJSError } from "./DiscordJSError";
import { RecoverablePluginError } from "./RecoverablePluginError";
import { SimpleError } from "./SimpleError";
import { AllowedGuilds } from "./data/AllowedGuilds";
import { Configs } from "./data/Configs";
import { GuildLogs } from "./data/GuildLogs";
import { LogType } from "./data/LogType";
import { hasPhishermanMasterAPIKey } from "./data/Phisherman";
import { dataSource } from "./data/dataSource";
import { connect } from "./data/db";
import { runExpiredArchiveDeletionLoop } from "./data/loops/expiredArchiveDeletionLoop";
import { runExpiredMemberCacheDeletionLoop } from "./data/loops/expiredMemberCacheDeletionLoop";
import { runExpiringMutesLoop } from "./data/loops/expiringMutesLoop";
import { runExpiringTempbansLoop } from "./data/loops/expiringTempbansLoop";
import { runExpiringVCAlertsLoop } from "./data/loops/expiringVCAlertsLoop";
import { runMemberCacheDeletionLoop } from "./data/loops/memberCacheDeletionLoop";
import { runPhishermanCacheCleanupLoop, runPhishermanReportingLoop } from "./data/loops/phishermanLoops";
import { runSavedMessageCleanupLoop } from "./data/loops/savedMessageCleanupLoop";
import { runUpcomingRemindersLoop } from "./data/loops/upcomingRemindersLoop";
import { runUpcomingScheduledPostsLoop } from "./data/loops/upcomingScheduledPostsLoop";
import { consumeQueryStats } from "./data/queryLogger";
import { env } from "./env";
import { logger } from "./logger";
import { baseGuildPlugins, globalPlugins, guildPlugins } from "./plugins/availablePlugins";
import { setProfiler } from "./profiler";
import { logRateLimit } from "./rateLimitStats";
import { startUptimeCounter } from "./uptime";
import { MINUTES, SECONDS, errorMessage, isDiscordAPIError, isDiscordHTTPError, sleep, successMessage } from "./utils";
import { DecayingCounter } from "./utils/DecayingCounter";
import { enableProfiling } from "./utils/easyProfiler";
import { loadYamlSafely } from "./utils/loadYamlSafely";
import { DiscordJSError } from "./DiscordJSError.js";
import { RecoverablePluginError } from "./RecoverablePluginError.js";
import { SimpleError } from "./SimpleError.js";
import { AllowedGuilds } from "./data/AllowedGuilds.js";
import { Configs } from "./data/Configs.js";
import { GuildLogs } from "./data/GuildLogs.js";
import { LogType } from "./data/LogType.js";
import { hasPhishermanMasterAPIKey } from "./data/Phisherman.js";
import { dataSource } from "./data/dataSource.js";
import { connect } from "./data/db.js";
import { runExpiredArchiveDeletionLoop } from "./data/loops/expiredArchiveDeletionLoop.js";
import { runExpiredMemberCacheDeletionLoop } from "./data/loops/expiredMemberCacheDeletionLoop.js";
import { runExpiringMutesLoop } from "./data/loops/expiringMutesLoop.js";
import { runExpiringTempbansLoop } from "./data/loops/expiringTempbansLoop.js";
import { runExpiringVCAlertsLoop } from "./data/loops/expiringVCAlertsLoop.js";
import { runMemberCacheDeletionLoop } from "./data/loops/memberCacheDeletionLoop.js";
import { runPhishermanCacheCleanupLoop, runPhishermanReportingLoop } from "./data/loops/phishermanLoops.js";
import { runSavedMessageCleanupLoop } from "./data/loops/savedMessageCleanupLoop.js";
import { runUpcomingRemindersLoop } from "./data/loops/upcomingRemindersLoop.js";
import { runUpcomingScheduledPostsLoop } from "./data/loops/upcomingScheduledPostsLoop.js";
import { consumeQueryStats } from "./data/queryLogger.js";
import { env } from "./env.js";
import { logger } from "./logger.js";
import { baseGuildPlugins, globalPlugins, guildPlugins } from "./plugins/availablePlugins.js";
import { setProfiler } from "./profiler.js";
import { logRateLimit } from "./rateLimitStats.js";
import { startUptimeCounter } from "./uptime.js";
import { MINUTES, SECONDS, errorMessage, isDiscordAPIError, isDiscordHTTPError, sleep, successMessage } from "./utils.js";
import { DecayingCounter } from "./utils/DecayingCounter.js";
import { enableProfiling } from "./utils/easyProfiler.js";
import { loadYamlSafely } from "./utils/loadYamlSafely.js";
// Error handling
let recentPluginErrors = 0;

Some files were not shown because too many files have changed in this diff Show more