-
Notifications
You must be signed in to change notification settings - Fork 9
/
getmsg.js
25 lines (24 loc) · 975 Bytes
/
getmsg.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
let handler = async (m, { conn, command, usedPrefix, text }) => {
let which = command.replace(/get/i, '')
if (!text) throw `Gunakan *${usedPrefix}list${which}* untuk melihat list nya`
let msgs = global.db.data.msgs
if (!(text in msgs)) throw `'${text}' tidak terdaftar di list pesan`
let _m = conn.serializeM(JSON.parse(JSON.stringify(msgs[text]), (_, v) => {
if (
v !== null &&
typeof v === 'object' &&
'type' in v &&
v.type === 'Buffer' &&
'data' in v &&
Array.isArray(v.data)) {
return Buffer.from(v.data)
}
return v
}))
// m.reply(`[debug]\n${require('util').format(_m)}`)
await _m.copyNForward(m.chat, true)
}
handler.help = ['vn', 'msg', 'video', 'gif', 'audio', 'img', 'sticker'].map(v => 'get' + v + ' <text>')
handler.tags = ['database']
handler.command = /^get(vn|msg|video|audio|img|sticker|gif)$/
module.exports = handler