From 5620fb6d6382b46c5783ce76a3a6859567fdae0b Mon Sep 17 00:00:00 2001 From: GURU Date: Sat, 29 Jul 2023 21:00:47 +0530 Subject: [PATCH] Update GURU-Openai.js --- plugins/GURU-Openai.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/GURU-Openai.js b/plugins/GURU-Openai.js index c8291de4c6..5054e3617a 100644 --- a/plugins/GURU-Openai.js +++ b/plugins/GURU-Openai.js @@ -1,7 +1,15 @@ import fetch from 'node-fetch'; let handler = async (m, { text, usedPrefix, command }) => { - if (!text) throw `*Enter a request or an order to use ChatGpt*\n\n*Example*\n* ${usedPrefix + command} Latest Netflix series*\n* ${usedPrefix + command} write a JS code*`; + + if (!text && !(m.quoted && m.quoted.text)) { + throw `Please provide some text or quote a message to get a response.`; + } + + + if (!text && m.quoted && m.quoted.text) { + text = m.quoted.text; + } try { const response = await fetch(`https://gurugpt4-85987f3ed9b3.herokuapp.com/api/gpt4?query=${encodeURIComponent(text)}`);