mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
possibly more reliable connect
This commit is contained in:
@@ -117,6 +117,9 @@ WAConnectionTest('Misc', (conn) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
it('should load a single message', async () => {
|
it('should load a single message', async () => {
|
||||||
|
const loaded = await conn.loadMessage (testJid, '5A3FF17786EBCD0EF350')
|
||||||
|
assert.equal (loaded.key.id, '5A3FF17786EBCD0EF350')
|
||||||
|
|
||||||
const {messages} = await conn.loadMessages (testJid, 10)
|
const {messages} = await conn.loadMessages (testJid, 10)
|
||||||
for (var message of messages) {
|
for (var message of messages) {
|
||||||
const loaded = await conn.loadMessage (testJid, message.key.id)
|
const loaded = await conn.loadMessage (testJid, message.key.id)
|
||||||
|
|||||||
@@ -36,10 +36,12 @@ export class WAConnection extends Base {
|
|||||||
})
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await promise
|
const tasks = [promise]
|
||||||
|
|
||||||
const waitForChats = typeof options?.waitForChats === 'undefined' ? true : options?.waitForChats
|
const waitForChats = typeof options?.waitForChats === 'undefined' ? true : options?.waitForChats
|
||||||
waitForChats && await this.receiveChatsAndContacts(options?.timeoutMs, true)
|
if (waitForChats) tasks.push (this.receiveChatsAndContacts(options?.timeoutMs, true))
|
||||||
|
|
||||||
|
await Promise.all (tasks)
|
||||||
|
|
||||||
this.phoneConnected = true
|
this.phoneConnected = true
|
||||||
this.state = 'open'
|
this.state = 'open'
|
||||||
|
|||||||
@@ -13,5 +13,5 @@
|
|||||||
"lib": ["es2019", "esnext.array"]
|
"lib": ["es2019", "esnext.array"]
|
||||||
},
|
},
|
||||||
"include": ["src/*/*.ts"],
|
"include": ["src/*/*.ts"],
|
||||||
"exclude": ["node_modules", "src/*/Tests.ts"]
|
"exclude": ["node_modules", "src/Tests/*"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user