
🦈드림 걸 Gemoy ~ Info AraBotz
May 24, 2025 at 01:16 AM
/**
* ✧ Premium Brat Text Sticker Generator ✧
* ✧ Type: Plugin ESM
* ✧ API: https://aqul-brat.hf.space
* ✧ Source: https://whatsapp.com/channel/0029VbAXhS26WaKugBLx4E05
* ✧ Modified by: Lznycx
*/
const {
Sticker,
StickerTypes
} = require("wa-sticker-formatter")
const axios = require("axios")
const fs = require("fs/promises")
const path = require("path")
const config = {
apiUrl: 'https://aqul-brat.hf.space/api/brat',
timeout: 20000,
maxRetry: 2,
cacheDir: './tmp/brat_cache',
stickerConfig: {
pack: '🔥 BRAT PACK 🔥',
author: 'Lznycx Edition',
type: StickerTypes.FULL,
quality: 80,
background: 'transparent',
categories: ['fun', 'meme'],
androidAppLink: 'https://play.google.com/store/apps/details?id=com.brat.stickers',
iosAppLink: 'https://apps.apple.com/us/app/brat-stickers/id123456789'
}
}
const handler = async (m, {
conn,
text,
args
}) => {
if (!text) return m.reply(`
🎨 *BRAT TEXT STICKER MAKER*
✧ *Usage:*
.brat
.brat |
.brat |
✧ *Examples:*
.brat kamu nanya
.brat wibu detected|Lznycx
.brat bucin bgt|Love Pack|@lznycx
📌 *Note:* Max 50 characters
`.trim())
try {
const [stickerText, packName, authorName] = text.split('|').map(s => s.trim())
const finalText = stickerText.slice(0, 50)
const processingMsg = await m.reply('🔄 Processing your Brat sticker...')
await conn.sendMessage(m.chat, {
react: {
text: '⏳',
key: m.key
}
})
await fs.mkdir(config.cacheDir, {
recursive: true
})
let stickerBuffer
let attempts = 0
while (attempts < config.maxRetry) {
try {
const {
data
} = await axios.get(config.apiUrl, {
params: {
text: finalText,
bg: 'transparent',
font: 'impact'
},
responseType: 'arraybuffer',
timeout: config.timeout
})
stickerBuffer = data
break
} catch (error) {
attempts++
if (attempts >= config.maxRetry) throw error
await new Promise(resolve => setTimeout(resolve, 2000))
}
}
const sticker = new Sticker(stickerBuffer, {
...config.stickerConfig,
pack: packName || config.stickerConfig.pack,
author: authorName || config.stickerConfig.author
})
const startTime = Date.now()
await conn.sendMessage(m.chat, await sticker.toMessage(), {
quoted: m,
ephemeralExpiration: 24 * 60 * 60
})
const processingTime = (Date.now() - startTime) / 1000
await processingMsg.delete()
await m.reply(`✅ Sticker created in ${processingTime.toFixed(2)}s`)
} catch (error) {
console.error('⚠️ Brat Sticker Error:', error)
const errorMsg = `❌ Failed to create sticker\n` +
`Reason: ${error.message}\n` +
`Please try again later or contact support.`
await m.reply(errorMsg)
const errorLog = `[${new Date().toISOString()}] ${error.stack}\n\n`
await fs.appendFile(path.join(config.cacheDir, 'error.log'), errorLog)
}
}
handler.help = ['brat ', 'brat ||']
handler.tags = ['sticker', 'premium']
handler.command = /^(brat|bratsticker|textsticker)$/i
handler.limit = true
handler.premium = false
handler.register = true
module.exports = handler