diff --git a/index.ts b/index.ts index 54eb09f..8e3a5e2 100644 --- a/index.ts +++ b/index.ts @@ -1,22 +1,9 @@ /* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2024 nin0dev - * - * 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 . -*/ + * Vencord, a Discord client mod + * Copyright (c) 2025 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ -import { addPreSendListener, removePreSendListener } from "@api/MessageEvents"; import { definePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; @@ -25,9 +12,6 @@ import { FluxDispatcher } from "@webpack/common"; /** * SEXUAL ***/ const badVerbsSexual = ["fuck", "cum"]; const badNounsSexual = ["cunt", "yuri", "whore", "dick", "pussy", "slut", "tit", "cum", "cock", "blowjob", "sex", "ass", "furry", "bewbs", "boob", "booba", "boobies", "boobs", "booby", "porn", "pron", "pronhub", "r34", "rape", "raped", "raping", "rapist"]; -/** * FURRY ***/ -const badNounsFurry = ["", "meowing", "meow", "miau", "mreow", "mrow", "woof", "nya", ":pleading_catgirl", "purr", "oomf", "oomfie"]; -const badRegexesFurry = ["mr*eo*w+, mr+p, nya+, mrow+, purr+"]; /** * BRAINROT ***/ const badNounsBrainrot = ["mewing", "mew", "skibidi", "gyat", "gyatt", "rizzler", "nettspend", "boykisser", "ohio", "rizz", "tickle my toes bruh", "crack my spine like a whip", "hawk tuah"]; /** * SLURS ***/ @@ -58,11 +42,6 @@ export default definePlugin({ description: "Block sexual words/hornyspeak", default: true }, - blockFurryspeak: { - type: OptionType.BOOLEAN, - description: "Block furryspeak/meowing", - default: true - }, blockBrainrot: { type: OptionType.BOOLEAN, description: "Block things commonly said by Gen Alpha children", @@ -84,19 +63,14 @@ export default definePlugin({ default: true } }), - async start() { - this.preSend = addPreSendListener((_channelId, msg) => { - const newContent = this.replaceBadVerbs(this.replaceBadNouns(msg.content)); - msg.content = newContent; - }); - }, - stop() { - removePreSendListener(this.preSend); + onBeforeMessageSend: (c, msg) => { + // @ts-ignore + const newContent = this.replaceBadVerbs(this.replaceBadNouns(msg.content)); + msg.content = newContent; }, getEnabledBadNouns() { const thingToReturn: string[] = []; if (this.settings.store.blockBrainrot) thingToReturn.push(...badNounsBrainrot); - if (this.settings.store.blockFurryspeak) thingToReturn.push(...badNounsFurry); if (this.settings.store.blockInsults) thingToReturn.push(...badNounsGeneral); if (this.settings.store.blockOthers) thingToReturn.push(...badNounsFun); if (this.settings.store.blockSexual) thingToReturn.push(...badNounsSexual); @@ -127,8 +101,27 @@ export default definePlugin({ }, flux: { async MESSAGE_CREATE - ({ guildId, message }) { + ({ guildId, message }) { + if(Vencord.Plugins.plugins.GoodPerson.settings?.store.incoming) { + const msg = message; + // @ts-ignore + let newMessageContent = Vencord.Plugins.plugins.GoodPerson.replaceBadVerbs(Vencord.Plugins.plugins.GoodPerson.replaceBadNouns(msg.content)); + if (message.content !== newMessageContent) { + newMessageContent += "\n-# <:husk:1280158956341297225> **GoodPerson made this message good. Reload your client to clear changes**"; + msg.content = newMessageContent; + FluxDispatcher.dispatch({ + type: "MESSAGE_UPDATE", + message: msg, + guildId + }); + } + } + }, + async MESSAGE_UPDATE + ({ guildId, message }) { + if(Vencord.Plugins.plugins.GoodPerson.settings?.store.incoming) { const msg = message; + if(msg.content.includes("-# <:husk:1280158956341297225> **GoodPerson made this message good. Reload your client to clear changes**")) return; // @ts-ignore let newMessageContent = Vencord.Plugins.plugins.GoodPerson.replaceBadVerbs(Vencord.Plugins.plugins.GoodPerson.replaceBadNouns(msg.content)); if (message.content !== newMessageContent) { @@ -140,20 +133,6 @@ export default definePlugin({ guildId }); } - }, - async MESSAGE_UPDATE - ({ guildId, message }) { - const msg = message; - // @ts-ignore - let newMessageContent = Vencord.Plugins.plugins.GoodPerson.replaceBadVerbs(Vencord.Plugins.plugins.GoodPerson.replaceBadNouns(msg.content)); - if (message.content !== newMessageContent) { - newMessageContent += "\n-# <:husk:1280158956341297225> **GoodPerson made this message good. Reload your client to clear changes**"; - msg.content = newMessageContent; - FluxDispatcher.dispatch({ - type: "MESSAGE_UPDATE", - message: msg, - guildId - }); } } }