This commit is contained in:
Raven Scott
2023-04-10 02:42:58 +02:00
parent 8b24a80279
commit 27d8ad1f78
4 changed files with 29 additions and 12 deletions

View File

@ -2,7 +2,7 @@ const Discord = require('discord.js');
const fetch = require('node-fetch');
const emptyResponses = require('./assets/emptyMessages.js');
const {resetResponses, userResetMessages} = require('./assets/resetMessages.js');
const errorMessages = require('./assets/errorMessages.js');
const {errorMessages, busyResponses} = require('./assets/errorMessages.js');
require('dotenv').config()
// hi
@ -49,7 +49,8 @@ client.on('messageCreate', async (message) => {
if (conversations.get(message.author.id)?.busy) {
message.delete()
await message.author.send("I'm currently busy with another process. Please try again later.");
const busyResponse = busyResponses[Math.floor(Math.random() * busyResponses.length)];
await message.author.send(busyResponse); // give a notification of reset using a human like response.
return;
}
@ -152,6 +153,7 @@ async function generateResponse(conversation) {
});
const responseData = await response.json();
console.log(JSON.stringify(responseData))
const choice = responseData.choices[0];
// Remove "user None:" and any text after it from the response