Plugin

UserPFP

Allows you to use an animated avatar without Nitro

index.tsx
Download

Source

src/plugins/usrpfp/index.tsx
1/*
2 * FiveCord — a Discord client mod
3 * Copyright (c) 2025 FiveCord
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
7import { definePluginSettings } from "@api/Settings";
8import { Link } from "@components/Link";
9import { Devs } from "@utils/constants";
10import definePlugin, { OptionType } from "@utils/types";
11import { User } from "discord-types/general";
12
13const BASE_URL = "https:class="ts-cmt">//userpfp.github.io/UserPFP/source/data.json";
14
15let data = {
16 avatars: {} as Record<string, string>,
17};
18
19const settings = definePluginSettings({
20 preferNitro: {
21 description:
22 "Which avatar to use if both default animated (Nitro) pfp and UserPFP avatars are present",
23 type: OptionType.SELECT,
24 options: [
25 { label: "UserPFP", value: false },
26 { label: "Nitro", value: true, default: true },
27 ],
28 },
29});
30
31export default definePlugin({
32 data,
33
34 name: "UserPFP",
35 description: "Allows you to use an animated avatar without Nitro",
36 authors: [Devs.FiveCord],
37 settings,
38 settingsAboutComponent: () => (
39 <Link href="https:class="ts-cmt">//userpfp.github.io/UserPFP/#how-to-request-a-profile-picture-pfp">
40 <b>SUBMIT YOUR OWN PFP HERE</b>
41 </Link>
42 ),
43 patches: [
44 {
45 // Normal Profiles
46 find: "getUserAvatarURL:",
47 replacement: [
48 {
49 match: /(getUserAvatarURL:)(\i),/,
50 replace: "$1$self.getAvatarHook($2),"
51 },
52 {
53 match: /(getUserAvatarURL:\i\(\){return )(\i)}/,
54 replace: "$1$self.getAvatarHook($2)}"
55 }
56 ]
57 }
58 ],
59
60 getAvatarHook: (original: any) => (user: User, animated: boolean, size: number) => {
61 if (settings.store.preferNitro && user.avatar?.startsWith("a_")) return original(user, animated, size);
62
63 return data.avatars[user.id] ?? original(user, animated, size);
64 },
65
66 async start() {
67 const res = await fetch(BASE_URL);
68 if (res.ok) this.data = data = await res.json();
69 },
70});
71