diff --git a/packages/discord-types/src/utils.d.ts b/packages/discord-types/src/utils.d.ts index df0621606..c71dd533f 100644 --- a/packages/discord-types/src/utils.d.ts +++ b/packages/discord-types/src/utils.d.ts @@ -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; diff --git a/src/equicordplugins/fullVcPfp/index.tsx b/src/equicordplugins/fullVcPfp/index.tsx index 7c1300fda..f1664da80 100644 --- a/src/equicordplugins/fullVcPfp/index.tsx +++ b/src/equicordplugins/fullVcPfp/index.tsx @@ -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); },