Skip to content

Commit

Permalink
Update _allfake.js
Browse files Browse the repository at this point in the history
  • Loading branch information
SkulZOnTheYT authored Nov 12, 2023
1 parent 2f17f5f commit 9d0db57
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions plugins/_functionbefore/_allfake.js
Original file line number Diff line number Diff line change
Expand Up @@ -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} <packname>|<author>*`
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} <packname>|<author>*`
let img = await m.quoted.download()
if (!img) throw `Reply / Tag Stiker Sesuai Format :\n*${usedPrefix + command} <packname>|<author>*`
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 <packname>|<author>']
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
Expand Down Expand Up @@ -143,4 +173,4 @@ let handler = m => m
}
}

export default handler
export default handler

0 comments on commit 9d0db57

Please sign in to comment.