BadgeAPI: fix our badges not showing if there are 0 discord badges

This commit is contained in:
Vendicated 2024-06-08 21:56:59 +02:00
parent 50c4513737
commit 4bf28f4634
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18

View file

@ -93,17 +93,13 @@ export default definePlugin({
{
find: ".PANEL]:14",
replacement: {
match: /(?<=\i=\(0,\i\.default\)\(\i\);)return 0===\i.length/,
replace: "$& && $self.getBadges(arguments[0]?.displayProfile).length===0"
match: /(?<=(\i)=\(0,\i\.default\)\(\i\);)return 0===\i.length\?/,
replace: "$1.unshift(...$self.getBadges(arguments[0].displayProfile));$&"
}
},
{
find: ".description,delay:",
replacement: [
{
match: /...(\i)\}=\(0,\i\.useUserProfileAnalyticsContext\)\(\);/,
replace: "$&arguments[0].badges?.unshift(...$self.getBadges($1));"
},
{
// alt: "", aria-hidden: false, src: originalSrc
match: /alt:" ","aria-hidden":!0,src:(?=.{0,20}(\i)\.icon)/,