javascript
48 lines ยท 1,143 chars
const { f } = require('./../../src/lib/undici')
const pluginConfig = {
name: 'petimg',
alias: ['text2img2'],
category: 'ai',
description: 'Generate gambar dari teks dengan AI',
usage: '.petimg <prompt> | <style>',
example: '.petimg beautiful sunset | anime',
isOwner: false,
isPremium: false,
isGroup: false,
isPrivate: false,
cooldown: 30,
energi: 1,
isEnabled: true
}
async function handler(m, { sock }) {
const input = m.text
if (!input) {
return m.reply(
`๐จ *PET IMG*\n` +
`Generate gambar dari teks dengan AI\n` +
`\`Contoh: ${m.prefix}petimg cat\``
)
}
m.react('๐')
try {
const data = await f(`https://kazztzyy.my.id/api/ai/petimg?prompt=${input}`)
await sock.sendMedia(m.chat, data.url, null, m, {
type: 'image'
})
m.react("โ
")
} catch (error) {
m.react('โ')
m.reply(`โ *แดสสแดส*\n\n> ${error.message}`)
}
}
module.exports = {
config: pluginConfig,
handler
}