diff --git a/.gitignore b/.gitignore index 77c5116..936f5bd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ dist/ -config.json \ No newline at end of file +config.json +blacklist.json \ No newline at end of file diff --git a/src/events/onMessage.ts b/src/events/onMessage.ts index bdd7004..02aef88 100644 --- a/src/events/onMessage.ts +++ b/src/events/onMessage.ts @@ -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: {