GoonCord/src/index.ts

45 lines
1.3 KiB
TypeScript
Raw Normal View History

import { patchLogHook } from "@lib/debug";
import { patchCommands } from "@/lib/api/commands";
import { initPlugins } from "@lib/managers/plugins";
2024-02-29 20:07:55 +08:00
import { initThemes, patchChatBackground } from "@lib/managers/themes";
import { patchAssets } from "@/lib/api/assets";
import initSafeMode from "@ui/safeMode";
2024-02-28 18:04:40 +08:00
import initSettings from "@/core/ui/settings";
import initFixes from "@/core/fixes";
import logger from "@lib/utils/logger";
2024-02-23 13:29:06 +08:00
import initWindowObject from "@lib/windowObject";
2024-02-28 17:59:47 +08:00
import { initCorePlugins } from "./core/plugins";
2024-02-29 20:07:55 +08:00
import { isThemeSupported } from "./lib/api/native/loader";
2022-10-18 23:04:55 +01:00
export default async () => {
2024-02-29 20:07:55 +08:00
// Themes
if (isThemeSupported()) {
try {
initThemes();
} catch (e) {
console.error("[Vendetta] Failed to initialize themes...", e);
}
}
// Load everything in parallel
const unloads = await Promise.all([
patchLogHook(),
patchAssets(),
patchCommands(),
patchChatBackground(),
initFixes(),
initSafeMode(),
initSettings(),
2024-02-28 17:59:47 +08:00
initCorePlugins(),
]);
2022-10-18 23:04:55 +01:00
// Assign window object
2024-02-23 13:29:06 +08:00
initWindowObject(unloads);
// Once done, load plugins
unloads.push(await initPlugins());
// We good :)
logger.log("Vendetta is ready!");
}