mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fixes
This commit is contained in:
@@ -378,7 +378,7 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
|||||||
devices.push(...additionalDevices)
|
devices.push(...additionalDevices)
|
||||||
}
|
}
|
||||||
|
|
||||||
const patched = await patchMessageBeforeSending(message, devices.map(d => jidEncode(d.user, d.domainType == 0 ? 's.whatsapp.net' : 'lid', d.device)))
|
const patched = await patchMessageBeforeSending(message, devices.map(d => jidEncode(d.user, sock.user?.id?.includes?.(d.user) ? 'lid' : 's.whatsapp.net', d.device)))
|
||||||
const bytes = encodeWAMessage(patched)
|
const bytes = encodeWAMessage(patched)
|
||||||
|
|
||||||
const { ciphertext, senderKeyDistributionMessage } = await signalRepository.encryptGroupMessage(
|
const { ciphertext, senderKeyDistributionMessage } = await signalRepository.encryptGroupMessage(
|
||||||
@@ -446,7 +446,7 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
|||||||
const otherJids: string[] = []
|
const otherJids: string[] = []
|
||||||
for(const { user, device } of devices) {
|
for(const { user, device } of devices) {
|
||||||
const isMe = user === meUser
|
const isMe = user === meUser
|
||||||
const jid = jidEncode(user, !isMe && isLid ? 'lid' : 's.whatsapp.net', device)
|
const jid = jidEncode(user, !isMe && isLid ? 'lid' : 's.whatsapp.net', device)
|
||||||
if(isMe) {
|
if(isMe) {
|
||||||
meJids.push(jid)
|
meJids.push(jid)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -623,14 +623,15 @@ export const makeSocket = (config: SocketConfig) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
// login complete
|
// login complete
|
||||||
ws.on('CB:success', async (node) => {
|
ws.on('CB:success', async(node: BinaryNode) => {
|
||||||
console.log(node.attrs) // temporary log, don't merge before removing
|
|
||||||
await uploadPreKeysToServerIfRequired()
|
await uploadPreKeysToServerIfRequired()
|
||||||
await sendPassiveIq('active')
|
await sendPassiveIq('active')
|
||||||
|
|
||||||
logger.info('opened connection to WA')
|
logger.info('opened connection to WA')
|
||||||
clearTimeout(qrTimer) // will never happen in all likelyhood -- but just in case WA sends success on first try
|
clearTimeout(qrTimer) // will never happen in all likelyhood -- but just in case WA sends success on first try
|
||||||
|
|
||||||
|
ev.emit('creds.update', { me: { id: authState.creds.me!.id, lid: node.attrs.lid } })
|
||||||
|
|
||||||
ev.emit('connection.update', { connection: 'open' })
|
ev.emit('connection.update', { connection: 'open' })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
export interface Contact {
|
export interface Contact {
|
||||||
id: string
|
id: string
|
||||||
|
lid?: string
|
||||||
/** name of the contact, you have saved on your WA */
|
/** name of the contact, you have saved on your WA */
|
||||||
name?: string
|
name?: string
|
||||||
/** name of the contact, the contact has set on their own on WA */
|
/** name of the contact, the contact has set on their own on WA */
|
||||||
|
|||||||
Reference in New Issue
Block a user