support managed APIs

This commit is contained in:
nin0dev 2025-01-23 04:00:11 -05:00
parent d1611dd0b0
commit b65f6b33ef
Signed by: nin0
SSH key fingerprint: SHA256:Is2DvJdw1OkSopR4wKJfdWV0fZhMLxpnCs1P1nPhIgA

View file

@ -16,7 +16,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { addPreSendListener, removePreSendListener } from "@api/MessageEvents";
import { definePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; 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 badVerbsGeneral = ["kill", "destroy"];
const badNounsGeneral = ["shit", "bullshit", "bitch", "bastard", "die", "brainless"]; const badNounsGeneral = ["shit", "bullshit", "bitch", "bastard", "die", "brainless"];
/** * FUN ***/ /** * FUN ***/
const badNounsFun = ["kotlin", "avast", "fres"]; const badNounsFun = ["kotlin", "avast"];
/** * REPLACEMENTS ***/ /** * 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"];
@ -76,14 +75,10 @@ export default definePlugin({
default: true default: true
} }
}), }),
async start() { onBeforeMessageSend: (c, msg) => {
this.preSend = addPreSendListener((_channelId, msg) => { // @ts-ignore
const newContent = this.replaceBadVerbs(this.replaceBadNouns(msg.content)); const newContent = this.replaceBadVerbs(this.replaceBadNouns(msg.content));
msg.content = newContent; msg.content = newContent;
});
},
stop() {
removePreSendListener(this.preSend);
}, },
getEnabledBadNouns() { getEnabledBadNouns() {
const thingToReturn: string[] = []; const thingToReturn: string[] = [];