mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix group announce and restrict always false (#971)
* fix group announce and restrict always false * refactor: make group setting change params in line with WA Co-authored-by: Adhiraj Singh <adhirajsingh1001@gmail.com>
This commit is contained in:
@@ -206,12 +206,12 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
emitParticipantsUpdate('add')
|
emitParticipantsUpdate('add')
|
||||||
break
|
break
|
||||||
case WAMessageStubType.GROUP_CHANGE_ANNOUNCE:
|
case WAMessageStubType.GROUP_CHANGE_ANNOUNCE:
|
||||||
const announce = message.messageStubParameters[0] === 'on'
|
const announceValue = message.messageStubParameters[0]
|
||||||
emitGroupUpdate({ announce })
|
emitGroupUpdate({ announce: announceValue === 'true' || announceValue === 'on' })
|
||||||
break
|
break
|
||||||
case WAMessageStubType.GROUP_CHANGE_RESTRICT:
|
case WAMessageStubType.GROUP_CHANGE_RESTRICT:
|
||||||
const restrict = message.messageStubParameters[0] === 'on'
|
const restrictValue = message.messageStubParameters[0]
|
||||||
emitGroupUpdate({ restrict })
|
emitGroupUpdate({ restrict: restrictValue === 'true' || restrictValue === 'on' })
|
||||||
break
|
break
|
||||||
case WAMessageStubType.GROUP_CHANGE_SUBJECT:
|
case WAMessageStubType.GROUP_CHANGE_SUBJECT:
|
||||||
chatUpdate.name = message.messageStubParameters[0]
|
chatUpdate.name = message.messageStubParameters[0]
|
||||||
@@ -321,12 +321,12 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
case 'announcement':
|
case 'announcement':
|
||||||
case 'not_announcement':
|
case 'not_announcement':
|
||||||
result.messageStubType = WAMessageStubType.GROUP_CHANGE_ANNOUNCE
|
result.messageStubType = WAMessageStubType.GROUP_CHANGE_ANNOUNCE
|
||||||
result.messageStubParameters = [ (child.tag === 'announcement').toString() ]
|
result.messageStubParameters = [ (child.tag === 'announcement') ? 'on' : 'off' ]
|
||||||
break
|
break
|
||||||
case 'locked':
|
case 'locked':
|
||||||
case 'unlocked':
|
case 'unlocked':
|
||||||
result.messageStubType = WAMessageStubType.GROUP_CHANGE_RESTRICT
|
result.messageStubType = WAMessageStubType.GROUP_CHANGE_RESTRICT
|
||||||
result.messageStubParameters = [ (child.tag === 'locked').toString() ]
|
result.messageStubParameters = [ (child.tag === 'locked') ? 'on' : 'off' ]
|
||||||
break
|
break
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user