forked from userplugins/vc-goodperson
Compare commits
10 commits
Author | SHA1 | Date | |
---|---|---|---|
e55d79519e | |||
b65f6b33ef | |||
d1611dd0b0 | |||
4beec45850 | |||
e943fc9460 | |||
e0488f23bc | |||
3fd131ddcb | |||
53217612b8 | |||
724905c8ce | |||
22604bbc4b |
1 changed files with 125 additions and 56 deletions
181
index.ts
181
index.ts
|
@ -1,70 +1,139 @@
|
||||||
/*
|
/*
|
||||||
* Vencord, a modification for Discord's desktop app
|
* Vencord, a Discord client mod
|
||||||
* Copyright (c) 2024 nin0dev
|
* Copyright (c) 2025 Vendicated and contributors
|
||||||
*
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
* 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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { addPreSendListener, removePreSendListener } from "@api/MessageEvents";
|
import { definePluginSettings } from "@api/Settings";
|
||||||
import definePlugin from "@utils/types";
|
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
|
import { FluxDispatcher } from "@webpack/common";
|
||||||
|
|
||||||
const badVerbs = ["fuck", " cum", "kill", "destroy", "orgasm", "orgasming"];
|
/** * SEXUAL ***/
|
||||||
const badNouns = ["fag","fucking","dickhead", "motherfucker", "sigma", "asshole", "cunt", "shit", "bullshit", "ass", "bitch", "nigga", "hell", "whore", "dick", "piss", "pussy", "slut", "tit", "cum", "cock", "retard", "blowjob", "bastard", "kotlin", "die", "sex", "nigger", "brainless", "mant", "mew", "skibidi", "gyat", "rizzler", "avast", "yuri", "faggot"];
|
const badVerbsSexual = ["fuck", "cum"];
|
||||||
const badVerbsReplacements = ["move", "draw", "deconstruct", "fly", "fart", "teach", "display", "plug", "explode", "run", "walk", "freeze", "beat", "free", "brush", "allocate", "date", "melt", "breed", "educate", "injure", "change"];
|
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"];
|
||||||
const badNounsReplacements = ["pasta", "kebab", "cake", "potato", "woman", "computer", "java", "hamburger", "monster truck", "osu!", "Ukrainian ball in search of gas game", "cheese", "wheat", "good", "keyboard", "NVIDIA RTX 3090 Graphics Card", "storm", "queen", "single", "umbrella", "mosque", "physics", "desk", "virus", "bathroom", "corn", "owner", "airport", "Avast Antivirus Free"];
|
/** * 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"];
|
||||||
function replaceBadNouns(content: string): string {
|
/** * SLURS ***/
|
||||||
const regex = new RegExp('\\b(' + badNouns.join('|') + ')(s)?\\b', 'gi');
|
const badNounsSlurs = ["retard", "faggot", "fag", "faggots", "fags", "retards", "n*g", "n*gg*", "n*gg*r"];
|
||||||
|
const badRegexesSlurs = ["\\bn{1,}(i|!|1){1,}(b|g){2,}(a|@|e|3){1,}?"];
|
||||||
return content.replace(regex, function (match, p1, p2) {
|
/** * GENERAL ***/
|
||||||
const randomIndex = Math.floor(Math.random() * badNounsReplacements.length);
|
const badVerbsGeneral = ["kill", "destroy"];
|
||||||
let replacement = badNounsReplacements[randomIndex];
|
const badNounsGeneral = ["shit", "bullshit", "bitch", "bastard", "die", "brainless"];
|
||||||
if (p2) {
|
/** * FUN ***/
|
||||||
replacement += 's'; // Keep the plural 's' if the match was plural
|
const badNounsFun = ["kotlin", "avast"];
|
||||||
}
|
/** * REPLACEMENTS ***/
|
||||||
return replacement;
|
const badVerbsReplacements = ["love", "eat", "deconstruct", "marry", "fart", "teach", "display", "plug", "explode", "undress", "finish", "freeze", "beat", "free", "brush", "allocate", "date", "melt", "breed", "educate", "injure", "change"];
|
||||||
});
|
const badNounsReplacements = ["pasta", "kebab", "cake", "potato", "woman", "computer", "java", "hamburger", "monster truck", "osu!", "Ukrainian ball in search of gas game", "Anime", "Anime girl", "good", "keyboard", "NVIDIA RTX 3090 Graphics Card", "storm", "queen", "single", "umbrella", "mosque", "physics", "bath", "virus", "bathroom", "mom", "owner", "airport", "Avast Antivirus Free"];
|
||||||
}
|
|
||||||
|
|
||||||
function replaceBadVerbs(content: string): string {
|
|
||||||
const regex = new RegExp('\\b(' + badVerbs.join('|') + ')(s)?\\b', 'gi');
|
|
||||||
|
|
||||||
return content.replace(regex, function (match, p1, p2) {
|
|
||||||
const randomIndex = Math.floor(Math.random() * badVerbsReplacements.length);
|
|
||||||
let replacement = badVerbsReplacements[randomIndex];
|
|
||||||
if (p2) {
|
|
||||||
replacement += 's'; // Keep the plural 's' if the match was plural
|
|
||||||
}
|
|
||||||
return replacement;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "GoodPerson",
|
name: "GoodPerson",
|
||||||
description: "Makes you a good person",
|
description: "Makes you (or others) a good person",
|
||||||
authors: [Devs.nin0dev],
|
authors: [Devs.nin0dev, Devs.mantikafasi],
|
||||||
dependencies: ["MessageEventsAPI"],
|
dependencies: ["MessageEventsAPI"],
|
||||||
|
settings: definePluginSettings({
|
||||||
|
incoming: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Filter incoming messages",
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
blockSexual: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Block sexual words/hornyspeak",
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
blockBrainrot: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Block things commonly said by Gen Alpha children",
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
blockSlurs: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Block targeted slurs",
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
blockInsults: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Block more general insults",
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
blockOthers: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Block words mantikafasi personally dislikes",
|
||||||
|
default: true
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
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.blockInsults) thingToReturn.push(...badNounsGeneral);
|
||||||
|
if (this.settings.store.blockOthers) thingToReturn.push(...badNounsFun);
|
||||||
|
if (this.settings.store.blockSexual) thingToReturn.push(...badNounsSexual);
|
||||||
|
if (this.settings.store.blockSlurs) thingToReturn.push(...badNounsSlurs);
|
||||||
|
return thingToReturn;
|
||||||
|
},
|
||||||
|
getEnabledBadVerbs() {
|
||||||
|
const thingToReturn: string[] = [];
|
||||||
|
if (this.settings.store.blockSexual) thingToReturn.push(...badVerbsSexual);
|
||||||
|
if (this.settings.store.blockInsults) thingToReturn.push(...badVerbsGeneral);
|
||||||
|
return thingToReturn;
|
||||||
|
},
|
||||||
|
replaceBadNouns(content) {
|
||||||
|
const regex = new RegExp("\\b(" + this.getEnabledBadNouns().join("|") + ")\\b", "gi");
|
||||||
|
|
||||||
async start() {
|
return content.replace(regex, function (match) {
|
||||||
this.preSend = addPreSendListener((channelId, msg) => {
|
const randomIndex = Math.floor(Math.random() * badNounsReplacements.length);
|
||||||
const newContent = replaceBadVerbs(replaceBadNouns(msg.content));
|
return badNounsReplacements[randomIndex];
|
||||||
msg.content = newContent;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
replaceBadVerbs(content) {
|
||||||
|
const regex = new RegExp("\\b(" + this.getEnabledBadVerbs().join("|") + ")\\b", "gi");
|
||||||
|
|
||||||
stop() {
|
return content.replace(regex, function (match) {
|
||||||
removePreSendListener(this.preSend);
|
const randomIndex = Math.floor(Math.random() * badVerbsReplacements.length);
|
||||||
|
return badVerbsReplacements[randomIndex];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
flux: {
|
||||||
|
async MESSAGE_CREATE
|
||||||
|
({ 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) {
|
||||||
|
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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue