fix: RoleColorEverywhere (#1884)
Co-authored-by: Vendicated <vendicated@riseup.net>
This commit is contained in:
		
							parent
							
								
									6b28e5ad85
								
							
						
					
					
						commit
						9eaeb24196
					
				
					 1 changed files with 20 additions and 19 deletions
				
			
		| 
						 | 
					@ -49,10 +49,10 @@ export default definePlugin({
 | 
				
			||||||
    patches: [
 | 
					    patches: [
 | 
				
			||||||
        // Chat Mentions
 | 
					        // Chat Mentions
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            find: 'className:"mention"',
 | 
					            find: "CLYDE_AI_MENTION_COLOR:null,",
 | 
				
			||||||
            replacement: [
 | 
					            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})"
 | 
					                    replace: "$&,color:$self.getUserColor($1?.id,{channelId:$2?.id})"
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            ],
 | 
					            ],
 | 
				
			||||||
| 
						 | 
					@ -60,37 +60,34 @@ export default definePlugin({
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        // Slate
 | 
					        // Slate
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            // taken from CommandsAPI
 | 
					            find: ".userTooltip,children",
 | 
				
			||||||
            find: ".source,children",
 | 
					 | 
				
			||||||
            replacement: [
 | 
					            replacement: [
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    match: /function \i\((\i)\).{5,20}id.{5,20}guildId.{5,10}channelId.{100,150}hidePersonalInformation.{5,50}jsx.{5,20},{/,
 | 
					                    match: /let\{id:(\i),guildId:(\i)[^}]*\}.*?\.default,{(?=children)/,
 | 
				
			||||||
                    replace: "$&color:$self.getUserColor($1.id,{guildId:$1?.guildId}),"
 | 
					                    replace: "$&color:$self.getUserColor($1,{guildId:$2}),"
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            ],
 | 
					            ],
 | 
				
			||||||
            predicate: () => settings.store.chatMentions,
 | 
					            predicate: () => settings.store.chatMentions,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        // Member List Role Names
 | 
					 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            find: ".memberGroupsPlaceholder",
 | 
					            find: 'tutorialId:"whos-online',
 | 
				
			||||||
            replacement: [
 | 
					            replacement: [
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    match: /(memo\(\(function\((\i)\).{300,500}CHANNEL_MEMBERS_A11Y_LABEL.{100,200}roleIcon.{5,20}null,).," \u2014 ",.\]/,
 | 
					                    match: /\i.roleIcon,\.\.\.\i/,
 | 
				
			||||||
                    replace: "$1$self.roleGroupColor($2)]"
 | 
					                    replace: "$&,color:$self.roleGroupColor(arguments[0])"
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    match: /children:\[.," \u2014 ",.\]/,
 | 
					                    match: /null,\i," — ",\i\]/,
 | 
				
			||||||
                    replace: "children:[$self.roleGroupColor(arguments[0])]"
 | 
					                    replace: "null,$self.roleGroupColor(arguments[0])]"
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
            ],
 | 
					            ],
 | 
				
			||||||
            predicate: () => settings.store.memberList,
 | 
					            predicate: () => settings.store.memberList,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        // Voice chat users
 | 
					 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            find: "renderPrioritySpeaker",
 | 
					            find: "renderPrioritySpeaker",
 | 
				
			||||||
            replacement: [
 | 
					            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),"
 | 
					                    replace: "$&...$self.getVoiceProps(this.props),"
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            ],
 | 
					            ],
 | 
				
			||||||
| 
						 | 
					@ -113,11 +110,15 @@ export default definePlugin({
 | 
				
			||||||
        const guild = GuildStore.getGuild(guildId);
 | 
					        const guild = GuildStore.getGuild(guildId);
 | 
				
			||||||
        const role = guild?.roles[id];
 | 
					        const role = guild?.roles[id];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return <span style={{
 | 
					        return (
 | 
				
			||||||
 | 
					            <span style={{
 | 
				
			||||||
                color: role?.colorString,
 | 
					                color: role?.colorString,
 | 
				
			||||||
                fontWeight: "unset",
 | 
					                fontWeight: "unset",
 | 
				
			||||||
                letterSpacing: ".05em"
 | 
					                letterSpacing: ".05em"
 | 
				
			||||||
        }}>{title ?? label} — {count}</span>;
 | 
					            }}>
 | 
				
			||||||
 | 
					                {title ?? label} — {count}
 | 
				
			||||||
 | 
					            </span>
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    getVoiceProps({ user: { id: userId }, guildId }: { user: { id: string; }; guildId: string; }) {
 | 
					    getVoiceProps({ user: { id: userId }, guildId }: { user: { id: string; }; guildId: string; }) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue