Spaces:
Paused
Paused
πππππππ πππππππ β‘
commited on
Create ai-gemini.js
Browse files- plugins/ai-gemini.js +49 -0
plugins/ai-gemini.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const config = require('../config');
|
| 2 |
+
const { cmd, commands } = require('../command');
|
| 3 |
+
const { fetchJson } = require('../lib/functions');
|
| 4 |
+
|
| 5 |
+
cmd({
|
| 6 |
+
pattern: "bot",
|
| 7 |
+
alias: ["geminai","gpt"],
|
| 8 |
+
react: "π€",
|
| 9 |
+
desc: "AI chat.",
|
| 10 |
+
category: "main",
|
| 11 |
+
filename: __filename
|
| 12 |
+
}, async (conn, mek, m, {
|
| 13 |
+
from,
|
| 14 |
+
quoted,
|
| 15 |
+
body,
|
| 16 |
+
isCmd,
|
| 17 |
+
command,
|
| 18 |
+
args,
|
| 19 |
+
q,
|
| 20 |
+
isGroup,
|
| 21 |
+
sender,
|
| 22 |
+
senderNumber,
|
| 23 |
+
botNumber2,
|
| 24 |
+
botNumber,
|
| 25 |
+
pushname,
|
| 26 |
+
isMe,
|
| 27 |
+
isOwner,
|
| 28 |
+
groupMetadata,
|
| 29 |
+
groupName,
|
| 30 |
+
participants,
|
| 31 |
+
groupAdmins,
|
| 32 |
+
isBotAdmins,
|
| 33 |
+
isAdmins,
|
| 34 |
+
reply
|
| 35 |
+
}) => {
|
| 36 |
+
try {
|
| 37 |
+
if (!q) return reply("Please ask a question or provide input for the AI.");
|
| 38 |
+
|
| 39 |
+
const data = await fetchJson(`https://api.giftedtech.web.id/api/ai/geminiaipro?apikey=gifted&q=${q}`);
|
| 40 |
+
console.log(data);
|
| 41 |
+
|
| 42 |
+
if (!data.message) return reply("No response from the AI.");
|
| 43 |
+
|
| 44 |
+
return reply(` \`π€ GEMINI AI RESPONSE:\` \n\n${data.message}`);
|
| 45 |
+
} catch (error) {
|
| 46 |
+
console.error(error);
|
| 47 |
+
reply(`An error occurred: ${error.message}`);
|
| 48 |
+
}
|
| 49 |
+
});
|