Pet IMG

javascript 69 views Mar 28, 2026
Raw
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
}