mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: add lid sutff to message.key type (#1586)
* fix: add lid sutff to message.key type * feat: add view once information to msg key
This commit is contained in:
@@ -9,7 +9,7 @@ import { CacheStore } from './Socket'
|
|||||||
|
|
||||||
// export the WAMessage Prototypes
|
// export the WAMessage Prototypes
|
||||||
export { proto as WAProto }
|
export { proto as WAProto }
|
||||||
export type WAMessage = proto.IWebMessageInfo
|
export type WAMessage = proto.IWebMessageInfo & { key: WAMessageKey }
|
||||||
export type WAMessageContent = proto.IMessage
|
export type WAMessageContent = proto.IMessage
|
||||||
export type WAContactMessage = proto.Message.IContactMessage
|
export type WAContactMessage = proto.Message.IContactMessage
|
||||||
export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage
|
export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage
|
||||||
@@ -19,6 +19,7 @@ export type WAMessageKey = proto.IMessageKey & {
|
|||||||
senderPn?: string
|
senderPn?: string
|
||||||
participantLid?: string
|
participantLid?: string
|
||||||
participantPn?: string
|
participantPn?: string
|
||||||
|
isViewOnce?: boolean
|
||||||
}
|
}
|
||||||
export type WATextMessage = proto.Message.IExtendedTextMessage
|
export type WATextMessage = proto.Message.IExtendedTextMessage
|
||||||
export type WAContextInfo = proto.IContextInfo
|
export type WAContextInfo = proto.IContextInfo
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Boom } from '@hapi/boom'
|
import { Boom } from '@hapi/boom'
|
||||||
import { proto } from '../../WAProto'
|
import { proto } from '../../WAProto'
|
||||||
import { SignalRepository, WAMessageKey } from '../Types'
|
import { SignalRepository, WAMessage, WAMessageKey } from '../Types'
|
||||||
import {
|
import {
|
||||||
areJidsSameUser,
|
areJidsSameUser,
|
||||||
BinaryNode,
|
BinaryNode,
|
||||||
@@ -118,7 +118,7 @@ export function decodeMessageNode(stanza: BinaryNode, meId: string, meLid: strin
|
|||||||
...(msgType === 'newsletter' && stanza.attrs.server_id ? { server_id: stanza.attrs.server_id } : {})
|
...(msgType === 'newsletter' && stanza.attrs.server_id ? { server_id: stanza.attrs.server_id } : {})
|
||||||
}
|
}
|
||||||
|
|
||||||
const fullMessage: proto.IWebMessageInfo = {
|
const fullMessage: WAMessage = {
|
||||||
key,
|
key,
|
||||||
messageTimestamp: +stanza.attrs.t,
|
messageTimestamp: +stanza.attrs.t,
|
||||||
pushName: pushname,
|
pushName: pushname,
|
||||||
@@ -158,6 +158,10 @@ export const decryptMessageNode = (
|
|||||||
fullMessage.verifiedBizName = details.verifiedName
|
fullMessage.verifiedBizName = details.verifiedName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tag === 'unavailable' && attrs.type === 'view_once') {
|
||||||
|
fullMessage.key.isViewOnce = true
|
||||||
|
}
|
||||||
|
|
||||||
if (tag !== 'enc' && tag !== 'plaintext') {
|
if (tag !== 'enc' && tag !== 'plaintext') {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user