Plugin
DeadMembers
Shows when the sender of a message has left the guild
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
import { ChannelStore, GuildMemberStore, useStateFromStores } from "@webpack/common";10
11
export default definePlugin({12
name: "DeadMembers",13
description: "Shows when the sender of a message has left the guild",14
authors: [Devs.FiveCord],15
16
patches: [17
{18
find: "UsernameDecorationTypes:function()",19
replacement: {20
match: /(\i)=\{className:\i.username,style:.*?onContextMenu:\i,children:.*?\}/,21
replace: "$&,{}=$1.children=$self.wrapMessageAuthor(arguments[0],$1.children)"22
}23
},24
{25
find: "Messages.FORUM_POST_AUTHOR_A11Y_LABEL",26
replacement: {27
match: /(?<=\}=(\i),\{(user:\i,author:\i)\}=.{0,400}?\(\i\.Fragment,{children:)\i(?=}\),)/,28
replace: "$self.wrapForumAuthor({...$1,$2},$&)"29
}30
},31
],32
33
wrapMessageAuthor({ message }, text) {34
const channel = ChannelStore.getChannel(message.channel_id);35
return message.webhookId36
? text37
: <DeadIndicator38
channel={channel}39
userId={message.author.id}40
text={text}41
/>;42
},43
44
wrapForumAuthor({ channel, user }, text) {45
return !user46
? text47
: <DeadIndicator48
channel={channel}49
userId={user.id}50
text={text}51
/>;52
},53
});54
55
56
function DeadIndicator({ channel, userId, text }) {57
const isMember = useStateFromStores(58
[GuildMemberStore],59
() => GuildMemberStore.isMember(channel?.guild_id, userId),60
);61
return channel?.guild_id && !isMember ? <s className="c98-author-dead">{text}</s> : text;62
}63