mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: delete chat on legacy
This commit is contained in:
@@ -302,11 +302,6 @@ const makeChatsSocket = (config: LegacySocketConfig) => {
|
||||
|
||||
if('archive' in modification) {
|
||||
chatAttrs.type = modification.archive ? 'archive' : 'unarchive'
|
||||
const indexKey = modification.lastMessages[modification.lastMessages.length-1].key
|
||||
if(indexKey) {
|
||||
chatAttrs.index = indexKey.id
|
||||
chatAttrs.owner = indexKey.fromMe ? 'true' : 'false'
|
||||
}
|
||||
} else if('pin' in modification) {
|
||||
chatAttrs.type = 'pin'
|
||||
if(modification.pin) {
|
||||
@@ -343,6 +338,16 @@ const makeChatsSocket = (config: LegacySocketConfig) => {
|
||||
} else if('markRead' in modification) {
|
||||
const indexKey = modification.lastMessages[modification.lastMessages.length-1].key
|
||||
return chatRead(indexKey, modification.markRead ? 0 : -1)
|
||||
} else if('delete' in modification) {
|
||||
chatAttrs.type = 'delete'
|
||||
}
|
||||
|
||||
if('lastMessages' in modification) {
|
||||
const indexKey = modification.lastMessages[modification.lastMessages.length-1].key
|
||||
if(indexKey) {
|
||||
chatAttrs.index = indexKey.id
|
||||
chatAttrs.owner = indexKey.fromMe ? 'true' : 'false'
|
||||
}
|
||||
}
|
||||
|
||||
const node = { tag: 'chat', attrs: chatAttrs, content: data }
|
||||
|
||||
@@ -58,4 +58,4 @@ export type ChatModification =
|
||||
markRead: boolean
|
||||
lastMessages: LastMessageList
|
||||
} |
|
||||
{ delete: true }
|
||||
{ delete: true, lastMessages: LastMessageList }
|
||||
Reference in New Issue
Block a user