From d94d7bfc42f6d2d7060e7e2c0f55e165d9c67b90 Mon Sep 17 00:00:00 2001 From: Oj Date: Sun, 4 Apr 2021 19:00:26 +0100 Subject: [PATCH] [PCCompat] Use powercord import instead of window global --- moduleWrappers/powercord/entities.js | 2 +- src/preprocessors/pcPlugin.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/moduleWrappers/powercord/entities.js b/moduleWrappers/powercord/entities.js index 13a7b78..140e91a 100644 --- a/moduleWrappers/powercord/entities.js +++ b/moduleWrappers/powercord/entities.js @@ -1,6 +1,6 @@ // Also set Powercord global var stuff here since entities import is needed to use Plugin (which every PC plugin uses) -window.powercord = { +export const powercord = { api: { commands: { registerCommand: ({ command, alias, description, usage, executor }) => { diff --git a/src/preprocessors/pcPlugin.js b/src/preprocessors/pcPlugin.js index 691802d..823cc38 100644 --- a/src/preprocessors/pcPlugin.js +++ b/src/preprocessors/pcPlugin.js @@ -19,7 +19,7 @@ export default (manifestPath, repo) => { const content = readFileSync(pcManifest.main || 'index.js', 'utf8');//.replace(/\\/g, '\\\\').replace(/`/g, '\\`'); - const jsCode = content.replace(`module.exports = class`, `export default new class`); + const jsCode = content.replace(`module.exports = class`, `export default new class`).replace(/{ *Plugin *}/, `{ Plugin, powercord }`); writeFileSync(`${manifestPath}/goosemodModule.json`, JSON.stringify(manifest)); writeFileSync(`${manifestPath}/index.js`, jsCode);