USRBG: Hide Nitro badge if banner's source is USRBG (#1096)

* Hide Nitro badge if banner's source is USRBG, tweaks to description

* Rename function

* Update src/plugins/usrbg/index.tsx

---------

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
Kode 2023-05-11 18:33:08 +01:00 committed by GitHub
parent 1fe7f3c297
commit 393f76749a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,8 +47,8 @@ const settings = definePluginSettings({
export default definePlugin({
name: "USRBG",
description: "USRBG is a community maintained database of Discord banners, allowing anyone to get a banner without requiring Nitro",
authors: [Devs.AutumnVN, Devs.pylix],
description: "Displays user banners from USRBG, allowing anyone to get a banner without Nitro",
authors: [Devs.AutumnVN, Devs.pylix, Devs.TheKodeToad],
settings,
patches: [
{
@ -61,6 +61,10 @@ export default definePlugin({
{
match: /(\i)\.bannerSrc,/,
replace: "$self.useBannerHook($1),"
},
{
match: /\?\(0,\i\.jsx\)\(\i,{type:\i,shown/,
replace: "&&$self.shouldShowBadge(arguments[0])$&"
}
]
},
@ -104,6 +108,10 @@ export default definePlugin({
if (data[userId]) return 2;
},
shouldShowBadge({ displayProfile, user }: any) {
return displayProfile?.banner && (!data[user.id] || settings.store.nitroFirst);
},
async start() {
enableStyle(style);