mirror of
https://github.com/ION606/selmerBot.git
synced 2026-05-15 05:36:54 +00:00
Added cards to the leveling system, and fixed some bugs. Note that node-fetch has been bumped DOWN to v2 to avoid EMS format
This commit is contained in:
@@ -24,7 +24,8 @@ async function messageExists(message) {
|
||||
|
||||
|
||||
async function getResponse(convo, bot) {
|
||||
const response = await bot.openai.createCompletion({
|
||||
try {
|
||||
const response = await bot.openai.createCompletion({
|
||||
model: "text-davinci-002",
|
||||
prompt: convo,
|
||||
temperature: 0.9,
|
||||
@@ -36,6 +37,11 @@ async function getResponse(convo, bot) {
|
||||
});
|
||||
|
||||
return response;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async function convoManager(clientinp, bot, message) {
|
||||
@@ -78,6 +84,10 @@ async function convoManager(clientinp, bot, message) {
|
||||
//Get the response
|
||||
const r = await getResponse(convo, bot);
|
||||
|
||||
if (!r) {
|
||||
return message.channel.send("Uh oh! There's been an error! Please contact support \:[");
|
||||
}
|
||||
|
||||
let response = r.data.choices[0].text;
|
||||
|
||||
convo += (response + '\n');
|
||||
|
||||
Reference in New Issue
Block a user