From 393f76749a77998497466b284414f15ac9ad4135 Mon Sep 17 00:00:00 2001 From: Kode Date: Thu, 11 May 2023 18:33:08 +0100 Subject: [PATCH] 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 --- src/plugins/usrbg/index.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/plugins/usrbg/index.tsx b/src/plugins/usrbg/index.tsx index cdb7260b..0121d10a 100644 --- a/src/plugins/usrbg/index.tsx +++ b/src/plugins/usrbg/index.tsx @@ -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);