Plugin

RelationshipNotifier

Notifies you when a friend, group chat, or server removes you.

Friends Notifications
index.ts
Download

Source

src/plugins/relationshipNotifier/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 { Devs } from "@utils/constants";
8import definePlugin from "@utils/types";
9
10import { onChannelDelete, onGuildDelete, onRelationshipRemove, removeFriend, removeGroup, removeGuild } from "./functions";
11import settings from "./settings";
12import { syncAndRunChecks, syncFriends, syncGroups, syncGuilds } from "./utils";
13
14export default definePlugin({
15 name: "RelationshipNotifier",
16 description: "Notifies you when a friend, group chat, or server removes you.",
17 tags: ["Friends", "Notifications"],
18 authors: [Devs.nick],
19 settings,
20
21 patches: [
22 {
23 find: "removeRelationship:(",
24 replacement: {
25 match: /(removeRelationship:\((\i),\i,\i\)=>)/,
26 replace: "$1($self.removeFriend($2),0)||"
27 }
28 },
29 {
30 find: "async leaveGuild(",
31 replacement: {
32 match: /(leaveGuild\((\i)\){)/,
33 replace: "$1$self.removeGuild($2);"
34 }
35 },
36 {
37 find: "},closePrivateChannel(",
38 replacement: {
39 match: /(closePrivateChannel\((\i)\){)/,
40 replace: "$1$self.removeGroup($2);"
41 }
42 }
43 ],
44
45 flux: {
46 GUILD_CREATE: syncGuilds,
47 GUILD_DELETE: onGuildDelete,
48 CHANNEL_CREATE: syncGroups,
49 CHANNEL_DELETE: onChannelDelete,
50 RELATIONSHIP_ADD: syncFriends,
51 RELATIONSHIP_UPDATE: syncFriends,
52 RELATIONSHIP_REMOVE(e) {
53 onRelationshipRemove(e);
54 syncFriends();
55 },
56 CONNECTION_OPEN: syncAndRunChecks
57 },
58
59 async start() {
60 setTimeout(() => {
61 syncAndRunChecks();
62 }, 5000);
63 },
64
65 removeFriend,
66 removeGroup,
67 removeGuild
68});
69