From 9570739232b198a2e40b390b7c0c573c9e3d547f Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Wed, 15 May 2024 10:35:02 -0400 Subject: [PATCH] Fix Dupe --- src/equicordplugins/validReply/index.ts | 70 ------------------------- src/plugins/validReply/README.md | 7 --- 2 files changed, 77 deletions(-) delete mode 100644 src/equicordplugins/validReply/index.ts delete mode 100644 src/plugins/validReply/README.md diff --git a/src/equicordplugins/validReply/index.ts b/src/equicordplugins/validReply/index.ts deleted file mode 100644 index 9ca8c33b..00000000 --- a/src/equicordplugins/validReply/index.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; -import { FluxDispatcher, RestAPI } from "@webpack/common"; -import { Message, User } from "discord-types/general"; -import { Channel } from "discord-types/general/index.js"; -interface Reply { - baseAuthor: User, - baseMessage: Message; - channel: Channel; - referencedMessage: { state: number; }; // 0 = normal, 1 = couldn't load, 2 = deleted - compact: boolean; - isReplyAuthorBlocked: boolean; -} -const fetching = new Map(); -let ReplyStore: any; -export default definePlugin({ - name: "ValidReply", - description: "Fixes \"Message could not be loaded\" upon hovering over the reply", - authors: [Devs.newwares], - patches: [ - { - find: "Messages.REPLY_QUOTE_MESSAGE_NOT_LOADED", - replacement: { - match: /Messages\.REPLY_QUOTE_MESSAGE_NOT_LOADED/, - replace: "$&,onMouseEnter:()=>$self.fetchReply(arguments[0])" - } - }, - { - find: "ReferencedMessageStore", - replacement: { - match: /constructor\(\)\{\i\(this,"_channelCaches",new Map\)/, - replace: "$&;$self.setReplyStore(this);" - } - } - ], - setReplyStore(store: any) { - ReplyStore = store; - }, - fetchReply(reply: Reply) { - const { channel_id: channel, message_id: message } = reply.baseMessage.messageReference!; - if (fetching.has(message)) { - return; - } - fetching.set(message, channel); - RestAPI.get({ - url: `/channels/${channel}/messages`, - query: { - limit: 1, - around: message - }, - retries: 2 - }).then(res => { - const reply: Message | undefined = res?.body?.[0]; - if (!reply) return; - ReplyStore.updateExistingMessageIfCached(reply); - FluxDispatcher.dispatch({ - type: "MESSAGE_UPDATE", - message: reply - }); - }).finally(() => { - fetching.delete(message); - }); - } -}); diff --git a/src/plugins/validReply/README.md b/src/plugins/validReply/README.md deleted file mode 100644 index 49e313cf..00000000 --- a/src/plugins/validReply/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# ValidReply - -Fixes referenced (replied to) messages showing as "Message could not be loaded". - -Hover the text to load the message! - -![](https://github.com/Vendicated/Vencord/assets/45801973/d3286acf-e822-4b7f-a4e7-8ced18f581af)