From ce1fe839ecd52d99326c459236ea958eb4f95f90 Mon Sep 17 00:00:00 2001 From: sahoogurucharan00 Date: Sun, 21 Jul 2024 13:59:30 +0000 Subject: [PATCH] updates --- plugins/GURU-gpt4.js | 69 ++++++++++++++++++-------------------------- plugins/Guru-dark.js | 38 ++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 41 deletions(-) create mode 100644 plugins/Guru-dark.js diff --git a/plugins/GURU-gpt4.js b/plugins/GURU-gpt4.js index b8c5195b6a..5c26f6e929 100644 --- a/plugins/GURU-gpt4.js +++ b/plugins/GURU-gpt4.js @@ -1,51 +1,38 @@ -import displayLoadingScreen from '../lib/loading.js' -import fetch from 'node-fetch' -import { delay } from '@whiskeysockets/baileys' +import fetch from 'node-fetch'; let handler = async (m, { conn, text, args, usedPrefix, command }) => { try { - if (!text) throw `uhm.. what do you want to say?` - m.react('🤖') - //await displayLoadingScreen(conn, m.chat) + if (!text) throw 'uhm.. what do you want to say?'; + await m.react('🤖'); - const prompt = encodeURIComponent(text) - let apiurl = `https://ultimetron.guruapi.tech/gpt4?prompt=${prompt}` + const prompt = encodeURIComponent(text); + let apiurl = `https://ultimetron.guruapi.tech/gpt4?prompt=${prompt}`; - const result = await fetch(apiurl) - const response = await result.json() - console.log(response) - const textt = response.result - await typewriterEffect(conn, m, m.chat, textt) + const result = await fetch(apiurl); + const response = await result.json(); + + if (!response.result) throw 'No result found'; + + const replyText = response.result; + await conn.sendButton( + m.chat, + replyText, + author, + 'https://telegra.ph/file/c3f9e4124de1f31c1c6ae.jpg', + [['Script', `.sc`]], + null, + [['Follow Me', `https://github.com/Guru322`]], + m + ); } catch (error) { - console.error(error) - m.reply('Oops! Something went wrong. , we are trying had to fix it asap') + console.error(error); + m.reply('Oops! Something went wrong. We are trying hard to fix it ASAP.'); } -} -handler.help = ['gemini '] -handler.tags = ['tools'] -handler.command = /^(gpt4)$/i - -export default handler +}; -async function typewriterEffect(conn, quoted, from, text) { - let { key } = await conn.sendMessage(from, { text: 'Thinking...' }, { quoted: quoted }) +handler.help = ['gpt4 ']; +handler.tags = ['tools']; +handler.command = /^(gpt4)$/i; - for (let i = 0; i < text.length; i++) { - const noobText = text.slice(0, i + 1) - await conn.relayMessage( - from, - { - protocolMessage: { - key: key, - type: 14, - editedMessage: { - conversation: noobText, - }, - }, - }, - {} - ) +export default handler; - await delay(100) // Adjust the delay time (in milliseconds) as needed - } -} diff --git a/plugins/Guru-dark.js b/plugins/Guru-dark.js new file mode 100644 index 0000000000..4c71a04643 --- /dev/null +++ b/plugins/Guru-dark.js @@ -0,0 +1,38 @@ +import fetch from 'node-fetch'; + +let handler = async (m, { conn, text, args, usedPrefix, command }) => { + try { + if (!text) throw 'uhm.. what do you want to say?'; + await m.react('🤖'); + + const prompt = encodeURIComponent(text); + let apiurl = `https://dark.guruapi.tech/egpt?prompt=${prompt}`; + + const result = await fetch(apiurl); + const response = await result.json(); + + if (!response.message) throw 'No result found'; + + const replyText = response.message; + await conn.sendButton( + m.chat, + replyText, + author, + 'https://letemoinhaiti.com/home/wp-content/uploads/2024/03/img_9025-1-850x560.jpg', + [['Script', `.sc`]], + null, + [['Follow Me', `https://github.com/Guru322`]], + m + ); + } catch (error) { + console.error(error); + m.reply('Oops! Something went wrong. We are trying hard to fix it ASAP.'); + } +}; + +handler.help = ['darky ']; +handler.tags = ['tools']; +handler.command = ['darky', 'darkgpt'] + +export default handler; +