From dfc3f05834db65fc73fa939957a39498c0428a9c Mon Sep 17 00:00:00 2001 From: Vendicated Date: Sun, 23 Apr 2023 23:33:55 +0200 Subject: [PATCH] Fix RoleColorEverywhere crash --- src/plugins/roleColorEverywhere.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/roleColorEverywhere.tsx b/src/plugins/roleColorEverywhere.tsx index 65a1cc06..88a6cc24 100644 --- a/src/plugins/roleColorEverywhere.tsx +++ b/src/plugins/roleColorEverywhere.tsx @@ -53,7 +53,7 @@ export default definePlugin({ replacement: [ { match: /user:(\i),channel:(\i).{0,300}?"@"\.concat\(.+?\)/, - replace: "$&,color:$self.getUserColor($1.id,{channelId:$2?.id})" + replace: "$&,color:$self.getUserColor($1?.id,{channelId:$2?.id})" } ], predicate: () => settings.store.chatMentions, @@ -99,10 +99,12 @@ export default definePlugin({ if (!(guildId ??= ChannelStore.getChannel(channelId!)?.guild_id)) return null; return GuildMemberStore.getMember(guildId, userId)?.colorString ?? null; }, + getUserColor(userId: string, ids: { channelId?: string; guildId?: string; }) { const colorString = this.getColor(userId, ids); return colorString && parseInt(colorString.slice(1), 16); }, + roleGroupColor({ id, count, title, guildId }: { id: string; count: number; title: string; guildId: string; }) { const guild = GuildStore.getGuild(guildId); const role = guild?.roles[id]; @@ -113,6 +115,7 @@ export default definePlugin({ letterSpacing: ".05em" }}>{title} — {count}; }, + getVoiceProps({ user: { id: userId }, guildId }: { user: { id: string; }; guildId: string; }) { return { style: {