diff --git a/src/plugins/_core/supportHelper.tsx b/src/plugins/_core/supportHelper.tsx
index 12dca2661..125dfebc2 100644
--- a/src/plugins/_core/supportHelper.tsx
+++ b/src/plugins/_core/supportHelper.tsx
@@ -16,7 +16,6 @@
* along with this program. If not, see .
*/
-import { addMessageAccessory } from "@api/MessageAccessories";
import { definePluginSettings } from "@api/Settings";
import { getUserSettingLazy } from "@api/UserSettings";
import ErrorBoundary from "@components/ErrorBoundary";
@@ -235,6 +234,85 @@ export default definePlugin({
}
},
+ renderMessageAccessory(props) {
+ const buttons = [] as JSX.Element[];
+
+ const shouldAddUpdateButton =
+ !IS_UPDATER_DISABLED
+ && (
+ (props.channel.id === KNOWN_ISSUES_CHANNEL_ID) ||
+ (props.channel.id === SUPPORT_CHANNEL_ID && props.message.author.id === VENBOT_USER_ID)
+ )
+ && props.message.content?.includes("update");
+
+ if (shouldAddUpdateButton) {
+ buttons.push(
+
+ );
+ }
+
+ if (props.channel.id === SUPPORT_CHANNEL_ID) {
+ if (props.message.content.includes("/vencord-debug") || props.message.content.includes("/vencord-plugins")) {
+ buttons.push(
+ ,
+
+ );
+ }
+
+ if (props.message.author.id === VENBOT_USER_ID) {
+ const match = CodeBlockRe.exec(props.message.content || props.message.embeds[0]?.rawDescription || "");
+ if (match) {
+ buttons.push(
+
+ );
+ }
+ }
+ }
+
+ return buttons.length
+ ? {buttons}
+ : null;
+ },
+
renderContributorDmWarningCard: ErrorBoundary.wrap(({ channel }) => {
const userId = channel.getRecipientId();
if (!isPluginDev(userId)) return null;
@@ -249,85 +327,4 @@ export default definePlugin({
);
}, { noop: true }),
-
- start() {
- addMessageAccessory("vencord-debug", props => {
- const buttons = [] as JSX.Element[];
-
- const shouldAddUpdateButton =
- !IS_UPDATER_DISABLED
- && (
- (props.channel.id === KNOWN_ISSUES_CHANNEL_ID) ||
- (props.channel.id === SUPPORT_CHANNEL_ID && props.message.author.id === VENBOT_USER_ID)
- )
- && props.message.content?.includes("update");
-
- if (shouldAddUpdateButton) {
- buttons.push(
-
- );
- }
-
- if (props.channel.id === SUPPORT_CHANNEL_ID) {
- if (props.message.content.includes("/vencord-debug") || props.message.content.includes("/vencord-plugins")) {
- buttons.push(
- ,
-
- );
- }
-
- if (props.message.author.id === VENBOT_USER_ID) {
- const match = CodeBlockRe.exec(props.message.content || props.message.embeds[0]?.rawDescription || "");
- if (match) {
- buttons.push(
-
- );
- }
- }
- }
-
- return buttons.length
- ? {buttons}
- : null;
- });
- },
});
diff --git a/src/plugins/clearURLs/index.ts b/src/plugins/clearURLs/index.ts
index d1be6c6f5..398eaf2fe 100644
--- a/src/plugins/clearURLs/index.ts
+++ b/src/plugins/clearURLs/index.ts
@@ -17,11 +17,7 @@
*/
import {
- addPreEditListener,
- addPreSendListener,
- MessageObject,
- removePreEditListener,
- removePreSendListener
+ MessageObject
} from "@api/MessageEvents";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
@@ -36,7 +32,14 @@ export default definePlugin({
name: "ClearURLs",
description: "Removes tracking garbage from URLs",
authors: [Devs.adryd],
- dependencies: ["MessageEventsAPI"],
+
+ onBeforeMessageSend(_, msg) {
+ return this.onSend(msg);
+ },
+
+ onBeforeMessageEdit(_cid, _mid, msg) {
+ return this.onSend(msg);
+ },
escapeRegExp(str: string) {
return (str && reHasRegExpChar.test(str))
@@ -133,17 +136,4 @@ export default definePlugin({
);
}
},
-
- start() {
- this.createRules();
- this.preSend = addPreSendListener((_, msg) => this.onSend(msg));
- this.preEdit = addPreEditListener((_cid, _mid, msg) =>
- this.onSend(msg)
- );
- },
-
- stop() {
- removePreSendListener(this.preSend);
- removePreEditListener(this.preEdit);
- },
});
diff --git a/src/plugins/hideAttachments/index.tsx b/src/plugins/hideAttachments/index.tsx
index 253e3d3be..e122e3cb5 100644
--- a/src/plugins/hideAttachments/index.tsx
+++ b/src/plugins/hideAttachments/index.tsx
@@ -17,7 +17,6 @@
*/
import { get, set } from "@api/DataStore";
-import { addMessagePopoverButton, removeMessagePopoverButton } from "@api/MessagePopover";
import { ImageInvisible, ImageVisible } from "@components/Icons";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
@@ -38,7 +37,20 @@ export default definePlugin({
name: "HideAttachments",
description: "Hide attachments and Embeds for individual messages via hover button",
authors: [Devs.Ven],
- dependencies: ["MessagePopoverAPI"],
+
+ renderMessagePopoverButton(msg) {
+ if (!msg.attachments.length && !msg.embeds.length && !msg.stickerItems.length) return null;
+
+ const isHidden = hiddenMessages.has(msg.id);
+
+ return {
+ label: isHidden ? "Show Attachments" : "Hide Attachments",
+ icon: isHidden ? ImageVisible : ImageInvisible,
+ message: msg,
+ channel: ChannelStore.getChannel(msg.channel_id),
+ onClick: () => this.toggleHide(msg.id)
+ };
+ },
async start() {
style = document.createElement("style");
@@ -47,26 +59,11 @@ export default definePlugin({
await getHiddenMessages();
await this.buildCss();
-
- addMessagePopoverButton("HideAttachments", msg => {
- if (!msg.attachments.length && !msg.embeds.length && !msg.stickerItems.length) return null;
-
- const isHidden = hiddenMessages.has(msg.id);
-
- return {
- label: isHidden ? "Show Attachments" : "Hide Attachments",
- icon: isHidden ? ImageVisible : ImageInvisible,
- message: msg,
- channel: ChannelStore.getChannel(msg.channel_id),
- onClick: () => this.toggleHide(msg.id)
- };
- });
},
stop() {
style.remove();
hiddenMessages.clear();
- removeMessagePopoverButton("HideAttachments");
},
async buildCss() {
diff --git a/src/plugins/invisibleChat.desktop/index.tsx b/src/plugins/invisibleChat.desktop/index.tsx
index 3862f18e4..d6a39cbaf 100644
--- a/src/plugins/invisibleChat.desktop/index.tsx
+++ b/src/plugins/invisibleChat.desktop/index.tsx
@@ -16,8 +16,7 @@
* along with this program. If not, see .
*/
-import { addChatBarButton, ChatBarButton, ChatBarButtonFactory } from "@api/ChatButtons";
-import { addMessagePopoverButton, removeMessagePopoverButton } from "@api/MessagePopover";
+import { ChatBarButton, ChatBarButtonFactory } from "@api/ChatButtons";
import { updateMessage } from "@api/MessageUpdater";
import { definePluginSettings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary";
@@ -104,7 +103,7 @@ export default definePlugin({
name: "InvisibleChat",
description: "Encrypt your Messages in a non-suspicious way!",
authors: [Devs.SammCheese],
- dependencies: ["MessagePopoverAPI", "ChatInputButtonAPI", "MessageUpdaterAPI"],
+ dependencies: ["MessageUpdaterAPI"],
reporterTestable: ReporterTestable.Patches,
settings,
@@ -125,36 +124,31 @@ export default definePlugin({
/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/,
),
async start() {
- addMessagePopoverButton("InvisibleChat", message => {
- return this.INV_REGEX.test(message?.content)
- ? {
- label: "Decrypt Message",
- icon: this.popOverIcon,
- message: message,
- channel: ChannelStore.getChannel(message.channel_id),
- onClick: async () => {
- const res = await iteratePasswords(message);
-
- if (res)
- this.buildEmbed(message, res);
- else
- buildDecModal({ message });
- }
- }
- : null;
- });
-
- addChatBarButton("InvisibleChat", ChatBarIcon);
-
const { default: StegCloak } = await getStegCloak();
steggo = new StegCloak(true, false);
},
- stop() {
- removeMessagePopoverButton("InvisibleChat");
- removeMessagePopoverButton("InvisibleChat");
+ renderMessagePopoverButton(message) {
+ return this.INV_REGEX.test(message?.content)
+ ? {
+ label: "Decrypt Message",
+ icon: this.popOverIcon,
+ message: message,
+ channel: ChannelStore.getChannel(message.channel_id),
+ onClick: async () => {
+ const res = await iteratePasswords(message);
+
+ if (res)
+ this.buildEmbed(message, res);
+ else
+ buildDecModal({ message });
+ }
+ }
+ : null;
},
+ renderChatBarButton: ChatBarIcon,
+
// Gets the Embed of a Link
async getEmbed(url: URL): Promise