From 1d047a9fdfd3dd5f11c4b187cc9ff08cc98d7fdf Mon Sep 17 00:00:00 2001 From: OptimalBlock489 <89468732+OptimalBlock489@users.noreply.github.com> Date: Thu, 4 May 2023 01:57:56 +0530 Subject: [PATCH] Finally fixed the bug. I hope its the last pr. (#79) --- src/interactions/gpt.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/interactions/gpt.js b/src/interactions/gpt.js index 2267a1e..f72b1fc 100644 --- a/src/interactions/gpt.js +++ b/src/interactions/gpt.js @@ -42,22 +42,19 @@ const interactionGPT = async (bot, message) => { let returntext = await createCompletion(prompt); if (channel == "C0266FRGT") { return; // #announcements - } - returntext.then((result) => { - if (result.includes("Orpheus:")) { - result = result.replace("Orpheus:", "").trim(); - } - if (result.includes("<@")) { - result = - "Response cannot contain a ping, please try to avoid pinging people."; - } - bot.reply(message, transcript(result), (err, src) => { + } else if (returntext.includes("Orpheus:")) { + returntext = returntext.replace("Orpheus:", "").trim(); + } else if (returntext.includes("<@")) { + returntext = + "Response cannot contain a ping, please try to avoid pinging people."; + } else { + bot.reply(message, transcript(returntext), (err, src) => { if (err) { console.error(err); return; } }); - }); + }; }; -export default interactionGPT; +export default interactionGPT; \ No newline at end of file