From 5aa19bbf49839c31f4a15fa96994c3fb2ce22e31 Mon Sep 17 00:00:00 2001 From: Elvyra <88881326+EdVraz@users.noreply.github.com> Date: Sat, 20 Apr 2024 11:18:03 +0200 Subject: [PATCH 1/4] fix ValidUser (#2369) --- src/plugins/validUser/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/validUser/index.tsx b/src/plugins/validUser/index.tsx index b0c77cb46..dafa7bc98 100644 --- a/src/plugins/validUser/index.tsx +++ b/src/plugins/validUser/index.tsx @@ -111,7 +111,7 @@ function MentionWrapper({ data, UserMention, RoleMention, parse, props }: Mentio export default definePlugin({ name: "ValidUser", - description: "Fix mentions for unknown users showing up as '<@343383572805058560>' (hover over a mention to fix it)", + description: "Fix mentions for unknown users showing up as '@unknown-user' (hover over a mention to fix it)", authors: [Devs.Ven], tags: ["MentionCacheFix"], @@ -119,7 +119,7 @@ export default definePlugin({ find: 'className:"mention"', replacement: { // mention = { react: function (data, parse, props) { if (data.userId == null) return RoleMention() else return UserMention() - match: /react(?=\(\i,\i,\i\).{0,50}return null==\i\?\(0,\i\.jsx\)\((\i\.\i),.+?jsx\)\((\i\.\i),\{className:"mention")/, + match: /react(?=\(\i,\i,\i\).{0,50}return null==.{0,70}\?\(0,\i\.jsx\)\((\i\.\i),.+?jsx\)\((\i\.\i),\{className:"mention")/, // react: (...args) => OurWrapper(RoleMention, UserMention, ...args), originalReact: theirFunc replace: "react:(...args)=>$self.renderMention($1,$2,...args),originalReact" } From 87ef214810e561cd37649d3b4eec4dbbbd7e018d Mon Sep 17 00:00:00 2001 From: Vendicated Date: Sat, 20 Apr 2024 11:29:15 +0200 Subject: [PATCH 2/4] RoleColorEverywhere: fix chat mentions --- src/plugins/roleColorEverywhere/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/roleColorEverywhere/index.tsx b/src/plugins/roleColorEverywhere/index.tsx index 6d53906f8..71c291fef 100644 --- a/src/plugins/roleColorEverywhere/index.tsx +++ b/src/plugins/roleColorEverywhere/index.tsx @@ -50,7 +50,7 @@ export default definePlugin({ patches: [ // Chat Mentions { - find: "CLYDE_AI_MENTION_COLOR:null,", + find: 'location:"UserMention', replacement: [ { match: /user:(\i),channel:(\i).{0,400}?"@"\.concat\(.+?\)/, From 74df53e7c8d81abf77ca67ab7432a5a8bfc8e4f6 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Sat, 20 Apr 2024 11:37:22 +0200 Subject: [PATCH 3/4] ValidUser: fix not working for @unknown-user mentions --- src/plugins/validUser/index.tsx | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/plugins/validUser/index.tsx b/src/plugins/validUser/index.tsx index dafa7bc98..d3decd941 100644 --- a/src/plugins/validUser/index.tsx +++ b/src/plugins/validUser/index.tsx @@ -115,15 +115,24 @@ export default definePlugin({ authors: [Devs.Ven], tags: ["MentionCacheFix"], - patches: [{ - find: 'className:"mention"', - replacement: { - // mention = { react: function (data, parse, props) { if (data.userId == null) return RoleMention() else return UserMention() - match: /react(?=\(\i,\i,\i\).{0,50}return null==.{0,70}\?\(0,\i\.jsx\)\((\i\.\i),.+?jsx\)\((\i\.\i),\{className:"mention")/, - // react: (...args) => OurWrapper(RoleMention, UserMention, ...args), originalReact: theirFunc - replace: "react:(...args)=>$self.renderMention($1,$2,...args),originalReact" + patches: [ + { + find: 'className:"mention"', + replacement: { + // mention = { react: function (data, parse, props) { if (data.userId == null) return RoleMention() else return UserMention() + match: /react(?=\(\i,\i,\i\).{0,50}return null==.{0,70}\?\(0,\i\.jsx\)\((\i\.\i),.+?jsx\)\((\i\.\i),\{className:"mention")/, + // react: (...args) => OurWrapper(RoleMention, UserMention, ...args), originalReact: theirFunc + replace: "react:(...args)=>$self.renderMention($1,$2,...args),originalReact" + } + }, + { + find: "unknownUserMentionPlaceholder:", + replacement: { + match: /unknownUserMentionPlaceholder:/, + replace: "$&false&&" + } } - }], + ], renderMention(RoleMention, UserMention, data, parse, props) { return ( From 0bebc85b0dc08c9345210499dc9d24dd14c64ac0 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Sat, 20 Apr 2024 11:50:28 +0200 Subject: [PATCH 4/4] fix FriendsSince on canary --- src/plugins/friendsSince/index.tsx | 16 +++++++++++++--- src/webpack/webpack.ts | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/plugins/friendsSince/index.tsx b/src/plugins/friendsSince/index.tsx index dd37137a4..69d8e739d 100644 --- a/src/plugins/friendsSince/index.tsx +++ b/src/plugins/friendsSince/index.tsx @@ -7,12 +7,22 @@ import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; import { getCurrentChannel } from "@utils/discord"; +import { makeLazy } from "@utils/lazy"; import definePlugin from "@utils/types"; -import { findByPropsLazy } from "@webpack"; +import { filters, find, findByPropsLazy, handleModuleNotFound } from "@webpack"; import { React, RelationshipStore } from "@webpack/common"; const { Heading, Text } = findByPropsLazy("Heading", "Text"); -const container = findByPropsLazy("memberSinceContainer"); +// Workaround for module differing on stable & canary +// FIXME: remove once merged into stable +const getMemberSinceContainer = makeLazy(() => { + for (const name of ["memberSinceWrapper", "memberSinceContainer"]) { + const mod = find(filters.byProps(name), { isIndirect: true }); + if (mod) return mod[name]; + } + handleModuleNotFound("findByProps", "memberSinceWrapper/memberSinceContainer"); + return ""; +}); const { getCreatedAtDate } = findByPropsLazy("getCreatedAtDate"); const clydeMoreInfo = findByPropsLazy("clydeMoreInfo"); const locale = findByPropsLazy("getLocale"); @@ -49,7 +59,7 @@ export default definePlugin({ Friends Since -
+
{!!getCurrentChannel()?.guild_id && (