mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Support decoding disappearing messages + events bug fix
This commit is contained in:
@@ -387,7 +387,7 @@ export class WAConnection extends Base {
|
||||
chatUpdate.count = chat.count
|
||||
|
||||
const contact = this.contacts[message.participant || chat.jid]
|
||||
if (contact.lastKnownPresence === Presence.composing) { // update presence
|
||||
if (contact?.lastKnownPresence === Presence.composing) { // update presence
|
||||
const update = this.applyingPresenceUpdate({ id: chat.jid, participant: message.participant || chat.jid, type: Presence.available })
|
||||
update && Object.assign(chatUpdate, update)
|
||||
}
|
||||
@@ -398,7 +398,7 @@ export class WAConnection extends Base {
|
||||
// if it's a message to delete another message
|
||||
if (protocolMessage) {
|
||||
switch (protocolMessage.type) {
|
||||
case WAMessageProto.ProtocolMessage.PROTOCOL_MESSAGE_TYPE.REVOKE:
|
||||
case WAMessageProto.ProtocolMessage.ProtocolMessageType.REVOKE:
|
||||
const found = chat.messages.get (GET_MESSAGE_ID(protocolMessage.key))
|
||||
if (found?.message) {
|
||||
this.logger.info ('deleting message: ' + protocolMessage.key.id + ' in chat: ' + protocolMessage.key.remoteJid)
|
||||
|
||||
@@ -291,7 +291,7 @@ export class WAConnection extends Base {
|
||||
const json: WAMessageContent = {
|
||||
protocolMessage: {
|
||||
key: messageKey,
|
||||
type: WAMessageProto.ProtocolMessage.PROTOCOL_MESSAGE_TYPE.REVOKE
|
||||
type: WAMessageProto.ProtocolMessage.ProtocolMessageType.REVOKE
|
||||
}
|
||||
}
|
||||
const waMessage = this.prepareMessageFromContent (id, json, {})
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { WA } from '../Binary/Constants'
|
||||
import { proto } from '../../WAMessage/WAMessage'
|
||||
import { Agent } from 'https'
|
||||
import KeyedDB from '@adiwajshing/keyed-db'
|
||||
|
||||
export const WS_URL = 'wss://web.whatsapp.com/ws'
|
||||
export const DEFAULT_ORIGIN = 'https://web.whatsapp.com'
|
||||
@@ -17,9 +18,8 @@ export type WAMessageKey = proto.IMessageKey
|
||||
export type WATextMessage = proto.ExtendedTextMessage
|
||||
export type WAContextInfo = proto.IContextInfo
|
||||
export type WAGenericMediaMessage = proto.IVideoMessage | proto.IImageMessage | proto.IAudioMessage | proto.IDocumentMessage | proto.IStickerMessage
|
||||
export import WA_MESSAGE_STUB_TYPE = proto.WebMessageInfo.WEB_MESSAGE_INFO_STUBTYPE
|
||||
export import WA_MESSAGE_STATUS_TYPE = proto.WebMessageInfo.WEB_MESSAGE_INFO_STATUS
|
||||
import KeyedDB from '@adiwajshing/keyed-db'
|
||||
export import WA_MESSAGE_STUB_TYPE = proto.WebMessageInfo.WebMessageInfoStubType
|
||||
export import WA_MESSAGE_STATUS_TYPE = proto.WebMessageInfo.WebMessageInfoStatus
|
||||
|
||||
export interface WALocationMessage {
|
||||
degreesLatitude: number
|
||||
|
||||
Reference in New Issue
Block a user