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:
@@ -494,14 +494,27 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
||||
}
|
||||
}
|
||||
|
||||
const presenceSubscribe = (toJid: string) => (
|
||||
/**
|
||||
* @param toJid the jid to subscribe to
|
||||
* @param tcToken token for subscription, use if present
|
||||
*/
|
||||
const presenceSubscribe = (toJid: string, tcToken?: Buffer) => (
|
||||
sendNode({
|
||||
tag: 'presence',
|
||||
attrs: {
|
||||
to: toJid,
|
||||
id: generateMessageTag(),
|
||||
type: 'subscribe'
|
||||
}
|
||||
},
|
||||
content: tcToken
|
||||
? [
|
||||
{
|
||||
tag: 'tctoken',
|
||||
attrs: { },
|
||||
content: tcToken
|
||||
}
|
||||
]
|
||||
: undefined
|
||||
})
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user