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

@ -29,4 +29,4 @@ const emptyResponses = [
"I wish I had some grand insight to share, but alas, I don't have much to offer in that regard."
];
module.exports = emptyResponses;
module.exports = emptyResponses;

View File

@ -21,12 +21,27 @@ const errorMessages = [
"Oopsie daisy! Give !reset a try and we'll start over."
];
module.exports = errorMessages;
const busyResponses = [
"Sorry about that! Looks like I'm tied up at the moment. Please try again later.",
"Oops, I'm currently busy with something else. Please try again later.",
"Looks like I'm already working on something. Can you try again later?",
"I'm currently occupied with another process. Can you try again later?",
"I'm currently unavailable. Can you try again in a bit?",
"Looks like I'm currently busy. Can you check back later?",
"I'm currently engaged with another process. Please try again later.",
"I'm afraid I'm currently occupied with another request. Can you try again later?",
"Sorry, I'm currently busy with another task. Can you try again later?",
"I'm currently tied up with another request. Please try again later.",
"Looks like I'm currently busy with something else. Can you try again later?",
"I'm currently engaged with another task. Please try again later.",
"Sorry, I'm currently occupied with another process. Can you try again later?",
"I'm currently occupied with another task. Can you try again later?",
"I'm currently in the middle of another process. Can you try again later?",
"Sorry, I'm currently engaged with another task. Please try again later.",
"I'm currently in the middle of something else. Please try again later.",
"I'm afraid I'm busy with something else at the moment. Can you try again later?",
"Looks like I'm currently engaged with something else. Please try again later.",
"I'm currently unavailable. Can you try again later?"
];
module.exports = { errorMessages, busyResponses};

View File

@ -44,4 +44,4 @@ const resetResponses = [
"Conversation reset, confirmed! What do you need help with?"
];
module.exports = {resetResponses, userResetMessages};
module.exports = {resetResponses, userResetMessages};

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