case 'attp': case 'attp1': case 'attp2': case 'attp3': case 'attp4':
case 'attp5': case 'attp6': case 'attp7': case 'attp8': case 'attp9':
case 'attp10': case 'attp11': case 'attp12': case 'attp13': case 'attp14': case 'attp15':
if (!q) return reply("Ei, cadê o texto?")
try {// By: 𖧄 𝐋𝐔𝐂𝐀𝐒 𝐌𝐎𝐃 𝐃𝐎𝐌𝐈𝐍𝐀 𖧄
const tempDir = path.join(__dirname, 'temp')
if (!fs.existsSync(tempDir)) {
fs.mkdirSync(tempDir, { recursive: true })
}
const url = `${zerosite}/api/canvas/attps?type=${command}&texto=${encodeURIComponent(q)}&apikey=${API_KEY_ZEROTWO}`
const response = await fetch(url)
if (!response.ok) {
console.error(`Erro na API: ${response.status} - ${response.statusText}`)
return reply("Houve um problema ao processar sua solicitação.")
}
const arrayBuffer = await response.arrayBuffer()
const gifBuffer = Buffer.from(arrayBuffer)
const filename = `attp_${Date.now()}`
const gifPath = path.join(tempDir, `${filename}.gif`)
const webpPath = path.join(tempDir, `${filename}.webp`)
fs.writeFileSync(gifPath, gifBuffer)
const ffmpegCmd = `ffmpeg -i ${gifPath} -vcodec libwebp -filter_complex "[0:v] scale=512:512:force_original_aspect_ratio=decrease,pad=512:512:(ow-iw)/2:(oh-ih)/2:color=#00000000" -lossless 1 -loop 0 -an -vsync 0 ${webpPath}`
exec(ffmpegCmd, async (error) => {
if (error) {
console.error(`Erro na conversão FFMPEG: ${error.message}`)
if (fs.existsSync(gifPath)) fs.unlinkSync(gifPath)
return reply("Erro ao processar a figurinha. Verifique o FFMPEG.")
}
const finalStickerBuffer = fs.readFileSync(webpPath)
await zerotwo.sendMessage(from, { sticker: finalStickerBuffer }, { quoted: info })
if (fs.existsSync(gifPath)) fs.unlinkSync(gifPath)
if (fs.existsSync(webpPath)) fs.unlinkSync(webpPath)
})
} catch (error) {
console.error("Erro no comando ATTP:", error)
reply("Erro ao gerar a figurinha.")
}
break