From c497cd4fc114fc36857752e606a2bb232a49c340 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Fri, 25 Feb 2022 16:12:53 +0100 Subject: [PATCH] fixes --- .../CopyRawMessage/CopyRawMessage.plugin.js | 36 +++++++++---------- Plugins/CustomQuoter/CustomQuoter.plugin.js | 24 ++++++------- Plugins/EditChannels/EditChannels.plugin.js | 17 ++++----- Plugins/EditUsers/EditUsers.plugin.js | 18 ++++++---- Plugins/PersonalPins/PersonalPins.plugin.js | 6 ++++ Plugins/PinDMs/PinDMs.plugin.js | 18 ++++++---- .../RemoveBlockedUsers.plugin.js | 15 ++++---- .../ShowBadgesInChat.plugin.js | 18 ++++++---- Plugins/Translator/Translator.plugin.js | 17 +++++---- 9 files changed, 96 insertions(+), 73 deletions(-) diff --git a/Plugins/CopyRawMessage/CopyRawMessage.plugin.js b/Plugins/CopyRawMessage/CopyRawMessage.plugin.js index e8cb42d38e..b25690fc11 100644 --- a/Plugins/CopyRawMessage/CopyRawMessage.plugin.js +++ b/Plugins/CopyRawMessage/CopyRawMessage.plugin.js @@ -87,21 +87,23 @@ module.exports = (_ => { messageString && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw)", id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-message"), - hint: hint && (_ => { - return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuHint, { - hint: hint - }); + hint: hint && (_ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuHint, { + hint: hint + })), + icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { + className: BDFDB.disCN.menuicon, + name: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT }), - action: _ => { - BDFDB.LibraryRequires.electron.clipboard.write({text: messageString}); - } + action: _ => BDFDB.LibraryRequires.electron.clipboard.write({text: messageString}) }), embedString && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw Embed)", id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-embed"), - action: _ => { - BDFDB.LibraryRequires.electron.clipboard.write({text: embedString}); - } + icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { + className: BDFDB.disCN.menuicon, + name: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT + }), + action: _ => BDFDB.LibraryRequires.electron.clipboard.write({text: embedString}) }) ].filter(n => n); if (entries.length) { @@ -119,15 +121,11 @@ module.exports = (_ => { children.splice(index + 1, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { label: BDFDB.LanguageUtils.LanguageStrings.COPY_TEXT + " (Raw)", id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-message-raw"), - icon: _ => { - return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { - className: BDFDB.disCN.menuicon, - name: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT - }); - }, - action: _ => { - BDFDB.LibraryRequires.electron.clipboard.write({text: e.instance.props.message.content}); - } + icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { + className: BDFDB.disCN.menuicon, + name: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT + }), + action: _ => BDFDB.LibraryRequires.electron.clipboard.write({text: e.instance.props.message.content}) })); } } diff --git a/Plugins/CustomQuoter/CustomQuoter.plugin.js b/Plugins/CustomQuoter/CustomQuoter.plugin.js index 601da10e83..a5c8350106 100644 --- a/Plugins/CustomQuoter/CustomQuoter.plugin.js +++ b/Plugins/CustomQuoter/CustomQuoter.plugin.js @@ -292,7 +292,7 @@ module.exports = (_ => { let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "quote"}); if (index > -1) { item = children[index]; - item.props.action = event => {action(null, event.shiftKey);}; + item.props.action = event => action(null, event.shiftKey); } else { item = BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { @@ -312,12 +312,14 @@ module.exports = (_ => { })) }); else { + item.props.icon = _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { + className: BDFDB.disCN.menuicon, + name: BDFDB.LibraryComponents.SvgIcon.Names.QUOTE + }); let hint = BDFDB.BDUtils.isPluginEnabled("MessageUtilities") ? BDFDB.BDUtils.getPlugin("MessageUtilities").getActiveShortcutString("__Quote_Message") : null; - if (hint) item.props.hint = _ => { - return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuHint, { - hint: hint - }); - }; + if (hint) item.props.hint = _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuHint, { + hint: hint + }); } } } @@ -330,12 +332,10 @@ module.exports = (_ => { children.splice(index > -1 ? index : 0, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { label: BDFDB.LanguageUtils.LanguageStrings.QUOTE, id: BDFDB.ContextMenuUtils.createItemId(this.name, "quote"), - icon: _ => { - return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { - className: BDFDB.disCN.menuicon, - name: BDFDB.LibraryComponents.SvgIcon.Names.QUOTE - }); - }, + icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { + className: BDFDB.disCN.menuicon, + name: BDFDB.LibraryComponents.SvgIcon.Names.QUOTE + }), action: event => { this.quote(e.instance.props.channel, e.instance.props.message, event.shiftKey); } diff --git a/Plugins/EditChannels/EditChannels.plugin.js b/Plugins/EditChannels/EditChannels.plugin.js index 1a764e705f..0a7605c0c0 100644 --- a/Plugins/EditChannels/EditChannels.plugin.js +++ b/Plugins/EditChannels/EditChannels.plugin.js @@ -2,7 +2,7 @@ * @name EditChannels * @author DevilBro * @authorId 278543574059057154 - * @version 4.3.5 + * @version 4.3.6 * @description Allows you to locally edit Channels * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -17,12 +17,12 @@ module.exports = (_ => { "info": { "name": "EditChannels", "author": "DevilBro", - "version": "4.3.5", + "version": "4.3.6", "description": "Allows you to locally edit Channels" }, "changeLog": { - "improved": { - "Threads": "Works flawlessly with Threads now" + "fixed": { + "PlatformIndicators": "Fixed Plugin Issue with PlatformIndicators that broke Features in the DM List" } } }; @@ -512,15 +512,16 @@ module.exports = (_ => { processPrivateChannel (e) { if (e.instance.props.channel && e.instance.props.channel.isGroupDM() && this.settings.places.channelList) { - if (typeof e.returnvalue.props.children == "function") { - let childrenRender = e.returnvalue.props.children; - e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => { + let wrapper = e.returnvalue && e.returnvalue.props.children && e.returnvalue.props.children.props && typeof e.returnvalue.props.children.props.children == "function" ? e.returnvalue.props.children : e.returnvalue; + if (typeof wrapper.props.children == "function") { + let childrenRender = wrapper.props.children; + wrapper.props.children = BDFDB.TimeUtils.suppress((...args) => { let children = childrenRender(...args); this._processPrivateChannel(e.instance, children); return children; }, "Error in Children Render of PrivateChannel!", this); } - else this._processPrivateChannel(e.instance, e.returnvalue); + else this._processPrivateChannel(e.instance, wrapper); } } diff --git a/Plugins/EditUsers/EditUsers.plugin.js b/Plugins/EditUsers/EditUsers.plugin.js index 8bd85ee84e..6a74009648 100644 --- a/Plugins/EditUsers/EditUsers.plugin.js +++ b/Plugins/EditUsers/EditUsers.plugin.js @@ -2,7 +2,7 @@ * @name EditUsers * @author DevilBro * @authorId 278543574059057154 - * @version 4.5.1 + * @version 4.5.2 * @description Allows you to locally edit Users * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -17,8 +17,13 @@ module.exports = (_ => { "info": { "name": "EditUsers", "author": "DevilBro", - "version": "4.5.1", + "version": "4.5.2", "description": "Allows you to locally edit Users" + }, + "changeLog": { + "fixed": { + "PlatformIndicators": "Fixed Plugin Issue with PlatformIndicators that broke Features in the DM List" + } } }; @@ -1093,15 +1098,16 @@ module.exports = (_ => { } } else { - if (typeof e.returnvalue.props.children == "function") { - let childrenRender = e.returnvalue.props.children; - e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => { + let wrapper = e.returnvalue && e.returnvalue.props.children && e.returnvalue.props.children.props && typeof e.returnvalue.props.children.props.children == "function" ? e.returnvalue.props.children : e.returnvalue; + if (typeof wrapper.props.children == "function") { + let childrenRender = wrapper.props.children; + wrapper.props.children = BDFDB.TimeUtils.suppress((...args) => { let children = childrenRender(...args); this._processPrivateChannel(e.instance, children); return children; }, "Error in Children Render of PrivateChannel!", this); } - else this._processPrivateChannel(e.instance, e.returnvalue); + else this._processPrivateChannel(e.instance, wrapper); } } } diff --git a/Plugins/PersonalPins/PersonalPins.plugin.js b/Plugins/PersonalPins/PersonalPins.plugin.js index 1fd90d386b..1de327d504 100644 --- a/Plugins/PersonalPins/PersonalPins.plugin.js +++ b/Plugins/PersonalPins/PersonalPins.plugin.js @@ -408,11 +408,17 @@ module.exports = (_ => { hint: hint && (_ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuHint, { hint: hint })), + icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuIcon, { + icon: note ? pinIconDelete : pinIcon + }), action: _ => this.addMessageToNotes(e.instance.props.message, e.instance.props.channel) })); if (this.isNoteOutdated(note, e.instance.props.message)) children.splice(index > -1 ? index + 1: 0, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { label: this.labels.context_updateoption, id: BDFDB.ContextMenuUtils.createItemId(this.name, "update-note"), + icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuIcon, { + icon: pinIconUpdate + }), action: _ => this.updateNoteData(note, e.instance.props.message) })); } diff --git a/Plugins/PinDMs/PinDMs.plugin.js b/Plugins/PinDMs/PinDMs.plugin.js index ba91009807..f4b6ff3f46 100644 --- a/Plugins/PinDMs/PinDMs.plugin.js +++ b/Plugins/PinDMs/PinDMs.plugin.js @@ -2,7 +2,7 @@ * @name PinDMs * @author DevilBro * @authorId 278543574059057154 - * @version 1.8.8 + * @version 1.8.9 * @description Allows you to pin DMs, making them appear at the top of your DMs/ServerList * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -17,8 +17,13 @@ module.exports = (_ => { "info": { "name": "PinDMs", "author": "DevilBro", - "version": "1.8.8", + "version": "1.8.9", "description": "Allows you to pin DMs, making them appear at the top of your DMs/ServerList" + }, + "changeLog": { + "fixed": { + "PlatformIndicators": "Fixed Plugin Issue with PlatformIndicators that broke Features in the DM List" + } } }; @@ -676,15 +681,16 @@ module.exports = (_ => { } } if (e.returnvalue) { - if (typeof e.returnvalue.props.children == "function") { - let childrenRender = e.returnvalue.props.children; - e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => { + let wrapper = e.returnvalue && e.returnvalue.props.children && e.returnvalue.props.children.props && typeof e.returnvalue.props.children.props.children == "function" ? e.returnvalue.props.children : e.returnvalue; + if (typeof wrapper.props.children == "function") { + let childrenRender = wrapper.props.children; + wrapper.props.children = BDFDB.TimeUtils.suppress((...args) => { let children = childrenRender(...args); this._processPrivateChannel(e.instance, children, category); return children; }, "Error in Children Render of PrivateChannel!", this); } - else this._processPrivateChannel(e.instance, e.returnvalue, category); + else this._processPrivateChannel(e.instance, wrapper, category); } } } diff --git a/Plugins/RemoveBlockedUsers/RemoveBlockedUsers.plugin.js b/Plugins/RemoveBlockedUsers/RemoveBlockedUsers.plugin.js index aed055f7f0..4940ce5f2f 100644 --- a/Plugins/RemoveBlockedUsers/RemoveBlockedUsers.plugin.js +++ b/Plugins/RemoveBlockedUsers/RemoveBlockedUsers.plugin.js @@ -2,7 +2,7 @@ * @name RemoveBlockedUsers * @author DevilBro * @authorId 278543574059057154 - * @version 1.3.7 + * @version 1.3.8 * @description Removes blocked Messages/Users * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -17,12 +17,12 @@ module.exports = (_ => { "info": { "name": "RemoveBlockedUsers", "author": "DevilBro", - "version": "1.3.7", + "version": "1.3.8", "description": "Removes blocked Messages/Users" }, "changeLog": { "fixed": { - "Server Notifications": "No longer kills all server notification icons" + "PlatformIndicators": "Fixed Plugin Issue with PlatformIndicators that broke Features in the DM List" } } }; @@ -416,15 +416,16 @@ module.exports = (_ => { } else { if (!e.instance.props.channel.name) { - if (typeof e.returnvalue.props.children == "function") { - let childrenRender = e.returnvalue.props.children; - e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => { + let wrapper = e.returnvalue && e.returnvalue.props.children && e.returnvalue.props.children.props && typeof e.returnvalue.props.children.props.children == "function" ? e.returnvalue.props.children : e.returnvalue; + if (typeof wrapper.props.children == "function") { + let childrenRender = wrapper.props.children; + wrapper.props.children = BDFDB.TimeUtils.suppress((...args) => { let children = childrenRender(...args); children.props.name = BDFDB.ReactUtils.createElement("span", {children: this.getGroupName(e.instance.props.channel.id)}); return children; }, "", this); } - else e.returnvalue.props.name = BDFDB.ReactUtils.createElement("span", {children: this.getGroupName(e.instance.props.channel.id)}); + else wrapper.props.name = BDFDB.ReactUtils.createElement("span", {children: this.getGroupName(e.instance.props.channel.id)}); } } } diff --git a/Plugins/ShowBadgesInChat/ShowBadgesInChat.plugin.js b/Plugins/ShowBadgesInChat/ShowBadgesInChat.plugin.js index e6db1e172d..e34fa4e6e7 100644 --- a/Plugins/ShowBadgesInChat/ShowBadgesInChat.plugin.js +++ b/Plugins/ShowBadgesInChat/ShowBadgesInChat.plugin.js @@ -2,7 +2,7 @@ * @name ShowBadgesInChat * @author DevilBro * @authorId 278543574059057154 - * @version 1.8.5 + * @version 1.8.6 * @description Displays Badges (Nitro, Hypesquad, etc...) in the Chat/MemberList/DMList * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -17,8 +17,13 @@ module.exports = (_ => { "info": { "name": "ShowBadgesInChat", "author": "DevilBro", - "version": "1.8.5", + "version": "1.8.6", "description": "Displays Badges (Nitro, Hypesquad, etc...) in the Chat/MemberList/DMList" + }, + "changeLog": { + "fixed": { + "PlatformIndicators": "Fixed Plugin Issue with PlatformIndicators that broke Features in the DM List" + } } }; @@ -281,15 +286,16 @@ module.exports = (_ => { processPrivateChannel (e) { if (!e.instance.props.user || !this.settings.places.dmsList) return; - if (typeof e.returnvalue.props.children == "function") { - let childrenRender = e.returnvalue.props.children; - e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => { + let wrapper = e.returnvalue && e.returnvalue.props.children && e.returnvalue.props.children.props && typeof e.returnvalue.props.children.props.children == "function" ? e.returnvalue.props.children : e.returnvalue; + if (typeof wrapper.props.children == "function") { + let childrenRender = wrapper.props.children; + wrapper.props.children = BDFDB.TimeUtils.suppress((...args) => { let children = childrenRender(...args); this._processPrivateChannel(e.instance, children); return children; }, "Error in Children Render of PrivateChannel!", this); } - else this._processPrivateChannel(e.instance, e.returnvalue); + else this._processPrivateChannel(e.instance, wrapper); } _processPrivateChannel (instance, returnvalue, a) { diff --git a/Plugins/Translator/Translator.plugin.js b/Plugins/Translator/Translator.plugin.js index 7378b22872..325b08d1b7 100644 --- a/Plugins/Translator/Translator.plugin.js +++ b/Plugins/Translator/Translator.plugin.js @@ -525,10 +525,11 @@ module.exports = (_ => { children.splice(index > -1 ? index + 1 : 0, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { label: translated ? this.labels.context_messageuntranslateoption : this.labels.context_messagetranslateoption, id: BDFDB.ContextMenuUtils.createItemId(this.name, translated ? "untranslate-message" : "translate-message"), - hint: hint && (_ => { - return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuHint, { - hint: hint - }); + hint: hint && (_ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuHint, { + hint: hint + })), + icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuIcon, { + icon: translated ? translateIconUntranslate : translateIcon }), disabled: !translated && isTranslating, action: _ => this.translateMessage(e.instance.props.message, e.instance.props.channel) @@ -602,11 +603,9 @@ module.exports = (_ => { label: translated ? this.labels.context_messageuntranslateoption : this.labels.context_messagetranslateoption, disabled: isTranslating, id: BDFDB.ContextMenuUtils.createItemId(this.name, translated ? "untranslate-message" : "translate-message"), - icon: _ => { - return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuIcon, { - icon: translated ? translateIconUntranslate : translateIcon - }); - }, + icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuIcon, { + icon: translated ? translateIconUntranslate : translateIcon + }), action: _ => this.translateMessage(e.instance.props.message, e.instance.props.channel) })); }