mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: correctly map left group notification
This commit is contained in:
@@ -311,7 +311,18 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
case 'leave':
|
||||
const stubType = `GROUP_PARTICIPANT_${child.tag!.toUpperCase()}`
|
||||
result.messageStubType = WAMessageStubType[stubType]
|
||||
result.messageStubParameters = getBinaryNodeChildren(child, 'participant').map(p => p.attrs.jid)
|
||||
|
||||
const participants = getBinaryNodeChildren(child, 'participant').map(p => p.attrs.jid)
|
||||
if(
|
||||
participants.length === 1 &&
|
||||
// if recv. "remove" message and sender removed themselves
|
||||
// mark as left
|
||||
areJidsSameUser(participants[0], node.attrs.participant) &&
|
||||
child.tag === 'remove'
|
||||
) {
|
||||
result.messageStubType = WAMessageStubType.GROUP_PARTICIPANT_LEAVE
|
||||
}
|
||||
result.messageStubParameters = participants
|
||||
break
|
||||
case 'subject':
|
||||
result.messageStubType = WAMessageStubType.GROUP_CHANGE_SUBJECT
|
||||
|
||||
Reference in New Issue
Block a user