From f7771f4e4c787ae8b9560b5c8d43f41707b3bab1 Mon Sep 17 00:00:00 2001 From: Zack Rauen Date: Mon, 22 Feb 2021 17:53:21 -0500 Subject: [PATCH] Fixes minor bugs --- README.md | 8 ++++++++ src/modules/pluginapi.js | 30 ++++++++---------------------- src/modules/pluginmanager.js | 2 +- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 92e55a98..492d498a 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,10 @@ These people have all subscribed to the `Bandager` tier on Patreon to support me Paco
Paco + + Jordan
+ Jordan + @@ -193,5 +197,9 @@ These people have either donated or subscribed to the most basic patron tier to
Akira + +
+ Pixel + \ No newline at end of file diff --git a/src/modules/pluginapi.js b/src/modules/pluginapi.js index 03e66125..4bbbcaa2 100644 --- a/src/modules/pluginapi.js +++ b/src/modules/pluginapi.js @@ -20,7 +20,14 @@ const BdApi = { get settings() {return Settings.collections;}, get emotes() { return new Proxy(Emotes.Emotes, { - get() {return Emotes.Emotes;}, + get(category) { + const group = Emotes.Emotes[category]; + if (!group) return undefined; + return new Proxy(group, { + get(emote) {return group[emote];}, + set() {Logger.warn("BdApi.emotes", "Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins");} + }); + }, set() {Logger.warn("BdApi.emotes", "Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins");} }); }, @@ -231,27 +238,6 @@ BdApi.testJSON = function(data) { return Utilities.testJSON(data); }; -// Get another plugin -// name = name of plugin -BdApi.getPlugin = function (name) { - Logger.warn("BdApi", "getPlugin is deprecated. Please make use of the addon api (BdApi.Plugins)"); - return PluginManager.addonList.find(a => a.name == name); -}; - -BdApi.isPluginEnabled = function(name) { - Logger.warn("BdApi", "isPluginEnabled is deprecated. Please make use of the addon api (BdApi.Plugins)"); - const plugin = this.getPlugin(name); - if (!plugin) return false; - return PluginManager.isEnabled(plugin.id); -}; - -BdApi.isThemeEnabled = function(name) { - Logger.warn("BdApi", "isThemeEnabled is deprecated. Please make use of the addon api (BdApi.Themes)"); - const theme = ThemeManager.addonList.find(a => a.name == name); - if (!theme) return false; - return ThemeManager.isEnabled(theme.id); -}; - BdApi.isSettingEnabled = function(collection, category, id) { return Settings.get(collection, category, id); }; diff --git a/src/modules/pluginmanager.js b/src/modules/pluginmanager.js index 7638cb7f..185d492e 100644 --- a/src/modules/pluginmanager.js +++ b/src/modules/pluginmanager.js @@ -141,7 +141,7 @@ export default new class PluginManager extends AddonManager { getPlugin(idOrFile) { const addon = this.addonList.find(c => c.id == idOrFile || c.filename == idOrFile); if (!addon) return; - return addon.instance; + return addon; } setupFunctions() {