From baf952512cf042b11599d96e34950881ab940e97 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 25 Oct 2023 18:34:56 +0200 Subject: [PATCH] Fix InvisChat, PreviewMsg, SendTimestamps, SilentMsg, SilentType, Translate --- src/plugins/invisibleChat.desktop/index.tsx | 6 +++--- src/plugins/previewMessage/index.tsx | 6 +++--- src/plugins/sendTimestamps/index.tsx | 6 +++--- src/plugins/silentMessageToggle/index.tsx | 10 +++++----- src/plugins/silentTyping/index.tsx | 7 +++---- src/plugins/translate/index.tsx | 6 +++--- 6 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/plugins/invisibleChat.desktop/index.tsx b/src/plugins/invisibleChat.desktop/index.tsx index 58fccb9c..e55f1e0c 100644 --- a/src/plugins/invisibleChat.desktop/index.tsx +++ b/src/plugins/invisibleChat.desktop/index.tsx @@ -136,10 +136,10 @@ export default definePlugin({ } }, { - find: ".activeCommandOption", + find: "ChannelTextAreaButtons", replacement: { - match: /(.)\.push.{1,30}disabled:(\i),.{1,20}\},"gift"\)\)/, - replace: "$&;try{$2||$1.push($self.chatBarIcon(arguments[0]))}catch{}", + match: /(\i)\.push.{1,30}disabled:(\i),.{1,20}\},"gift"\)\)/, + replace: "$&,(()=>{try{$2||$1.push($self.chatBarIcon(arguments[0]))}catch{}})()", } }, ], diff --git a/src/plugins/previewMessage/index.tsx b/src/plugins/previewMessage/index.tsx index 393b5209..bc675114 100644 --- a/src/plugins/previewMessage/index.tsx +++ b/src/plugins/previewMessage/index.tsx @@ -129,10 +129,10 @@ export default definePlugin({ authors: [Devs.Aria], patches: [ { - find: ".activeCommandOption", + find: "ChannelTextAreaButtons", replacement: { - match: /(.)\.push.{1,30}disabled:(\i),.{1,20}\},"gift"\)\)/, - replace: "$&;try{$2||$1.unshift($self.previewIcon(arguments[0]))}catch{}", + match: /(\i)\.push.{1,30}disabled:(\i),.{1,20}\},"gift"\)\)/, + replace: "$&,(()=>{try{$2||$1.push($self.chatBarIcon(arguments[0]))}catch{}})()", } }, ], diff --git a/src/plugins/sendTimestamps/index.tsx b/src/plugins/sendTimestamps/index.tsx index a69dbacc..7904545c 100644 --- a/src/plugins/sendTimestamps/index.tsx +++ b/src/plugins/sendTimestamps/index.tsx @@ -121,10 +121,10 @@ export default definePlugin({ patches: [ { - find: ".activeCommandOption", + find: "ChannelTextAreaButtons", replacement: { - match: /(.)\.push.{1,30}disabled:(\i),.{1,20}\},"gift"\)\)/, - replace: "$&;try{$2||$1.push($self.chatBarIcon(arguments[0]))}catch{}", + match: /(\i)\.push.{1,30}disabled:(\i),.{1,20}\},"gift"\)\)/, + replace: "$&,(()=>{try{$2||$1.push($self.chatBarIcon(arguments[0]))}catch{}})()", } }, ], diff --git a/src/plugins/silentMessageToggle/index.tsx b/src/plugins/silentMessageToggle/index.tsx index 22d2c054..a1ee8de8 100644 --- a/src/plugins/silentMessageToggle/index.tsx +++ b/src/plugins/silentMessageToggle/index.tsx @@ -108,13 +108,13 @@ export default definePlugin({ settings, patches: [ { - find: ".activeCommandOption", + find: "ChannelTextAreaButtons", replacement: { - match: /"gift"\)\);(?<=(\i)\.push.+?disabled:(\i),.+?)/, - replace: (m, array, disabled) => `${m};try{${disabled}||${array}.push($self.SilentMessageToggle(arguments[0]));}catch{}` + match: /(\i)\.push.{1,30}disabled:(\i),.{1,20}\},"gift"\)\)/, + replace: "$&,(()=>{try{$2||$1.push($self.chatBarIcon(arguments[0]))}catch{}})()", } - } + }, ], - SilentMessageToggle: ErrorBoundary.wrap(SilentMessageToggle, { noop: true }), + chatBarIcon: ErrorBoundary.wrap(SilentMessageToggle, { noop: true }), }); diff --git a/src/plugins/silentTyping/index.tsx b/src/plugins/silentTyping/index.tsx index d4cb27ba..031db099 100644 --- a/src/plugins/silentTyping/index.tsx +++ b/src/plugins/silentTyping/index.tsx @@ -85,11 +85,10 @@ export default definePlugin({ } }, { - find: ".activeCommandOption", - predicate: () => settings.store.showIcon, + find: "ChannelTextAreaButtons", replacement: { - match: /(.)\.push.{1,30}disabled:(\i),.{1,20}\},"gift"\)\)/, - replace: "$&;try{$2||$1.push($self.chatBarIcon(arguments[0]))}catch{}", + match: /(\i)\.push.{1,30}disabled:(\i),.{1,20}\},"gift"\)\)/, + replace: "$&,(()=>{try{$2||$1.push($self.chatBarIcon(arguments[0]))}catch{}})()", } }, ], diff --git a/src/plugins/translate/index.tsx b/src/plugins/translate/index.tsx index 3007032b..3b067c63 100644 --- a/src/plugins/translate/index.tsx +++ b/src/plugins/translate/index.tsx @@ -62,10 +62,10 @@ export default definePlugin({ patches: [ { - find: ".activeCommandOption", + find: "ChannelTextAreaButtons", replacement: { - match: /(.)\.push.{1,30}disabled:(\i),.{1,20}\},"gift"\)\)/, - replace: "$&;try{$2||$1.push($self.chatBarIcon(arguments[0]))}catch{}", + match: /(\i)\.push.{1,30}disabled:(\i),.{1,20}\},"gift"\)\)/, + replace: "$&,(()=>{try{$2||$1.push($self.chatBarIcon(arguments[0]))}catch{}})()", } }, ],