Skip to content

Commit

Permalink
Update GURU-Openai.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Guru322 authored Jul 29, 2023
1 parent 6c986f3 commit 5620fb6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion plugins/GURU-Openai.js
Original file line number Diff line number Diff line change
@@ -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)}`);
Expand Down

0 comments on commit 5620fb6

Please sign in to comment.