mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Fix initial-data-received called multiple times
The latest android version has messages with the last: true flag set on all messages, causing incorrect events being fired off. This update creates a timeout that fires off the initial-data-received 2500ms after the last messages received. This may not be as accurate in production but will be better than the current version
This commit is contained in:
@@ -25,6 +25,9 @@ async function example() {
|
||||
conn.on('contacts-received', () => {
|
||||
console.log(`you have ${Object.keys(conn.contacts).length} contacts`)
|
||||
})
|
||||
conn.on('initial-data-received', () => {
|
||||
console.log('received all initial messages')
|
||||
})
|
||||
|
||||
// loads the auth file credentials if present
|
||||
/* Note: one can take this auth_info.json file and login again from any computer without having to scan the QR code,
|
||||
|
||||
Reference in New Issue
Block a user