mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: implement pin chat modification
This commit is contained in:
@@ -382,9 +382,12 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
name: action?.pushNameSetting?.name!
|
name: action?.pushNameSetting?.name!
|
||||||
}
|
}
|
||||||
ev.emit('creds.update', { me })
|
ev.emit('creds.update', { me })
|
||||||
|
} else if(action?.pinAction) {
|
||||||
|
update.pin = action.pinAction?.pinned ? toNumber(action.timestamp) : undefined
|
||||||
} else {
|
} else {
|
||||||
logger.warn({ action, id }, 'unprocessable update')
|
logger.warn({ action, id }, 'unprocessable update')
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Object.keys(update).length > 1) {
|
if(Object.keys(update).length > 1) {
|
||||||
updates[update.id] = {
|
updates[update.id] = {
|
||||||
...(updates[update.id] || {}),
|
...(updates[update.id] || {}),
|
||||||
|
|||||||
@@ -481,6 +481,18 @@ export const chatModificationToAppPatch = (
|
|||||||
operation: OP.SET
|
operation: OP.SET
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if('pin' in mod) {
|
||||||
|
patch = {
|
||||||
|
syncAction: {
|
||||||
|
pinAction: {
|
||||||
|
pinned: !!mod.pin
|
||||||
|
}
|
||||||
|
},
|
||||||
|
index: ['pin_v1', '919646328797@s.whatsapp.net'],
|
||||||
|
type: 'regular_low',
|
||||||
|
apiVersion: 5,
|
||||||
|
operation: mod.pin ? OP.SET : OP.REMOVE
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Boom('not supported')
|
throw new Boom('not supported')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user