diff --git a/Library/0BDFDB.plugin.js b/Library/0BDFDB.plugin.js index 1c7ef0c53e..b236bbe920 100644 --- a/Library/0BDFDB.plugin.js +++ b/Library/0BDFDB.plugin.js @@ -587,11 +587,11 @@ module.exports = (_ => { BDFDB.TimeUtils.suppress(_ => { if (!BDFDB.ObjectUtils.is(plugin)) return; if (plugin == window.BDFDB_Global) { - let updateNotice = document.querySelector(BDFDB.dotCN.noticeupdate); + let updateNotice = BDFDB.dotCN && document.querySelector(BDFDB.dotCN.noticeupdate); if (updateNotice) updateNotice.close(); - BDFDB.TimeUtils.clear(PluginStores.updateData.interval); + BDFDB.TimeUtils.clear(PluginStores && PluginStores.updateData && PluginStores.updateData.interval); delete window.BDFDB_Global.loaded; - BDFDB.TimeUtils.interval((interval, count) => { + if (PluginStores) BDFDB.TimeUtils.interval((interval, count) => { if (count > 60 || window.BDFDB_Global.loaded) BDFDB.TimeUtils.clear(interval); if (window.BDFDB_Global.loaded) for (let pluginName in BDFDB.ObjectUtils.sort(PluginStores.loaded)) BDFDB.TimeUtils.timeout(_ => { if (PluginStores.loaded[pluginName].started) BDFDB.BDUtils.reloadPlugin(pluginName); @@ -946,11 +946,12 @@ module.exports = (_ => { const loadLibrary = tryAgain => { const branch = ((BdApi.findModuleByProps("getCurrentUser") || {getCurrentUser: _ => {}}).getCurrentUser() || {}).id == "278543574059057154" ? "development" : "master"; - require("request").get(`https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/${branch}/Library/BDFDB.raw.css`, (e, r, b) => { - if ((e || !b) && tryAgain) return BDFDB.TimeUtils.timeout(_ => loadLibrary(), 10000); + const request = require("request"); + request.get(`https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/${branch}/Library/_res/BDFDB.raw.css`, (e, r, b) => { + if ((e || !b || r.statusCode != 200) && tryAgain) return BDFDB.TimeUtils.timeout(_ => loadLibrary(), 10000); const css = b; - require("request").get(`https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/${branch}/Library/BDFDB.data.json`, BDFDB.TimeUtils.suppress((e2, res2, b2) => { - if ((e2 || !b2) && tryAgain) return BDFDB.TimeUtils.timeout(_ => loadLibrary(), 10000); + request.get(`https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/${branch}/Library/_res/BDFDB.data.json`, BDFDB.TimeUtils.suppress((e2, res2, b2) => { + if ((e2 || !b2 || r2.statusCode != 200) && tryAgain) return BDFDB.TimeUtils.timeout(_ => loadLibrary(), 10000); const InternalData = JSON.parse(b2); InternalBDFDB.getPluginURL = function (plugin) { diff --git a/Plugins/MessageUtilities/MessageUtilities.plugin.js b/Plugins/MessageUtilities/MessageUtilities.plugin.js index df1f4581ba..14f2ea7b13 100644 --- a/Plugins/MessageUtilities/MessageUtilities.plugin.js +++ b/Plugins/MessageUtilities/MessageUtilities.plugin.js @@ -14,13 +14,8 @@ module.exports = (_ => { "info": { "name": "MessageUtilities", "author": "DevilBro", - "version": "1.8.7", + "version": "1.8.8", "description": "Offers you a number of useful message options (quick actions)" - }, - "changeLog": { - "fixed": { - "Edit": "Trying to edit a message that is alsready being edited no longer resets the edit" - } } }; @@ -97,8 +92,10 @@ module.exports = (_ => { this.patchedModules = { before: { Menu: "default", - Message: "default", ChannelTextAreaForm: "render" + }, + after: { + Message: "type" } }; @@ -283,19 +280,14 @@ module.exports = (_ => { } processMessage (e) { - let message; - for (let key in e.instance.props) { - if (!message) message = BDFDB.ObjectUtils.get(e.instance.props[key], "props.message"); - else break; - } - if (message) { - let props = Object.assign({}, e.instance.props); - e.instance.props.onClick = event => { - this.onClick(event, message); + if (e.instance.props.message) { + let props = Object.assign({}, e.returnvalue.props); + e.returnvalue.props.onClick = event => { + this.onClick(event, e.instance.props.message); if (typeof props.onClick == "function") props.onClick(event); }; - e.instance.props.onDoubleClick = event => { - this.onClick(event, message); + e.returnvalue.props.onDoubleClick = event => { + this.onClick(event, e.instance.props.message); if (typeof props.onDoubleClick == "function") props.onDoubleClick(event); }; }