From 32062fbc0547e1821824ea362eb7481dbd06f910 Mon Sep 17 00:00:00 2001 From: camila314 <47485054+camila314@users.noreply.github.com> Date: Sun, 5 Nov 2023 20:17:58 -0600 Subject: [PATCH 01/26] Keyword Notify --- src/plugins/keywordNotify/index.tsx | 75 +++++++++++++++++++++++++++++ src/utils/constants.ts | 4 ++ 2 files changed, 79 insertions(+) create mode 100644 src/plugins/keywordNotify/index.tsx diff --git a/src/plugins/keywordNotify/index.tsx b/src/plugins/keywordNotify/index.tsx new file mode 100644 index 000000000..3633a0db5 --- /dev/null +++ b/src/plugins/keywordNotify/index.tsx @@ -0,0 +1,75 @@ +/* + * Vencord, a modification for Discord's desktop app + * Copyright (c) 2022 exhq + * + * 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, { OptionType } from "@utils/types"; +import { TextArea, useState, Forms } from "@webpack/common"; +import { definePluginSettings } from "@api/Settings"; +import { DataStore } from "@api/index"; + +let regexes = []; + +async function setRegexes(regs: string) { + regexes = regs.split("\n"); + await DataStore.set("KeywordNotify_rules", regexes); +} + +const settings = definePluginSettings({ + replace: { + type: OptionType.COMPONENT, + description: "", + component: () => { + const [value, setValue] = useState(regexes.join("\n")); + return ( + <> + Keyword Regexes (newline-separated) +