FullVCPFP fix blank guild_icon (#908)

* fullVcPfpfix

* fix isSpeaking server

* t

* Update index.tsx

---------

Co-authored-by: thororen1234 <78185467+thororen1234@users.noreply.github.com>
This commit is contained in:
oma 2026-03-14 19:20:19 -04:00 • committed by GitHub
parent 3a19be4802
commit a5830e597e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 34 deletions

View file

@ -202,7 +202,7 @@ export interface IconUtils {
getUserAvatarURL(user: User, canAnimate?: boolean, size?: number, format?: string): string;
getDefaultAvatarURL(id: string, discriminator?: string): string;
getUserBannerURL(data: { id: string, banner: string, canAnimate?: boolean, size: number; }): string | undefined;
getAvatarDecorationURL(dara: { avatarDecoration: string, size: number; canCanimate?: boolean; }): string | undefined;
getAvatarDecorationURL(data: { avatarDecoration: string, size: number; canCanimate?: boolean; }): string | undefined;
getGuildMemberAvatarURL(member: GuildMember, canAnimate?: string): string | null;
getGuildMemberAvatarURLSimple(data: { guildId: string, userId: string, avatar: string, canAnimate?: boolean; size?: number; }): string;

View file

@ -4,27 +4,17 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { definePluginSettings } from "@api/Settings";
import { disableStyle, enableStyle } from "@api/Styles";
import { EquicordDevs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { ChannelRTCStore, ChannelStore, GuildMemberStore, IconUtils, UserStore, VoiceStateStore } from "@webpack/common";
import definePlugin from "@utils/types";
import { ChannelRTCStore, ChannelStore, UserStore, VoiceStateStore } from "@webpack/common";
import style from "./style.css?managed";
const settings = definePluginSettings({
useServerProfileAvatars: {
type: OptionType.BOOLEAN,
description: "Use server profile avatars in guild voice channels when available.",
default: false
}
});
export default definePlugin({
name: "FullVCPFP",
description: "Makes avatars take up the entire vc tile",
authors: [EquicordDevs.mochienya],
settings,
patches: [
{
find: "\"data-selenium-video-tile\":",
@ -35,8 +25,8 @@ export default definePlugin({
},
],
getVoiceBackgroundStyles({ className, participantUserId }: any) {
if (!className.includes("tile") || !participantUserId) return;
getVoiceBackgroundStyles({ className, participantUserId }: { className?: string; participantUserId?: string; }) {
if (!className?.includes("tile") || !participantUserId) return;
const user = UserStore.getUser(participantUserId);
if (!user) return;
@ -44,32 +34,15 @@ export default definePlugin({
const channelId = VoiceStateStore.getVoiceStateForUser(participantUserId)?.channelId;
if (!channelId) return;
const guildId = ChannelStore.getChannel(channelId)?.guild_id;
const isSpeaking = ChannelRTCStore.getSpeakingParticipants(channelId).some(p => p.user.id === participantUserId && p.speaking);
const avatarUrl = settings.store.useServerProfileAvatars
? this.getServerAvatarUrl(participantUserId, channelId, isSpeaking) ?? IconUtils.getUserAvatarURL(user, isSpeaking, 1024)
: IconUtils.getUserAvatarURL(user, isSpeaking, 1024);
const avatarUrl = user.getAvatarURL(guildId, 1024, isSpeaking);
return {
"--full-res-avatar": `url(${avatarUrl})`
};
},
getServerAvatarUrl(userId: string, channelId: string, canAnimate: boolean) {
const guildId = ChannelStore.getChannel(channelId)?.guild_id;
if (!guildId) return;
const guildAvatar = GuildMemberStore.getMember(guildId, userId)?.avatar;
if (!guildAvatar) return;
return IconUtils.getGuildMemberAvatarURLSimple({
userId,
guildId,
avatar: guildAvatar,
canAnimate,
size: 1024
});
},
start() {
enableStyle(style);
},