From 188d12d1a3de40f536011f679de1ec52be4dc32e Mon Sep 17 00:00:00 2001 From: AutumnVN Date: Fri, 13 Oct 2023 09:26:18 +0700 Subject: roleColorEverywhere: role group color in thread/forum (#1778) --- src/plugins/roleColorEverywhere/index.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/plugins/roleColorEverywhere/index.tsx b/src/plugins/roleColorEverywhere/index.tsx index 8b256f4..e4fa4fe 100644 --- a/src/plugins/roleColorEverywhere/index.tsx +++ b/src/plugins/roleColorEverywhere/index.tsx @@ -44,7 +44,7 @@ const settings = definePluginSettings({ export default definePlugin({ name: "RoleColorEverywhere", - authors: [Devs.KingFish, Devs.lewisakura], + authors: [Devs.KingFish, Devs.lewisakura, Devs.AutumnVN], description: "Adds the top role color anywhere possible", patches: [ // Chat Mentions @@ -78,6 +78,10 @@ export default definePlugin({ match: /(memo\(\(function\((\i)\).{300,500}CHANNEL_MEMBERS_A11Y_LABEL.{100,200}roleIcon.{5,20}null,).," \u2014 ",.\]/, replace: "$1$self.roleGroupColor($2)]" }, + { + match: /children:\[.," \u2014 ",.\]/, + replace: "children:[$self.roleGroupColor(arguments[0])]" + }, ], predicate: () => settings.store.memberList, }, @@ -105,7 +109,7 @@ export default definePlugin({ return colorString && parseInt(colorString.slice(1), 16); }, - roleGroupColor({ id, count, title, guildId }: { id: string; count: number; title: string; guildId: string; }) { + roleGroupColor({ id, count, title, guildId, label }: { id: string; count: number; title: string; guildId: string; label: string; }) { const guild = GuildStore.getGuild(guildId); const role = guild?.roles[id]; @@ -113,7 +117,7 @@ export default definePlugin({ color: role?.colorString, fontWeight: "unset", letterSpacing: ".05em" - }}>{title} — {count}; + }}>{title ?? label} — {count}; }, getVoiceProps({ user: { id: userId }, guildId }: { user: { id: string; }; guildId: string; }) { -- cgit