Spaces:
Paused
Paused
File size: 855 Bytes
bb69f9b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
const { bot, gemini } = require('../lib')
bot(
{
pattern: 'gemini ?(.*)',
desc: 'google gemini',
type: 'ai',
},
async (message, match, ctx) => {
if (!ctx.GEMINI_API_KEY) {
return await message.send(
'Missing Gemini API key? Get one at https://aistudio.google.com/app/apikey.\nsetvar GEMINI_API_KEY = api_key'
)
}
if (!match) {
return await message.send(
'*Example :*\ngemini hi\ngemini what is in the picture(reply to a image)'
)
}
let image
if (message.reply_message && message.reply_message.image) {
image = {
image: await message.reply_message.downloadMediaMessage(),
mimetype: message.reply_message.mimetype,
}
}
const res = await gemini(match, message.id, image)
await message.send(res.data, { quoted: message.data })
}
)
|