mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Implementing Delete messages for everyone (group)
This commit is contained in:
committed by
Adhiraj Singh
parent
b528d7a82f
commit
fdb1b9e89b
@@ -620,7 +620,12 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
|||||||
const additionalAttributes: BinaryNodeAttributes = { }
|
const additionalAttributes: BinaryNodeAttributes = { }
|
||||||
// required for delete
|
// required for delete
|
||||||
if(isDeleteMsg) {
|
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 })
|
await relayMessage(jid, fullMsg.message!, { messageId: fullMsg.key.id!, cachedGroupMetadata: options.cachedGroupMetadata, additionalAttributes })
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ export type AnyMessageContent = AnyRegularMessageContent | {
|
|||||||
forward: WAMessage
|
forward: WAMessage
|
||||||
force?: boolean
|
force?: boolean
|
||||||
} | {
|
} | {
|
||||||
|
/** Delete your message or anyone's message in a group (admin required) */
|
||||||
delete: WAMessageKey
|
delete: WAMessageKey
|
||||||
} | {
|
} | {
|
||||||
disappearingMessagesInChat: boolean | number
|
disappearingMessagesInChat: boolean | number
|
||||||
|
|||||||
Reference in New Issue
Block a user