mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: handle call events
This commit is contained in:
14
src/Types/Call.ts
Normal file
14
src/Types/Call.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
export type WACallUpdateType = 'offer' | 'ringing' | 'timeout' | 'reject' | 'accept'
|
||||
|
||||
export type WACallEvent = {
|
||||
chatId: string
|
||||
from: string
|
||||
isGroup?: boolean
|
||||
id: string
|
||||
date: Date
|
||||
isVideo?: boolean
|
||||
status: WACallUpdateType
|
||||
offline: boolean
|
||||
latencyMs?: number
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import type EventEmitter from 'events'
|
||||
import { proto } from '../../WAProto'
|
||||
import { AuthenticationCreds } from './Auth'
|
||||
import { WACallEvent } from './Call'
|
||||
import { Chat, PresenceData } from './Chat'
|
||||
import { Contact } from './Contact'
|
||||
import { GroupMetadata, ParticipantAction } from './GroupMetadata'
|
||||
@@ -48,6 +49,8 @@ export type BaileysEventMap<T> = {
|
||||
|
||||
'blocklist.set': { blocklist: string[] }
|
||||
'blocklist.update': { blocklist: string[], type: 'add' | 'remove' }
|
||||
/** Receive an update on a call, including when the call was received, rejected, accepted */
|
||||
'call': WACallEvent[]
|
||||
}
|
||||
|
||||
export interface CommonBaileysEventEmitter<Creds> extends EventEmitter {
|
||||
|
||||
@@ -8,6 +8,7 @@ export * from './Legacy'
|
||||
export * from './Socket'
|
||||
export * from './Events'
|
||||
export * from './Product'
|
||||
export * from './Call'
|
||||
|
||||
import type NodeCache from 'node-cache'
|
||||
import { proto } from '../../WAProto'
|
||||
|
||||
Reference in New Issue
Block a user