forked from Guru322/GURU-Ai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update config.js, package.json, and add GURU-gemini.js, _chatbot.js, …
…bingimg.js plugins
- Loading branch information
Showing
6 changed files
with
121 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {GoogleGenerativeAI} from '@google/generative-ai' | ||
|
||
const genAI = new GoogleGenerativeAI('AIzaSyDJC5a882ruaC4XL6ejY1yhgRkN-JNQKg8'); | ||
|
||
|
||
let handler = async (m, { conn, text, args, usedPrefix, command }) => { | ||
try { | ||
if (!text) throw `uhm.. what do you want to say?` | ||
m.react('🤖') | ||
const model = genAI.getGenerativeModel({ model: "gemini-pro" }); | ||
|
||
const prompt = text | ||
|
||
const result = await model.generateContent(prompt); | ||
const response = result.response; | ||
const textt = response.text(); | ||
m.reply(textt) | ||
} catch (error) { | ||
console.error(error); | ||
m.reply('Oops! Something went wrong. , we are trying had to fix it asap'); | ||
} | ||
} | ||
handler.help = ['gemini <text>'] | ||
handler.tags = ['tools'] | ||
handler.command = /^(gemini)$/i | ||
|
||
export default handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import fetch from 'node-fetch'; | ||
import axios from 'axios'; | ||
|
||
export async function before(m, { conn }) { | ||
try { | ||
if (m.isBaileys && m.fromMe) { | ||
return true; | ||
} | ||
|
||
if (!m.isGroup) { | ||
return false; | ||
} | ||
|
||
const users = global.db.data.users; | ||
const chats = global.db.data.chats; | ||
|
||
const user = global.db.data.users[m.sender]; | ||
const chat = global.db.data.chats[m.chat]; | ||
let name = conn.getName(m.sender) | ||
if (m.mtype === 'protocolMessage' || m.mtype === 'pollUpdateMessage' || m.mtype === 'reactionMessage' || m.mtype === 'stickerMessage') { | ||
return; | ||
} | ||
|
||
if (!m.msg || !m.message || m.key.remoteJid !== m.chat || users[m.sender].banned || chats[m.chat].isBanned) { | ||
return; | ||
} | ||
|
||
if (!m.quoted ||!m.quoted.isBaileys) return | ||
|
||
if (!chat.chatbot) { | ||
return true; | ||
} | ||
|
||
const msg = encodeURIComponent(m.text); | ||
console.log(msg) | ||
|
||
const response = await axios.post('https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=AIzaSyDJC5a882ruaC4XL6ejY1yhgRkN-JNQKg8', { | ||
contents: [{ | ||
parts: [{ | ||
text: msg | ||
}] | ||
}] | ||
}); | ||
|
||
const data = response.data; | ||
if (data.candidates && data.candidates.length > 0) { | ||
const candidate = data.candidates[0]; | ||
const content = candidate.content; | ||
|
||
|
||
let reply = content.parts[0].text; | ||
if (reply) { | ||
reply = reply.replace(/Google/gi, 'Guru'); | ||
reply = reply.replace(/a large language model/gi, botname); | ||
|
||
m.reply(reply); | ||
} | ||
|
||
} else { | ||
|
||
m.reply("No suitable response from the API."); | ||
|
||
} | ||
} catch (error) { | ||
console.log(error); | ||
|
||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import fetch from 'node-fetch' | ||
|
||
let handler = async (m, { conn, text }) => { | ||
if (!text) throw 'What do you want to create?' | ||
m.react(rwait) | ||
let msg = encodeURIComponent(text) | ||
let res = await fetch(`https://aemt.me/bingimg?text=${msg}`) | ||
let data = await res.json() | ||
console.log(data) | ||
let buffer = data.result | ||
conn.sendFile(m.chat, buffer, 'image.png', `${text}`, m) | ||
m.react(done) | ||
} | ||
|
||
handler.help = ['bingimg <query>'] | ||
handler.tags = ['AI'] | ||
handler.command = /^bingimg$/i | ||
|
||
export default handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -439,6 +439,8 @@ import { | |
◈ .ai | ||
◈ .bard | ||
◈ .alexa | ||
◈ .bingimg | ||
◈ .gemini | ||
╰──────────⳹ | ||
` | ||
let religionmenu = ` | ||
|