added pong event

This commit is contained in:
Adhiraj
2020-09-03 22:58:27 +05:30
parent fe0730b6a7
commit 1340279cdb
3 changed files with 6 additions and 1 deletions

View File

@@ -264,6 +264,7 @@ export class WAConnection extends Base {
// when the first character in the message is an '!', the server is updating the last seen
const timestamp = message.slice(1, message.length).toString ('utf-8')
this.lastSeen = new Date(parseInt(timestamp))
this.emit ('received-pong')
} else {
const decrypted = Utils.decryptWA (message, this.authInfo?.macKey, this.authInfo?.encKey, new Decoder())
if (!decrypted) return

View File

@@ -324,6 +324,9 @@ export class WAConnection extends Base {
on (event: 'group-settings-update', listener: (update: {jid: string, restrict?: string, announce?: string, actor?: string}) => void): this
/** when the group description is updated */
on (event: 'group-description-update', listener: (update: {jid: string, description?: string, actor?: string}) => void): this
/** when WA sends back a pong */
on (event: 'received-pong', listener: () => void): this
on (event: BaileysEvent, listener: (...args: any[]) => void) { return super.on (event, listener) }
emit (event: BaileysEvent, ...args: any[]) { return super.emit (event, ...args) }

View File

@@ -368,4 +368,5 @@ export type BaileysEvent =
'group-participants-promote' |
'group-participants-demote' |
'group-settings-update' |
'group-description-update'
'group-description-update' |
'received-pong'