mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Maintain epoch on message-update
This commit is contained in:
@@ -44,9 +44,17 @@ export class WAConnection extends Base {
|
|||||||
const chat = this.chats.get(jid)
|
const chat = this.chats.get(jid)
|
||||||
if (!chat) return
|
if (!chat) return
|
||||||
// reinsert to update
|
// reinsert to update
|
||||||
if (chat.messages.delete (message)) chat.messages.insert (message)
|
const oldMessage = chat.messages.get (WA_MESSAGE_ID(message))
|
||||||
|
if (oldMessage) {
|
||||||
this.emit ('message-update', message)
|
message['epoch'] = oldMessage['epoch']
|
||||||
|
chat.messages.delete (oldMessage)
|
||||||
|
chat.messages.insert (message)
|
||||||
|
this.emit ('message-update', message)
|
||||||
|
} else {
|
||||||
|
chat.messages.insert (message)
|
||||||
|
this.emit ('message-new', message)
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
// If a user's contact has changed
|
// If a user's contact has changed
|
||||||
this.registerCallback (['action', null, 'user'], json => {
|
this.registerCallback (['action', null, 'user'], json => {
|
||||||
|
|||||||
Reference in New Issue
Block a user