From b65f6b33efb2cafbd0db675f01f034137769b26b Mon Sep 17 00:00:00 2001 From: nin0dev Date: Thu, 23 Jan 2025 04:00:11 -0500 Subject: [PATCH] support managed APIs --- index.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/index.ts b/index.ts index 8e394b5..406e420 100644 --- a/index.ts +++ b/index.ts @@ -16,7 +16,6 @@ * along with this program. If not, see . */ -import { addPreSendListener, removePreSendListener } from "@api/MessageEvents"; import { definePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; @@ -34,7 +33,7 @@ const badRegexesSlurs = ["\\bn{1,}(i|!|1){1,}(b|g){2,}(a|@|e|3){1,}?"]; const badVerbsGeneral = ["kill", "destroy"]; const badNounsGeneral = ["shit", "bullshit", "bitch", "bastard", "die", "brainless"]; /** * FUN ***/ -const badNounsFun = ["kotlin", "avast", "fres"]; +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 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"]; @@ -76,14 +75,10 @@ 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[] = [];