diff --git a/plugins/_functionbefore/_allfake.js b/plugins/_functionbefore/_allfake.js index 6450a07..8751a49 100644 --- a/plugins/_functionbefore/_allfake.js +++ b/plugins/_functionbefore/_allfake.js @@ -9,7 +9,37 @@ let handler = m => m let timeh = `🕰️ ${d.toLocaleTimeString('id', { hour: 'numeric', minute: 'numeric', second: 'numeric' }).replaceAll('.',':')}` let datas = db.data.datas global.packname = datas.packname - global.author = datas.author +import { addExif } from '../../lib/sticker.js' + +let handler = async (m, { conn, text, usedPrefix, command }) => { + if (!m.quoted) throw `Reply / Tag Stiker Sesuai Format :\n*${usedPrefix + command} |*` + let stiker = false + try { + let [pack, aut] = text.split('|') + pack = pack || '-' + aut = aut || '-' + let mime = m.quoted.mimetype || '' + if (!/webp/.test(mime)) throw `Reply / Tag Stiker Sesuai Format :\n*${usedPrefix + command} |*` + let img = await m.quoted.download() + if (!img) throw `Reply / Tag Stiker Sesuai Format :\n*${usedPrefix + command} |*` + stiker = await addExif(img, pack, aut) + } catch (e) { + console.error(e) + if (Buffer.isBuffer(e)) stiker = e + } finally { + if (stiker) conn.sendFile(m.chat, stiker, '', '', m, false, { asSticker: true }) + else throw 'Conversion failed' + } +} + +handler.help = ['takestick |'] +handler.tags = ['creator'] +handler.command = /^(((stic?ker)?wm(stic?ker)?)|(takestic?k(er)?)|colong)$/i + +handler.premium = true +handler.limit = true + +export default handler global.author = datas.author global.pauthor = datas.packname + ' - ' + datas.author // use .addapi to add or .cekapi to check global.api = datas.api @@ -143,4 +173,4 @@ let handler = m => m } } -export default handler \ No newline at end of file +export default handler