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