Plugin
RelationshipNotifier
Notifies you when a friend, group chat, or server removes you.
1
/*2
* FiveCord — a Discord client mod3
* Copyright (c) 2025 FiveCord4
* SPDX-License-Identifier: GPL-3.0-or-later5
*/6
7
import { Devs } from "@utils/constants";8
import definePlugin from "@utils/types";9
10
import { onChannelDelete, onGuildDelete, onRelationshipRemove, removeFriend, removeGroup, removeGuild } from "./functions";11
import settings from "./settings";12
import { syncAndRunChecks, syncFriends, syncGroups, syncGuilds } from "./utils";13
14
export 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: syncAndRunChecks57
},58
59
async start() {60
setTimeout(() => {61
syncAndRunChecks();62
}, 5000);63
},64
65
removeFriend,66
removeGroup,67
removeGuild68
});69