Implementing Delete messages for everyone (group)

This commit is contained in:
Rajeh Taher
2022-08-01 15:09:03 +03:00
committed by Adhiraj Singh
parent b528d7a82f
commit fdb1b9e89b
2 changed files with 7 additions and 1 deletions

View File

@@ -620,7 +620,12 @@ export const makeMessagesSocket = (config: SocketConfig) => {
const additionalAttributes: BinaryNodeAttributes = { }
// required for delete
if(isDeleteMsg) {
additionalAttributes.edit = '7'
// if the chat is a group, and I am not the author, then delete the message as an admin
if (content.delete.remoteJid.endsWith('@g.us') && !content.fromMe) {
additionalAttributes.edit = '8'
} else {
additionalAttributes.edit = '7'
}
}
await relayMessage(jid, fullMsg.message!, { messageId: fullMsg.key.id!, cachedGroupMetadata: options.cachedGroupMetadata, additionalAttributes })

View File

@@ -134,6 +134,7 @@ export type AnyMessageContent = AnyRegularMessageContent | {
forward: WAMessage
force?: boolean
} | {
/** Delete your message or anyone's message in a group (admin required) */
delete: WAMessageKey
} | {
disappearingMessagesInChat: boolean | number