From f6122a00ca9d5259ca8c97e88045ee9b9936ab70 Mon Sep 17 00:00:00 2001 From: Pedro Date: Thu, 15 Dec 2022 11:05:44 -0300 Subject: feat(NoReplyMention): exempt list support (#337) --- src/plugins/noReplyMention.ts | 35 ------------------------- src/plugins/noReplyMention.tsx | 58 ++++++++++++++++++++++++++++++++++++++++++ src/utils/constants.ts | 4 +++ 3 files changed, 62 insertions(+), 35 deletions(-) delete mode 100644 src/plugins/noReplyMention.ts create mode 100644 src/plugins/noReplyMention.tsx diff --git a/src/plugins/noReplyMention.ts b/src/plugins/noReplyMention.ts deleted file mode 100644 index 620274c..0000000 --- a/src/plugins/noReplyMention.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2022 Vendicated and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ - -import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; - -export default definePlugin({ - name: "NoReplyMention", - description: "Disables reply pings by default", - authors: [Devs.DustyAngel47], - patches: [ - { - find: "CREATE_PENDING_REPLY:function", - replacement: { - match: /CREATE_PENDING_REPLY:function\((.{1,2})\){/, - replace: "CREATE_PENDING_REPLY:function($1){$1.shouldMention=false;" - } - } - ] -}); diff --git a/src/plugins/noReplyMention.tsx b/src/plugins/noReplyMention.tsx new file mode 100644 index 0000000..91a88d3 --- /dev/null +++ b/src/plugins/noReplyMention.tsx @@ -0,0 +1,58 @@ +/* + * Vencord, a modification for Discord's desktop app + * Copyright (c) 2022 Vendicated and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +import { Settings } from "@api/settings"; +import { Devs } from "@utils/constants"; +import definePlugin, { OptionType } from "@utils/types"; + +interface Reply { + message: { + author: { + id: string; + }; + }; +} + +export default definePlugin({ + name: "NoReplyMention", + description: "Disables reply pings by default", + authors: [Devs.DustyAngel47, Devs.axyie], + options: { + exemptList: { + description: + "List of users to exempt from this plugin (separated by commas)", + type: OptionType.STRING, + default: "1234567890123445,1234567890123445", + }, + }, + shouldMention(reply: Reply) { + return Settings.plugins.NoReplyMention.exemptList.includes( + reply.message.author.id + ); + }, + patches: [ + { + find: "CREATE_PENDING_REPLY:function", + replacement: { + match: /CREATE_PENDING_REPLY:function\((.{1,2})\){/, + replace: + "CREATE_PENDING_REPLY:function($1){$1.shouldMention=Vencord.Plugins.plugins.NoReplyMention.shouldMention($1);", + }, + }, + ], +}); diff --git a/src/utils/constants.ts b/src/utils/constants.ts index faff732..6c7b540 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -173,4 +173,8 @@ export const Devs = Object.freeze({ name: "ActuallyTheSun", id: 406028027768733696n }, + axyie: { + name: "'ax", + id: 273562710745284628n, + }, }); -- cgit