Plugin
UserPFP
Allows you to use an animated avatar without Nitro
1
/*2
* FiveCord — a Discord client mod3
* Copyright (c) 2025 FiveCord4
* SPDX-License-Identifier: GPL-3.0-or-later5
*/6
7
import { definePluginSettings } from "@api/Settings";8
import { Link } from "@components/Link";9
import { Devs } from "@utils/constants";10
import definePlugin, { OptionType } from "@utils/types";11
import { User } from "discord-types/general";12
13
const BASE_URL = "https:class="ts-cmt">//userpfp.github.io/UserPFP/source/data.json";14
15
let data = {16
avatars: {} as Record<string, string>,17
};18
19
const 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
31
export 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 Profiles46
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