Spaces:
Paused
Paused
Frank Kaumba
commited on
Update ai.js
Browse files- plugins/ai.js +22 -17
plugins/ai.js
CHANGED
|
@@ -21,26 +21,31 @@ const config = require('../config');
|
|
| 21 |
const { cmd, commands } = require('../command');
|
| 22 |
|
| 23 |
cmd({
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
},
|
| 30 |
async (conn, mek, m, { from, q, reply }) => {
|
| 31 |
-
|
| 32 |
-
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
*POWERED BY MR FRANK*`;
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
});
|
|
|
|
| 21 |
const { cmd, commands } = require('../command');
|
| 22 |
|
| 23 |
cmd({
|
| 24 |
+
pattern: "ai",
|
| 25 |
+
desc: "💬 Chat with Gemini Pro AI",
|
| 26 |
+
react: "🧠",
|
| 27 |
+
category: "ai",
|
| 28 |
+
filename: __filename
|
| 29 |
},
|
| 30 |
async (conn, mek, m, { from, q, reply }) => {
|
| 31 |
+
try {
|
| 32 |
+
if (!q) return reply("❗ Please provide a query. Usage: .ai [your message]");
|
| 33 |
|
| 34 |
+
const response = await axios.get(`https://kaiz-apis.gleeze.com/api/gemini-pro`, {
|
| 35 |
+
params: {
|
| 36 |
+
q: q,
|
| 37 |
+
uid: "1" // You might want to make this dynamic based on user ID
|
| 38 |
+
}
|
| 39 |
+
});
|
| 40 |
+
|
| 41 |
+
const aiReply = `🤖 *Gemini Pro AI*:
|
| 42 |
+
${response.data.message}
|
| 43 |
|
| 44 |
*POWERED BY MR FRANK*`;
|
| 45 |
|
| 46 |
+
return reply(aiReply);
|
| 47 |
+
} catch (e) {
|
| 48 |
+
console.log(e);
|
| 49 |
+
return reply("⚠️ An error occurred while fetching AI response. Please try again later.");
|
| 50 |
+
}
|
| 51 |
+
});
|