aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/index.ts
diff options
context:
space:
mode:
authorJustice Almanzar <superdash993@gmail.com>2023-01-13 17:15:45 -0500
committerGitHub <noreply@github.com>2023-01-13 23:15:45 +0100
commitea748dfb605386b80a4919183ad6fa9249a82e21 (patch)
tree8660c5d192ac553e7574d6b510e18f99c7ac5ddd /src/plugins/index.ts
parent6c5fcc4119d05389bbc71bd3e52090f6fd29b10c (diff)
downloadVencord-ea748dfb605386b80a4919183ad6fa9249a82e21.tar.gz
Vencord-ea748dfb605386b80a4919183ad6fa9249a82e21.tar.bz2
Vencord-ea748dfb605386b80a4919183ad6fa9249a82e21.zip
feat: Typesafe Settings Definitions (#403)
Co-authored-by: Ven <vendicated@riseup.net>
Diffstat (limited to 'src/plugins/index.ts')
-rw-r--r--src/plugins/index.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/index.ts b/src/plugins/index.ts
index c0325d4..6ac221d 100644
--- a/src/plugins/index.ts
+++ b/src/plugins/index.ts
@@ -60,7 +60,16 @@ for (const p of pluginsValues) {
});
}
-for (const p of pluginsValues)
+for (const p of pluginsValues) {
+ if (p.settings) {
+ p.settings.pluginName = p.name;
+ p.options ??= {};
+ for (const [name, def] of Object.entries(p.settings.def)) {
+ const checks = p.settings.checks?.[name];
+ p.options[name] = { ...def, ...checks };
+ }
+ }
+
if (p.patches && isPluginEnabled(p.name)) {
for (const patch of p.patches) {
patch.plugin = p.name;
@@ -69,6 +78,7 @@ for (const p of pluginsValues)
patches.push(patch);
}
}
+}
export const startAllPlugins = traceFunction("startAllPlugins", function startAllPlugins() {
for (const name in Plugins)