diff --git a/README.md b/README.md index 20c7477..9c500bb 100644 --- a/README.md +++ b/README.md @@ -641,10 +641,10 @@ WA uses an encrypted form of communication to send chat/app updates. This has be - Delete message for me ``` ts await sock.chatModify( - { clear: { message: { id: 'ATWYHDNNWU81732J', fromMe: true } } }, - '123456@s.whatsapp.net', - [] - ) + { clear: { messages: [{ id: 'ATWYHDNNWU81732J', fromMe: true, timestamp: "1654823909" }] } }, + '123456@s.whatsapp.net', + [] +) ``` Note: if you mess up one of your updates, WA can log you out of all your devices and you'll have to login again. diff --git a/src/Types/Chat.ts b/src/Types/Chat.ts index f8e55f4..e47d491 100644 --- a/src/Types/Chat.ts +++ b/src/Types/Chat.ts @@ -75,7 +75,7 @@ export type ChatModification = mute: number | null } | { - clear: 'all' | { messages: {id: string, fromMe?: boolean}[] } + clear: 'all' | { messages: {id: string, fromMe?: boolean, timestamp: number}[] } } | { star: { @@ -96,4 +96,4 @@ export type InitialReceivedChatsState = { export type InitialAppStateSyncOptions = { recvChats: InitialReceivedChatsState accountSettings: AccountSettings -} +} \ No newline at end of file diff --git a/src/Utils/chat-utils.ts b/src/Utils/chat-utils.ts index 7a4ea1e..3b8cd46 100644 --- a/src/Utils/chat-utils.ts +++ b/src/Utils/chat-utils.ts @@ -557,7 +557,8 @@ export const chatModificationToAppPatch = ( patch = { syncAction: { deleteMessageForMeAction: { - deleteMedia: false + deleteMedia: false, + messageTimestamp: key.timestamp } }, index: ['deleteMessageForMe', jid, key.id, key.fromMe ? '1' : '0', '0'], @@ -744,4 +745,4 @@ export const syncActionUpdatesToEventMap = ( } return map -} \ No newline at end of file +}