Allow usage of blacklist/denylist for censoring words

1984 (apparently people forgot how to not want it say slurs so I have no
     choice)
pull/1/head
Drake 2 years ago
parent 7a32f8cd07
commit 0971467547

3
.gitignore vendored

@ -1,2 +1,3 @@
dist/
config.json
config.json
blacklist.json

@ -1,7 +1,8 @@
import { db, Channel } from "../database.ts";
import { BotEmitter } from "@wackford/mod.ts";
import { AIs } from "../ai/index.ts";
import config from "../../config.json" assert { type: "json" };
import config from "../config.ts";
import blacklist from "../../blacklist.json" assert { type: "json" };
//const dirname = new URL(".", import.meta.url).pathname;
@ -19,7 +20,7 @@ export default function init() {
await bot.helpers.startTyping(message.channelId);
const res = await AIs[message.channelId.toString()].complete(user.username, message.content)
let res = await AIs[message.channelId.toString()].complete(user.username, message.content)
const history = channel.history ?? []
@ -35,6 +36,10 @@ export default function init() {
history
})
blacklist.forEach((val) => {
res = res.replaceAll(val, `${val[0]}${"\\*".repeat(val.length - 1)}`)
})
await bot.helpers.sendMessage(message.channelId, {
content: `[${AIs[message.channelId.toString()].name}] ${res}`,
messageReference: {

Loading…
Cancel
Save