Plugin

NoPendingCount

Removes the ping count of incoming friend requests, message requests, and nitro offers.

Notifications Appearance
index.ts
Download

Source

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