From 7437c63d91e778e7cb1f764d86969af3166d41aa Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Thu, 20 Dec 2018 22:42:59 +0100 Subject: [PATCH] changed to new webmodule patcher --- .../NotificationSounds.plugin.js | 18 +++++++++--------- Plugins/PinDMs/PinDMs.plugin.js | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Plugins/NotificationSounds/NotificationSounds.plugin.js b/Plugins/NotificationSounds/NotificationSounds.plugin.js index b0c457bd37..c7f0846fab 100644 --- a/Plugins/NotificationSounds/NotificationSounds.plugin.js +++ b/Plugins/NotificationSounds/NotificationSounds.plugin.js @@ -93,7 +93,7 @@ class NotificationSounds { getDescription () {return "Allows you to replace the native sounds of Discord with your own";} - getVersion () {return "3.2.1";} + getVersion () {return "3.2.2";} getAuthor () {return "DevilBro";} @@ -175,12 +175,12 @@ class NotificationSounds { if (typeof BDFDB === "object") { BDFDB.loadMessage(this); - this.ChannelSettingsModule = BDFDB.WebModules.findByProperties(["isGuildOrCategoryOrChannelMuted"]); + this.ChannelSettingsUtils = BDFDB.WebModules.findByProperties(["isGuildOrCategoryOrChannelMuted"]); - this.patchCancels.push(BDFDB.WebModules.monkeyPatch(BDFDB.WebModules.findByProperties(["receiveMessage"]), "receiveMessage", {before: (e) => { + BDFDB.WebModules.patch(BDFDB.WebModules.findByProperties(["receiveMessage"]), "receiveMessage", this, {before: (e) => { let message = e.methodArguments[1]; let guildid = message.guild_id ? message.guild_id : null; - if (!this.ChannelSettingsModule.isGuildOrCategoryOrChannelMuted(guildid, message.channel_id) && message.author.id != BDFDB.myData.id) { + if (!this.ChannelSettingsUtils.isGuildOrCategoryOrChannelMuted(guildid, message.channel_id) && message.author.id != BDFDB.myData.id) { if (!guildid) { this.fireEvent("dm"); this.playAudio("dm"); @@ -192,9 +192,9 @@ class NotificationSounds { } } } - }})); + }}); - this.patchCancels.push(BDFDB.WebModules.monkeyPatch(BDFDB.WebModules.findByProperties(["playSound"]), "playSound", {instead: (e) => { + BDFDB.WebModules.patch(BDFDB.WebModules.findByProperties(["playSound"]), "playSound", this, {instead: (e) => { setImmediate(() => { var type = e.methodArguments[0]; if (type == "message1") { @@ -208,7 +208,7 @@ class NotificationSounds { } else this.playAudio(type); }); - }})); + }}); var incomingCallAudio = new Audio(); this.incomingCallOwnerInstance = BDFDB.getOwnerInstance({"node":document.querySelector(BDFDB.dotCN.callcontainer), "props":["startRinging","stopRinging"], "up":true}); @@ -254,8 +254,8 @@ class NotificationSounds { outgoingCallOwnerInstance.stopRinging = stop; let CallingWrap = outgoingCallOwnerInstance._reactInternalFiber.type; - this.patchCancels.push(BDFDB.WebModules.monkeyPatch(CallingWrap.prototype, "startRinging", {instead: play})); - this.patchCancels.push(BDFDB.WebModules.monkeyPatch(CallingWrap.prototype, "stopRinging", {instead: stop})); + BDFDB.WebModules.patch(CallingWrap.prototype, "startRinging", this, {instead: play}); + BDFDB.WebModules.patch(CallingWrap.prototype, "stopRinging", this, {instead: stop}); this.hasPatchedOutgoing = true; } diff --git a/Plugins/PinDMs/PinDMs.plugin.js b/Plugins/PinDMs/PinDMs.plugin.js index df8f3e1f6d..51aff54a9a 100644 --- a/Plugins/PinDMs/PinDMs.plugin.js +++ b/Plugins/PinDMs/PinDMs.plugin.js @@ -19,7 +19,7 @@ class PinDMs { getDescription () {return "Allows you to pin DMs, making them appear at the top of your DM-list.";} - getVersion () {return "1.2.3";} + getVersion () {return "1.2.4";} getAuthor () {return "DevilBro";} @@ -188,7 +188,7 @@ class PinDMs { for (let pos in sortedDMs) this.addPinnedDM(sortedDMs[pos], dmsarray, insertpoint); } }; - this.patchCancels.push(BDFDB.WebModules.monkeyPatch(BDFDB.WebModules.findByName("LazyScroller").prototype, "render", { + BDFDB.WebModules.patch(BDFDB.WebModules.findByName("LazyScroller").prototype, "render", this, { before: (e) => { if (e.thisObject._reactInternalFiber.return.memoizedProps.privateChannelIds && !e.thisObject.props.PinDMsPatched) { e.thisObject.props.PinDMsPatched = true; @@ -198,7 +198,7 @@ class PinDMs { e.thisObject.getScrollerNode().scrollTop = this.oldSrollerPos; } } - })); + }); let dmsscroller = document.querySelector(BDFDB.dotCNS.dmchannels + BDFDB.dotCN.scroller); if (dmsscroller) { addAllDMs(BDFDB.getReactInstance(dmsscroller).return.return.return.memoizedProps.children);