mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
added pong event
This commit is contained in:
@@ -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
|
// 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')
|
const timestamp = message.slice(1, message.length).toString ('utf-8')
|
||||||
this.lastSeen = new Date(parseInt(timestamp))
|
this.lastSeen = new Date(parseInt(timestamp))
|
||||||
|
this.emit ('received-pong')
|
||||||
} else {
|
} else {
|
||||||
const decrypted = Utils.decryptWA (message, this.authInfo?.macKey, this.authInfo?.encKey, new Decoder())
|
const decrypted = Utils.decryptWA (message, this.authInfo?.macKey, this.authInfo?.encKey, new Decoder())
|
||||||
if (!decrypted) return
|
if (!decrypted) return
|
||||||
|
|||||||
@@ -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
|
on (event: 'group-settings-update', listener: (update: {jid: string, restrict?: string, announce?: string, actor?: string}) => void): this
|
||||||
/** when the group description is updated */
|
/** when the group description is updated */
|
||||||
on (event: 'group-description-update', listener: (update: {jid: string, description?: string, actor?: string}) => void): this
|
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) }
|
on (event: BaileysEvent, listener: (...args: any[]) => void) { return super.on (event, listener) }
|
||||||
emit (event: BaileysEvent, ...args: any[]) { return super.emit (event, ...args) }
|
emit (event: BaileysEvent, ...args: any[]) { return super.emit (event, ...args) }
|
||||||
|
|||||||
@@ -368,4 +368,5 @@ export type BaileysEvent =
|
|||||||
'group-participants-promote' |
|
'group-participants-promote' |
|
||||||
'group-participants-demote' |
|
'group-participants-demote' |
|
||||||
'group-settings-update' |
|
'group-settings-update' |
|
||||||
'group-description-update'
|
'group-description-update' |
|
||||||
|
'received-pong'
|
||||||
Reference in New Issue
Block a user