roleColorEverywhere: role group color in thread/forum (#1778)

main
AutumnVN 11 months ago committed by GitHub
parent a522eab40d
commit 188d12d1a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -44,7 +44,7 @@ const settings = definePluginSettings({
export default definePlugin({ export default definePlugin({
name: "RoleColorEverywhere", name: "RoleColorEverywhere",
authors: [Devs.KingFish, Devs.lewisakura], authors: [Devs.KingFish, Devs.lewisakura, Devs.AutumnVN],
description: "Adds the top role color anywhere possible", description: "Adds the top role color anywhere possible",
patches: [ patches: [
// Chat Mentions // 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 ",.\]/, match: /(memo\(\(function\((\i)\).{300,500}CHANNEL_MEMBERS_A11Y_LABEL.{100,200}roleIcon.{5,20}null,).," \u2014 ",.\]/,
replace: "$1$self.roleGroupColor($2)]" replace: "$1$self.roleGroupColor($2)]"
}, },
{
match: /children:\[.," \u2014 ",.\]/,
replace: "children:[$self.roleGroupColor(arguments[0])]"
},
], ],
predicate: () => settings.store.memberList, predicate: () => settings.store.memberList,
}, },
@ -105,7 +109,7 @@ export default definePlugin({
return colorString && parseInt(colorString.slice(1), 16); 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 guild = GuildStore.getGuild(guildId);
const role = guild?.roles[id]; const role = guild?.roles[id];
@ -113,7 +117,7 @@ export default definePlugin({
color: role?.colorString, color: role?.colorString,
fontWeight: "unset", fontWeight: "unset",
letterSpacing: ".05em" letterSpacing: ".05em"
}}>{title} &mdash; {count}</span>; }}>{title ?? label} &mdash; {count}</span>;
}, },
getVoiceProps({ user: { id: userId }, guildId }: { user: { id: string; }; guildId: string; }) { getVoiceProps({ user: { id: userId }, guildId }: { user: { id: string; }; guildId: string; }) {

Loading…
Cancel
Save