mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-09 14:43:03 -04:00
Fix SilentMessage/SilentTyping toggles showing in wrong sections
Closes #656
This commit is contained in:
parent
ab911b48b5
commit
081df6beb7
2 changed files with 16 additions and 4 deletions
|
@ -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{}`
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue