mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: implement tc token handling
TC token is required in certain cases to receive presence updates on chats
This commit is contained in:
@@ -268,6 +268,21 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
const from = jidNormalizedUser(node.attrs.from)
|
||||
|
||||
switch (nodeType) {
|
||||
case 'privacy_token':
|
||||
const tokenList = getBinaryNodeChildren(child, 'token')
|
||||
for(const { attrs, content } of tokenList) {
|
||||
const jid = attrs.jid
|
||||
ev.emit('chats.update', [
|
||||
{
|
||||
id: jid,
|
||||
tcToken: content as Buffer
|
||||
}
|
||||
])
|
||||
|
||||
logger.debug({ jid }, 'got privacy token update')
|
||||
}
|
||||
|
||||
break
|
||||
case 'w:gp2':
|
||||
handleGroupNotification(node.attrs.participant, child, result)
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user