Plugin

NoReplyMention

Disables reply pings by default

Chat Notifications
index.tsx
Download

Source

src/plugins/noReplyMention/index.tsx
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 type { Message } from "@vencord/discord-types";
11import { ChannelStore, GuildMemberStore } from "@webpack/common";
12
13const settings = definePluginSettings({
14 userList: {
15 description:
16 "List of user ids to allow or exempt pings for (separated by commas or spaces)",
17 type: OptionType.STRING,
18 default: "1234567890123445,1234567890123445",
19 multiline: true
20 },
21 roleList: {
22 description:
23 "List of role ids to allow or exempt pings for (separated by commas or spaces)",
24 type: OptionType.STRING,
25 default: "1234567890123445,1234567890123445",
26 multiline: true
27 },
28 shouldPingListed: {
29 description: "Behaviour",
30 type: OptionType.SELECT,
31 options: [
32 {
33 label: "Do not ping the listed users / roles",
34 value: false,
35 },
36 {
37 label: "Only ping the listed users / roles",
38 value: true,
39 default: true,
40 },
41 ],
42 },
43 inverseShiftReply: {
44 description: "Invert Discord's shift replying behaviour (enable to make shift reply mention user)",
45 type: OptionType.BOOLEAN,
46 default: false,
47 }
48});
49
50export default definePlugin({
51 name: "NoReplyMention",
52 description: "Disables reply pings by default",
53 tags: ["Chat", "Notifications"],
54 authors: [Devs.DustyAngel47, Devs.rae, Devs.pylix, Devs.outfoxxed],
55 settings,
56
57 shouldMention(message: Message, isHoldingShift: boolean) {
58 let isListed = settings.store.userList.includes(message.author.id);
59
60 const channel = ChannelStore.getChannel(message.channel_id);
61 if (channel?.guild_id && !isListed) {
62 const roles = GuildMemberStore.getMember(channel.guild_id, message.author.id)?.roles;
63 isListed = !!roles && roles.some(role => settings.store.roleList.includes(role));
64 }
65
66 const isExempt = settings.store.shouldPingListed ? isListed : !isListed;
67 return settings.store.inverseShiftReply ? isHoldingShift !== isExempt : !isHoldingShift && isExempt;
68 },
69
70 patches: [
71 {
72 find: ",\"Message\")}function",
73 replacement: {
74 match: /:(\i),shouldMention:!(\i)\.shiftKey/,
75 replace: ":$1,shouldMention:$self.shouldMention($1,$2.shiftKey)"
76 }
77 }
78 ],
79});
80