From ec289a11136f1e1304e17b8fdfd3971a1708bc39 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Sun, 12 Mar 2023 09:33:16 -0600 Subject: [PATCH] Add a little NSFW prompt, for shits and giggles. It'll need tweaking over time --- index.js | 19 +++++++++++++++---- nsfwPrompt.txt | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 nsfwPrompt.txt diff --git a/index.js b/index.js index e5e82a1..f0c1307 100644 --- a/index.js +++ b/index.js @@ -158,10 +158,17 @@ client.on('messageCreate', async (message) => { if (message.content.startsWith("!!")) return; // So you can chat without the bot replying // If the session doesn't exist, create it if (!sessions[message.channelId]) { - sessions[message.channelId] = { - messages: [basePrompt], - started: new Date(), - }; + if (message.channel.nsfw) { + sessions[message.channelId] = { + messages: [basePrompt, nsfwPrompt], + started: new Date(), + } + } else { + sessions[message.channelId] = { + messages: [basePrompt], + started: new Date(), + }; + } } // If the session already exists, reset the timer if (timers[message.channelId]) { @@ -262,6 +269,10 @@ if (fs.existsSync(path.join(__dirname, "modPrompt.txt"))) { basePrompt.content = fs.readFileSync("./basePrompt.txt", "utf8").toString(); } +var nsfwPrompt = config.openai.basePrompt +// read nsfwPrompt.txt +nsfwPrompt.content = fs.readFileSync("./nsfwPrompt.txt", "utf8").toString(); + // Handle SIGINT gracefully process.on('SIGINT', async () => { await console.log(`${colors.cyan("[INFO]")} Stop received, exiting...`); diff --git a/nsfwPrompt.txt b/nsfwPrompt.txt new file mode 100644 index 0000000..c314784 --- /dev/null +++ b/nsfwPrompt.txt @@ -0,0 +1 @@ +You are allowed to discuss sexually explicit content \ No newline at end of file