aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2023-03-28 18:56:12 +0200
committerVendicated <vendicated@riseup.net>2023-03-28 18:56:12 +0200
commit081df6beb79a48ed970aaca7a5dde852651a6d61 (patch)
tree03259db7b06898d4eebad65c44b8cf0ad1e23acf
parentab911b48b5608d0a6781c325a123138815282f74 (diff)
downloadVencord-081df6beb79a48ed970aaca7a5dde852651a6d61.tar.gz
Vencord-081df6beb79a48ed970aaca7a5dde852651a6d61.tar.bz2
Vencord-081df6beb79a48ed970aaca7a5dde852651a6d61.zip
Fix SilentMessage/SilentTyping toggles showing in wrong sections
Closes #656
-rw-r--r--src/plugins/silentMessageToggle.tsx10
-rw-r--r--src/plugins/silentTyping.tsx10
2 files changed, 16 insertions, 4 deletions
diff --git a/src/plugins/silentMessageToggle.tsx b/src/plugins/silentMessageToggle.tsx
index 8d33f81..3151e5c 100644
--- a/src/plugins/silentMessageToggle.tsx
+++ b/src/plugins/silentMessageToggle.tsx
@@ -22,7 +22,11 @@ import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { Button, ButtonLooks, ButtonWrapperClasses, React, Tooltip } from "@webpack/common";
-function SilentMessageToggle() {
+function SilentMessageToggle(chatBoxProps: {
+ type: {
+ analyticsName: string;
+ };
+}) {
const [enabled, setEnabled] = React.useState(false);
React.useEffect(() => {
@@ -37,6 +41,8 @@ function SilentMessageToggle() {
return () => void removePreSendListener(listener);
}, [enabled]);
+ if (chatBoxProps.type.analyticsName !== "normal") return null;
+
return (
<Tooltip text="Toggle Silent Message">
{tooltipProps => (
@@ -78,7 +84,7 @@ export default definePlugin({
find: ".activeCommandOption",
replacement: {
match: /"gift"\)\);(?<=(\i)\.push.+?disabled:(\i),.+?)/,
- replace: (m, array, disabled) => `${m}${disabled}||${array}.push($self.SilentMessageToggle());`
+ replace: (m, array, disabled) => `${m};try{${disabled}||${array}.push($self.SilentMessageToggle(arguments[0]));}catch{}`
}
}
],
diff --git a/src/plugins/silentTyping.tsx b/src/plugins/silentTyping.tsx
index d0edaac..6d82840 100644
--- a/src/plugins/silentTyping.tsx
+++ b/src/plugins/silentTyping.tsx
@@ -37,10 +37,16 @@ const settings = definePluginSettings({
}
});
-function SilentTypingToggle() {
+function SilentTypingToggle(chatBoxProps: {
+ type: {
+ analyticsName: string;
+ };
+}) {
const { isEnabled } = settings.use(["isEnabled"]);
const toggle = () => settings.store.isEnabled = !settings.store.isEnabled;
+ if (chatBoxProps.type.analyticsName !== "normal") return null;
+
return (
<Tooltip text={isEnabled ? "Disable silent typing" : "Enable silent typing"}>
{(tooltipProps: any) => (
@@ -83,7 +89,7 @@ export default definePlugin({
predicate: () => settings.store.showIcon,
replacement: {
match: /(.)\.push.{1,30}disabled:(\i),.{1,20}\},"gift"\)\)/,
- replace: "$&;try{$2||$1.push($self.chatBarIcon())}catch{}",
+ replace: "$&;try{$2||$1.push($self.chatBarIcon(arguments[0]))}catch{}",
}
},
],