Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Guru322 committed Jul 21, 2024
1 parent 39ce2fb commit ce1fe83
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 41 deletions.
69 changes: 28 additions & 41 deletions plugins/GURU-gpt4.js
Original file line number Diff line number Diff line change
@@ -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 <text>']
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 <text>'];
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
}
}
38 changes: 38 additions & 0 deletions plugins/Guru-dark.js
Original file line number Diff line number Diff line change
@@ -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 <text>'];
handler.tags = ['tools'];
handler.command = ['darky', 'darkgpt']

export default handler;

0 comments on commit ce1fe83

Please sign in to comment.