diff --git a/events/messageCreate.js b/events/messageCreate.js index 07dbf8b..95925d5 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -3,6 +3,7 @@ const openAI = require('openai'); const chalk = require('chalk'); const ms = require('ms'); const fs = require('node:fs'); +const path = require('node:path'); const func = require('../utils/functions'); const settings = require('../utils/settings'); const config = require('../configs/config.json'); @@ -349,12 +350,14 @@ if (message.content.toLowerCase().startsWith(config.Prefix)) { // Function to handle direct messages async function handleDirectMessage(message) { + const knowledge = fs.readFileSync(path.join(__dirname, 'completion.txt'), 'utf-8'); + if (conversations.has(message.author.id)) { const oldMessages = conversations.get(message.author.id); let messages = [{ "role": "system", - "content": completionPrompt + "content": `You are a unique user in a Discord server. Engage in conversations naturally, considering the context and your surroundings. Share your thoughts, opinions, and experiences as if you were a real person. Use emojis, slang, and a casual tone to blend in with other users. Avoid sounding robotic or generic, and aim to create a distinct personality that others can relate to and enjoy interacting with. Your knowledge base: ${knowledge}` }]; messages = messages.concat(oldMessages);