aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/index.ts')
-rw-r--r--src/plugins/index.ts28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/plugins/index.ts b/src/plugins/index.ts
index 4e55edb..d5b419b 100644
--- a/src/plugins/index.ts
+++ b/src/plugins/index.ts
@@ -1,3 +1,27 @@
-import plugins from "plugins";
+import Plugins from "plugins";
+import Logger from "../utils/logger";
+import { Patch } from "../utils/types";
-console.log(plugins); \ No newline at end of file
+const logger = new Logger("PluginManager", "#a6d189");
+
+export const plugins = Plugins;
+export const patches = [] as Patch[];
+
+for (const plugin of Plugins) if (plugin.patches) {
+ for (const patch of plugin.patches) {
+ patch.plugin = plugin.name;
+ if (!Array.isArray(patch.replacement)) patch.replacement = [patch.replacement];
+ patches.push(patch);
+ }
+}
+
+export function startAll() {
+ for (const plugin of plugins) if (plugin.start) {
+ try {
+ logger.info("Starting plugin", plugin.name);
+ plugin.start();
+ } catch (err) {
+ logger.error("Failed to start plugin", plugin.name, err);
+ }
+ }
+} \ No newline at end of file