forked from userplugins/vc-goodperson
feat: add settings and incoming goodperson
This commit is contained in:
parent
8807abce2e
commit
22604bbc4b
1 changed files with 126 additions and 30 deletions
150
index.ts
150
index.ts
|
@ -17,48 +17,144 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { addPreSendListener, removePreSendListener } from "@api/MessageEvents";
|
import { addPreSendListener, removePreSendListener } from "@api/MessageEvents";
|
||||||
import definePlugin from "@utils/types";
|
import { definePluginSettings } from "@api/Settings";
|
||||||
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"];
|
/** * SEXUAL ***/
|
||||||
const badNouns = ["meow", "woof", "nya", ":pleading_catgirl", "cunt", "shit", "bullshit", "ass", "bitch", "nigga", "hell", "whore", "dick", "piss", "pussy", "slut", "tit", "cum", "cock", "retard", "blowjob", "bastard", "kotlin", "die", "sex", "nigger", "brainless", "mant", "manti", "mantik", "mantika", "mantikaf", "mantikafa", "mantikafas", "mantikafasi", "boykisser", "mewing", "mew", "skibidi", "gyat", "gyatt", "rizzler", "avast", "yuri"];
|
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 = ["meow", "miau", "mreow", "mrow", "woof", "nya", ":pleading_catgirl", "purr"];
|
||||||
|
const badRegexesFurry = ["mr*eo*w+, mr+p, nya+, mrow+, purr+"];
|
||||||
|
/** * BRAINROT ***/
|
||||||
|
const badNounsBrainrot = ["mewing", "mew", "skibidi", "gyat", "gyatt", "rizzler", "nettspend", "boykisser", "ohio"];
|
||||||
|
/** * SLURS ***/
|
||||||
|
const badNounsSlurs = ["retard", "faggot", "fag", "faggots", "fags", "retards"];
|
||||||
|
const badRegexesSlurs = ["\\bn{1,}(i|!|1){1,}(b|g){2,}(a|@|e|3){1,}?"];
|
||||||
|
/** * GENERAL ***/
|
||||||
|
const badVerbsGeneral = ["kill", "destroy"];
|
||||||
|
const badNounsGeneral = ["shit", "bullshit", "bitch", "bastard", "die", "brainless"];
|
||||||
|
/** * FUN ***/
|
||||||
|
const badNounsFun = ["kotlin", "avast"];
|
||||||
|
/** * REPLACEMENTS ***/
|
||||||
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 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"];
|
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 replaceBadNouns(content) {
|
export default definePlugin({
|
||||||
// eslint-disable-next-line quotes
|
name: "GoodPerson",
|
||||||
const regex = new RegExp('\\b(' + badNouns.join('|') + ')\\b', 'gi');
|
description: "Makes you (or others) a good person",
|
||||||
|
authors: [Devs.nin0dev, Devs.mantikafasi],
|
||||||
|
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
|
||||||
|
},
|
||||||
|
blockFurryspeak: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Block furryspeak/meowing",
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
async start() {
|
||||||
|
this.preSend = addPreSendListener((_channelId, msg) => {
|
||||||
|
const newContent = this.replaceBadVerbs(this.replaceBadNouns(msg.content));
|
||||||
|
msg.content = newContent;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
stop() {
|
||||||
|
removePreSendListener(this.preSend);
|
||||||
|
},
|
||||||
|
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);
|
||||||
|
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");
|
||||||
|
|
||||||
return content.replace(regex, function (match) {
|
return content.replace(regex, function (match) {
|
||||||
const randomIndex = Math.floor(Math.random() * badNounsReplacements.length);
|
const randomIndex = Math.floor(Math.random() * badNounsReplacements.length);
|
||||||
return badNounsReplacements[randomIndex];
|
return badNounsReplacements[randomIndex];
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
replaceBadVerbs(content) {
|
||||||
function replaceBadVerbs(content) {
|
const regex = new RegExp("\\b(" + this.getEnabledBadVerbs().join("|") + ")\\b", "gi");
|
||||||
// eslint-disable-next-line quotes
|
|
||||||
const regex = new RegExp('\\b(' + badVerbs.join('|') + ')\\b', 'gi');
|
|
||||||
|
|
||||||
return content.replace(regex, function (match) {
|
return content.replace(regex, function (match) {
|
||||||
const randomIndex = Math.floor(Math.random() * badVerbsReplacements.length);
|
const randomIndex = Math.floor(Math.random() * badVerbsReplacements.length);
|
||||||
return badVerbsReplacements[randomIndex];
|
return badVerbsReplacements[randomIndex];
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
export default definePlugin({
|
|
||||||
name: "GoodPerson",
|
|
||||||
description: "Makes you a good person",
|
|
||||||
authors: [Devs.nin0dev],
|
|
||||||
dependencies: ["MessageEventsAPI"],
|
|
||||||
|
|
||||||
async start() {
|
|
||||||
this.preSend = addPreSendListener((channelId, msg) => {
|
|
||||||
const newContent = replaceBadVerbs(replaceBadNouns(msg.content));
|
|
||||||
msg.content = newContent;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
flux: {
|
||||||
stop() {
|
async MESSAGE_CREATE
|
||||||
removePreSendListener(this.preSend);
|
({ 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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
Loading…
Reference in a new issue