feat: eventMessage sending / call link creation (#1677)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user