forked from ibrahimaitech/BLACK-PANTHER-XMD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_cmdWithMedia.js
29 lines (27 loc) · 891 Bytes
/
_cmdWithMedia.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
const {
proto,
generateWAMessage,
areJidsSameUser
} = (await import('@whiskeysockets/baileys')).default
export async function all(m, chatUpdate) {
if (m.isBaileys) return
if (!m.message) return
if (!m.msg.fileSha256) return
if (!(Buffer.from(m.msg.fileSha256).toString('base64') in global.db.data.sticker)) return
let hash = global.db.data.sticker[Buffer.from(m.msg.fileSha256).toString('base64')]
let { text, mentionedJid } = hash
let messages = await generateWAMessage(m.chat, { text: text, mentions: mentionedJid }, {
userJid: this.user.id,
quoted: m.quoted && m.quoted.fakeObj
})
messages.key.fromMe = areJidsSameUser(m.sender, this.user.id)
messages.key.id = m.key.id
messages.pushName = m.pushName
if (m.isGroup) messages.participant = m.sender
let msg = {
...chatUpdate,
messages: [proto.WebMessageInfo.fromObject(messages)],
type: 'append'
}
this.ev.emit('messages.upsert', msg)
}