mirror of
https://github.com/Equicord/Equicord.git
synced 2025-01-18 21:33:35 -05:00
Signature Fixes
This commit is contained in:
parent
026befec32
commit
656a0168cc
2 changed files with 13 additions and 13 deletions
|
@ -6,8 +6,7 @@
|
||||||
|
|
||||||
import "./style.css";
|
import "./style.css";
|
||||||
|
|
||||||
import { MessageEvents } from "@api/index";
|
import { addPreSendListener, MessageExtra, MessageObject, removePreSendListener } from "@api/MessageEvents";
|
||||||
import { MessageExtra, MessageObject } from "@api/MessageEvents";
|
|
||||||
import { EquicordDevs } from "@utils/constants";
|
import { EquicordDevs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
import { Forms } from "@webpack/common";
|
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.
|
We can't guarantee this plugin won't get you warned or banned.
|
||||||
</Forms.FormText>
|
</Forms.FormText>
|
||||||
</>,
|
</>,
|
||||||
start: () => MessageEvents.addPreSendListener(handleMessage),
|
start: () => addPreSendListener(handleMessage),
|
||||||
stop: () => MessageEvents.removePreSendListener(handleMessage)
|
stop: () => removePreSendListener(handleMessage)
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,13 +7,12 @@
|
||||||
import { addChatBarButton, ChatBarButton, removeChatBarButton } from "@api/ChatButtons";
|
import { addChatBarButton, ChatBarButton, removeChatBarButton } from "@api/ChatButtons";
|
||||||
import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands";
|
import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands";
|
||||||
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
|
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
|
||||||
import { MessageEvents } from "@api/index";
|
import { addPreSendListener, removePreSendListener } from "@api/MessageEvents";
|
||||||
import { definePluginSettings, migratePluginSettings } from "@api/Settings";
|
import { definePluginSettings, migratePluginSettings } from "@api/Settings";
|
||||||
import { EquicordDevs } from "@utils/constants";
|
import { EquicordDevs } from "@utils/constants";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { Menu, React } from "@webpack/common";
|
import { Menu, React } from "@webpack/common";
|
||||||
|
|
||||||
|
|
||||||
// Big thank you too slientTyping
|
// Big thank you too slientTyping
|
||||||
|
|
||||||
const settings = definePluginSettings(
|
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) => {
|
||||||
const handleMessage = ((channelId, msg) => { if (!settings.store.isEnabled) return ""; return msg.content = textProcessing(msg.content); });
|
if (!settings.store.isEnabled) {
|
||||||
|
msg.content = msg.content;
|
||||||
|
} else {
|
||||||
|
msg.content = textProcessing(msg.content);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const ChatBarContextCheckbox: NavContextMenuPatchCallback = children => {
|
const ChatBarContextCheckbox: NavContextMenuPatchCallback = children => {
|
||||||
const { isEnabled, contextMenu } = settings.use(["isEnabled", "contextMenu"]);
|
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");
|
migratePluginSettings("Signature", "SentVia");
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
|
@ -103,14 +106,12 @@ export default definePlugin({
|
||||||
start: () => {
|
start: () => {
|
||||||
if (settings.store.isEnabled) true;
|
if (settings.store.isEnabled) true;
|
||||||
addChatBarButton("Signature", SignatureToggle);
|
addChatBarButton("Signature", SignatureToggle);
|
||||||
// @ts-ignore
|
addPreSendListener(handleMessage);
|
||||||
MessageEvents.addPreSendListener(handleMessage);
|
|
||||||
},
|
},
|
||||||
stop: () => {
|
stop: () => {
|
||||||
if (settings.store.isEnabled) false;
|
if (settings.store.isEnabled) false;
|
||||||
removeChatBarButton("Signature");
|
removeChatBarButton("Signature");
|
||||||
// @ts-ignore
|
removePreSendListener(handleMessage);
|
||||||
MessageEvents.removePreSendListener(handleMessage);
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue