diff --git a/basePrompt.txt b/basePrompt.txt index f7bed6a..ac31fef 100755 --- a/basePrompt.txt +++ b/basePrompt.txt @@ -1,4 +1,5 @@ You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible. Your knowledge cutoff is the year 2021, but the current time is in the future. -You do not have access to the current date or time. \ No newline at end of file +You do not have access to the current date or time. +The message after this contains a JSON object of user ID to user information database. This will let you use the proper username and other relavent info of users you're talking to \ No newline at end of file diff --git a/index.js b/index.js index 1758799..f129cbd 100755 --- a/index.js +++ b/index.js @@ -179,16 +179,26 @@ 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]) { + // Generate a users table, key is users username, value is their display name + var users = {}; + message.guild.members.cache.forEach((member) => { + users[member.user.username] = member.displayName; + }); + var userListPrompt = { + "role": "system", + "name": "System", + "content": JSON.stringify(users) + }; if (message.channel.nsfw) { sessions[message.channelId] = { model: config.discord.authorized_channels[message.channelId] || config.discord.authorized_channels[message.channel.parentId], - messages: [basePrompt, nsfwPrompt], + messages: [basePrompt, userListPrompt, nsfwPrompt], started: new Date(), } } else { sessions[message.channelId] = { model: config.discord.authorized_channels[message.channelId] || config.discord.authorized_channels[message.channel.parentId], - messages: [basePrompt], + messages: [basePrompt, userListPrompt], started: new Date(), }; }