-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathwm.js
43 lines (41 loc) · 1.62 KB
/
wm.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const { MessageType } = require('@adiwajshing/baileys')
const { sticker } = require('../lib/sticker')
const uploadFile = require('../lib/uploadFile')
const uploadImage = require('../lib/uploadImage')
let { webp2png } = require('../lib/webp2mp4')
let handler = async (m, { conn, text }) => {
let stiker = false
try {
let [packname, ...author] = text.split`|`
author = (author || []).join`|`
let q = m.quoted ? m.quoted : m
let mime = m.quoted.mimetype || ''
if (/webp/.test(mime)) {
let img = await q.download()
let out = await webp2png(img)
if (!img) throw `balas stiker dengan perintah ${usedPrefix + command} <packname>|<author>`
stiker = await sticker(0, out, packname || '', author || '')
} else if (/image/.test(mime)) {
let img = await q.download()
let link = await uploadImage(img)
if (!img) throw `balas gambar dengan perintah ${usedPrefix + command} <packname>|<author>`
stiker = await sticker(0, link, packname || '', author || '')
} else if (/video/.test(mime)) {
if ((q.msg || q).seconds > 11) throw 'Maksimal 10 detik!'
let img = await q.download()
let link = await uploadFile(img)
if (!img) throw `balas video dengan perintah ${usedPrefix + command} <packname>|<author>`
stiker = await sticker(0, link, packname || '', author || '')
}
} finally {
if (stiker) await conn.sendMessage(m.chat, stiker, MessageType.sticker, {
quoted: m
})
else throw 'Balas stikernya!'
}
}
handler.help = ['wm <packname>|<author> ERORR']
handler.tags = ['']
handler.command = /^wm$/i
handler.limit = true
module.exports = handler