From 656a0168cc123d870186b334ccdf713c6e2e66af Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Wed, 20 Nov 2024 17:27:44 -0500 Subject: [PATCH] Signature Fixes --- src/equicordplugins/remixMe/index.tsx | 7 +++---- src/equicordplugins/signature/index.tsx | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/equicordplugins/remixMe/index.tsx b/src/equicordplugins/remixMe/index.tsx index 7df5cf97..473eed84 100644 --- a/src/equicordplugins/remixMe/index.tsx +++ b/src/equicordplugins/remixMe/index.tsx @@ -6,8 +6,7 @@ import "./style.css"; -import { MessageEvents } from "@api/index"; -import { MessageExtra, MessageObject } from "@api/MessageEvents"; +import { addPreSendListener, MessageExtra, MessageObject, removePreSendListener } from "@api/MessageEvents"; import { EquicordDevs } from "@utils/constants"; import definePlugin from "@utils/types"; import { Forms } from "@webpack/common"; @@ -23,6 +22,6 @@ export default definePlugin({ We can't guarantee this plugin won't get you warned or banned. , - start: () => MessageEvents.addPreSendListener(handleMessage), - stop: () => MessageEvents.removePreSendListener(handleMessage) + start: () => addPreSendListener(handleMessage), + stop: () => removePreSendListener(handleMessage) }); diff --git a/src/equicordplugins/signature/index.tsx b/src/equicordplugins/signature/index.tsx index 4df62529..cc310588 100644 --- a/src/equicordplugins/signature/index.tsx +++ b/src/equicordplugins/signature/index.tsx @@ -7,13 +7,12 @@ import { addChatBarButton, ChatBarButton, removeChatBarButton } from "@api/ChatButtons"; import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands"; import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu"; -import { MessageEvents } from "@api/index"; +import { addPreSendListener, removePreSendListener } from "@api/MessageEvents"; import { definePluginSettings, migratePluginSettings } from "@api/Settings"; import { EquicordDevs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { Menu, React } from "@webpack/common"; - // Big thank you too slientTyping const settings = definePluginSettings( @@ -66,8 +65,13 @@ const SignatureToggle: ChatBarButton = ({ isMainChat }) => { ); }; -// Big thank you @thororen (discord) who helped me write this const -const handleMessage = ((channelId, msg) => { if (!settings.store.isEnabled) return ""; return msg.content = textProcessing(msg.content); }); +const handleMessage = ((channelId, msg) => { + if (!settings.store.isEnabled) { + msg.content = msg.content; + } else { + msg.content = textProcessing(msg.content); + } +}); const ChatBarContextCheckbox: NavContextMenuPatchCallback = children => { const { isEnabled, contextMenu } = settings.use(["isEnabled", "contextMenu"]); @@ -89,7 +93,6 @@ const ChatBarContextCheckbox: NavContextMenuPatchCallback = children => { ); }; -// This is usless for the normal user but is helpful for development since I decided to rework to plugin migratePluginSettings("Signature", "SentVia"); export default definePlugin({ @@ -103,14 +106,12 @@ export default definePlugin({ start: () => { if (settings.store.isEnabled) true; addChatBarButton("Signature", SignatureToggle); - // @ts-ignore - MessageEvents.addPreSendListener(handleMessage); + addPreSendListener(handleMessage); }, stop: () => { if (settings.store.isEnabled) false; removeChatBarButton("Signature"); - // @ts-ignore - MessageEvents.removePreSendListener(handleMessage); + removePreSendListener(handleMessage); },