feat: eventMessage sending / call link creation (#1677)

This commit is contained in:
vini
2025-09-07 08:08:18 -03:00
committed by GitHub
parent 4d4339dae6
commit 084761dc31
5 changed files with 76 additions and 1 deletions
+23
View File
@@ -633,6 +633,28 @@ export const makeChatsSocket = (config: SocketConfig) => {
return child?.attrs?.url
}
const createCallLink = async (type: 'audio' | 'video', event?: { startTime: number }, timeoutMs?: number) => {
const result = await query(
{
tag: 'call',
attrs: {
id: generateMessageTag(),
to: '@call'
},
content: [
{
tag: 'link_create',
attrs: { media: type },
content: event ? [{ tag: 'event', attrs: { start_time: String(event.startTime) } }] : undefined
}
]
},
timeoutMs
)
const child = getBinaryNodeChild(result, 'link_create')
return child?.attrs?.token
}
const sendPresenceUpdate = async (type: WAPresence, toJid?: string) => {
const me = authState.creds.me!
if (type === 'available' || type === 'unavailable') {
@@ -1139,6 +1161,7 @@ export const makeChatsSocket = (config: SocketConfig) => {
return {
...sock,
createCallLink,
getBotListV2,
processingMutex,
fetchPrivacySettings,