Plugin
NoPendingCount
Removes the ping count of incoming friend requests, message requests, and nitro offers.
1
import { definePluginSettings } from "@api/Settings";2
import { Devs } from "@utils/constants";3
import definePlugin, { OptionType } from "@utils/types";4
import { findByPropsLazy } from "@webpack";5
6
const MessageRequestStore = findByPropsLazy("getMessageRequestsCount");7
8
const settings = definePluginSettings({9
hideFriendRequestsCount: {10
type: OptionType.BOOLEAN,11
description: "Hide incoming friend requests count",12
default: true,13
restartNeeded: true14
},15
hideMessageRequestsCount: {16
type: OptionType.BOOLEAN,17
description: "Hide message requests count",18
default: true,19
restartNeeded: true20
},21
hidePremiumOffersCount: {22
type: OptionType.BOOLEAN,23
description: "Hide nitro offers count",24
default: true,25
restartNeeded: true26
}27
});28
29
export default definePlugin({30
name: "NoPendingCount",31
description: "Removes the ping count of incoming friend requests, message requests, and nitro offers.",32
tags: ["Notifications", "Appearance"],33
authors: [Devs.amia],34
35
settings: settings,36
37
// Functions used to determine the top left count indicator can be found in the single module that calls getUnacknowledgedOffers(...)38
// or by searching for "showProgressBadge:"39
patches: [40
{41
find: "getPendingCount(){",42
predicate: () => settings.store.hideFriendRequestsCount,43
replacement: {44
match: /(?<=getPendingCount\(\)\{)/,45
replace: "return 0;"46
}47
},48
// Message requests hook49
{50
find: "getMessageRequestsCount(){",51
predicate: () => settings.store.hideMessageRequestsCount,52
replacement: {53
match: /(?<=getMessageRequestsCount\(\)\{)/,54
replace: "return 0;"55
}56
},57
// This prevents the Message Requests tab from always hiding due to the previous patch (and is compatible with spam requests)58
// In short, only the red badge is hidden. Button visibility behavior isn't changed.59
{60
find: ".getSpamChannelsCount();return",61
predicate: () => settings.store.hideMessageRequestsCount,62
replacement: {63
match: /(?<=getSpamChannelsCount\(\);return )\i\.getMessageRequestsCount\(\)/,64
replace: "$self.getRealMessageRequestCount()"65
}66
},67
{68
find: "showProgressBadge:",69
predicate: () => settings.store.hidePremiumOffersCount,70
replacement: {71
// The two groups inside the first group grab the minified names of the variables,72
// they are then referenced later to find unviewedTrialCount + unviewedDiscountCount.73
match: /(\{unviewedTrialCount:(\i),unviewedDiscountCount:(\i)\}.+?)\2\+\3/,74
replace: (_, rest) => `${rest}0`75
}76
}77
],78
79
getRealMessageRequestCount() {80
return MessageRequestStore.getMessageRequestChannelIds().size;81
}82
});83