mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Major redo with respect to chats/contacts -- read desc
Waiting for chats & contacts is hella unreliable, so I've put them as events 1. receive chats via the `chats-received` event. If new chats are found, the flag for that is sent as well 2. receive contacts via the `contacts-received` event 3. When WA sends older messages, the `chats-update` or `chat-update` event is triggered 4. Baileys keeps track of all the changed conversations between connects Connects almost always take less than 10 seconds!
This commit is contained in:
@@ -32,7 +32,7 @@ const logger = pino({ prettyPrint: { levelFirst: true, ignore: 'hostname', trans
|
||||
|
||||
export class WAConnection extends EventEmitter {
|
||||
/** The version of WhatsApp Web we're telling the servers we are */
|
||||
version: [number, number, number] = [2, 2045, 15]
|
||||
version: [number, number, number] = [2, 2045, 19]
|
||||
/** The Browser we're telling the WhatsApp Web servers we are */
|
||||
browserDescription: [string, string, string] = Utils.Browsers.baileys ('Chrome')
|
||||
/** Metadata like WhatsApp id, name set on WhatsApp etc. */
|
||||
@@ -43,9 +43,9 @@ export class WAConnection extends EventEmitter {
|
||||
state: WAConnectionState = 'close'
|
||||
connectOptions: WAConnectOptions = {
|
||||
regenerateQRIntervalMs: 30_000,
|
||||
maxIdleTimeMs: 40_000,
|
||||
maxIdleTimeMs: 15_000,
|
||||
waitOnlyForLastMessage: false,
|
||||
waitForChats: true,
|
||||
waitForChats: false,
|
||||
maxRetries: 10,
|
||||
connectCooldownMs: 4000,
|
||||
phoneResponseTime: 15_000,
|
||||
@@ -67,6 +67,7 @@ export class WAConnection extends EventEmitter {
|
||||
maxCachedMessages = 50
|
||||
loadProfilePicturesForChatsAutomatically = true
|
||||
|
||||
lastChatsReceived: Date
|
||||
chats = new KeyedDB (Utils.waChatKey(false), value => value.jid)
|
||||
contacts: { [k: string]: WAContact } = {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user