From 9eaeb241960cd4be73f67e4aa6d02ba03a4a5d89 Mon Sep 17 00:00:00 2001 From: redstonekasi Date: Thu, 26 Oct 2023 00:56:39 +0200 Subject: [PATCH] fix: RoleColorEverywhere (#1884) Co-authored-by: Vendicated --- src/plugins/roleColorEverywhere/index.tsx | 39 ++++++++++++----------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/plugins/roleColorEverywhere/index.tsx b/src/plugins/roleColorEverywhere/index.tsx index e4fa4fe10..d718f4027 100644 --- a/src/plugins/roleColorEverywhere/index.tsx +++ b/src/plugins/roleColorEverywhere/index.tsx @@ -49,10 +49,10 @@ export default definePlugin({ patches: [ // Chat Mentions { - find: 'className:"mention"', + find: "CLYDE_AI_MENTION_COLOR:null,", replacement: [ { - match: /user:(\i),channel:(\i).{0,300}?"@"\.concat\(.+?\)/, + match: /user:(\i),channel:(\i).{0,400}?"@"\.concat\(.+?\)/, replace: "$&,color:$self.getUserColor($1?.id,{channelId:$2?.id})" } ], @@ -60,37 +60,34 @@ export default definePlugin({ }, // Slate { - // taken from CommandsAPI - find: ".source,children", + find: ".userTooltip,children", replacement: [ { - match: /function \i\((\i)\).{5,20}id.{5,20}guildId.{5,10}channelId.{100,150}hidePersonalInformation.{5,50}jsx.{5,20},{/, - replace: "$&color:$self.getUserColor($1.id,{guildId:$1?.guildId})," + match: /let\{id:(\i),guildId:(\i)[^}]*\}.*?\.default,{(?=children)/, + replace: "$&color:$self.getUserColor($1,{guildId:$2})," } ], predicate: () => settings.store.chatMentions, }, - // Member List Role Names { - find: ".memberGroupsPlaceholder", + find: 'tutorialId:"whos-online', replacement: [ { - match: /(memo\(\(function\((\i)\).{300,500}CHANNEL_MEMBERS_A11Y_LABEL.{100,200}roleIcon.{5,20}null,).," \u2014 ",.\]/, - replace: "$1$self.roleGroupColor($2)]" + match: /\i.roleIcon,\.\.\.\i/, + replace: "$&,color:$self.roleGroupColor(arguments[0])" }, { - match: /children:\[.," \u2014 ",.\]/, - replace: "children:[$self.roleGroupColor(arguments[0])]" + match: /null,\i," — ",\i\]/, + replace: "null,$self.roleGroupColor(arguments[0])]" }, ], predicate: () => settings.store.memberList, }, - // Voice chat users { find: "renderPrioritySpeaker", replacement: [ { - match: /renderName=function\(\).{50,75}speaking.{50,100}jsx.{5,10}{/, + match: /renderName\(\).{0,100}speaking:.{50,100}jsx.{5,10}{/, replace: "$&...$self.getVoiceProps(this.props)," } ], @@ -113,11 +110,15 @@ export default definePlugin({ const guild = GuildStore.getGuild(guildId); const role = guild?.roles[id]; - return {title ?? label} — {count}; + return ( + + {title ?? label} — {count} + + ); }, getVoiceProps({ user: { id: userId }, guildId }: { user: { id: string; }; guildId: string; }) {