mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
* fix for groups * lint: fix linting * messages-send: jids checking
This commit is contained in:
@@ -282,7 +282,7 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
|||||||
) => {
|
) => {
|
||||||
let patched = await patchMessageBeforeSending(message, jids)
|
let patched = await patchMessageBeforeSending(message, jids)
|
||||||
if(!Array.isArray(patched)) {
|
if(!Array.isArray(patched)) {
|
||||||
patched = [{ recipientJid: jids[0], ...patched }]
|
patched = jids ? jids.map(jid => ({ recipientJid: jid, ...patched })) : [patched]
|
||||||
}
|
}
|
||||||
|
|
||||||
let shouldIncludeDeviceIdentity = false
|
let shouldIncludeDeviceIdentity = false
|
||||||
@@ -290,21 +290,21 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
|||||||
const nodes = await Promise.all(
|
const nodes = await Promise.all(
|
||||||
patched.map(
|
patched.map(
|
||||||
async patchedMessageWithJid => {
|
async patchedMessageWithJid => {
|
||||||
const { recipientJid: jid, ...patchedMessage } = patchedMessageWithJid
|
const { recipientJid: jid, ...patchedMessage } = patchedMessageWithJid
|
||||||
if(!jid) {
|
if(!jid) {
|
||||||
return {} as BinaryNode
|
return {} as BinaryNode
|
||||||
}
|
}
|
||||||
|
|
||||||
const bytes = encodeWAMessage(patchedMessage)
|
const bytes = encodeWAMessage(patchedMessage)
|
||||||
const { type, ciphertext } = await signalRepository
|
const { type, ciphertext } = await signalRepository
|
||||||
.encryptMessage({ jid: jid, data: bytes })
|
.encryptMessage({ jid, data: bytes })
|
||||||
if(type === 'pkmsg') {
|
if(type === 'pkmsg') {
|
||||||
shouldIncludeDeviceIdentity = true
|
shouldIncludeDeviceIdentity = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const node: BinaryNode = {
|
const node: BinaryNode = {
|
||||||
tag: 'to',
|
tag: 'to',
|
||||||
attrs: { jid: jid },
|
attrs: { jid },
|
||||||
content: [{
|
content: [{
|
||||||
tag: 'enc',
|
tag: 'enc',
|
||||||
attrs: {
|
attrs: {
|
||||||
|
|||||||
Reference in New Issue
Block a user