From 3d80cb2d551b43c54d2e2accf5d7b45fb575c60a Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Mon, 19 Aug 2024 17:50:21 -0300 Subject: [PATCH 1/2] Delete AutomodContext ~ Now a stock feature --- src/plugins/automodContext/README.md | 5 -- src/plugins/automodContext/index.tsx | 73 ---------------------------- 2 files changed, 78 deletions(-) delete mode 100644 src/plugins/automodContext/README.md delete mode 100644 src/plugins/automodContext/index.tsx diff --git a/src/plugins/automodContext/README.md b/src/plugins/automodContext/README.md deleted file mode 100644 index f70d71d90..000000000 --- a/src/plugins/automodContext/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# AutomodContext - -Allows you to jump to the messages surrounding an automod hit - -![Visualization](https://github.com/Vendicated/Vencord/assets/61953774/d13740c8-2062-4553-b975-82fd3d6cc08b) diff --git a/src/plugins/automodContext/index.tsx b/src/plugins/automodContext/index.tsx deleted file mode 100644 index 5425c5526..000000000 --- a/src/plugins/automodContext/index.tsx +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import ErrorBoundary from "@components/ErrorBoundary"; -import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; -import { findByPropsLazy } from "@webpack"; -import { Button, ChannelStore, Text } from "@webpack/common"; - -const { selectChannel } = findByPropsLazy("selectChannel", "selectVoiceChannel"); - -function jumpToMessage(channelId: string, messageId: string) { - const guildId = ChannelStore.getChannel(channelId)?.guild_id; - - selectChannel({ - guildId, - channelId, - messageId, - jumpType: "INSTANT" - }); -} - -function findChannelId(message: any): string | null { - const { embeds: [embed] } = message; - const channelField = embed.fields.find(({ rawName }) => rawName === "channel_id"); - - if (!channelField) { - return null; - } - - return channelField.rawValue; -} - -export default definePlugin({ - name: "AutomodContext", - description: "Allows you to jump to the messages surrounding an automod hit.", - authors: [Devs.JohnyTheCarrot], - - patches: [ - { - find: ".Messages.GUILD_AUTOMOD_REPORT_ISSUES", - replacement: { - match: /\.Messages\.ACTIONS.+?}\)(?=,(\(0.{0,40}\.dot.*?}\)),)/, - replace: (m, dot) => `${m},${dot},$self.renderJumpButton({message:arguments[0].message})` - } - } - ], - - renderJumpButton: ErrorBoundary.wrap(({ message }: { message: any; }) => { - const channelId = findChannelId(message); - - if (!channelId) { - return null; - } - - return ( - - ); - }, { noop: true }) -}); From 66b247b2d3e6f1fda1621f5c0e154d6120b13bb2 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Tue, 20 Aug 2024 04:13:21 -0300 Subject: [PATCH 2/2] Fix persisting $$vencordPatchedSource when a module is loaded again --- src/webpack/patchWebpack.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/webpack/patchWebpack.ts b/src/webpack/patchWebpack.ts index 4629434ae..fb640cea8 100644 --- a/src/webpack/patchWebpack.ts +++ b/src/webpack/patchWebpack.ts @@ -355,8 +355,16 @@ function patchFactories(factories: Record