You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
720 B

import { get, set } from 'idb-keyval';
async function addPlugin(onStart, onStop, getMeta, metadata=null) {
if (metadata === null) metadata = getMeta(); // expected output: {name: "name", desc: "description", author: "author"}
const obj = { // whether the plugin is started or stopped isn't going to be stored in the iDB, so it can be accessed more easily by all components
metadata: metadata,
code: {
start: onStart,
stop: onStop
},
enabled: false // should plugins be enabled by default? not sure
}
const globalSettings = await get("demoncord");
if (globalSettings[metadata.name] !== undefined) {
console.log("[Demoncord] Cannot add plugin that already exists!")
return false
} else {
}
}