mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
add max query response time + update package
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@adiwajshing/baileys",
|
||||
"version": "3.5.0",
|
||||
"version": "3.5.1",
|
||||
"description": "WhatsApp Web API",
|
||||
"homepage": "https://github.com/adiwajshing/Baileys",
|
||||
"main": "lib/index.js",
|
||||
|
||||
@@ -46,6 +46,7 @@ export class WAConnection extends EventEmitter {
|
||||
maxRetries: 10,
|
||||
connectCooldownMs: 4000,
|
||||
phoneResponseTime: 15_000,
|
||||
maxQueryResponseTime: 10_000,
|
||||
alwaysUseTakeover: true,
|
||||
queryChatsTillReceived: true
|
||||
}
|
||||
@@ -280,7 +281,7 @@ export class WAConnection extends EventEmitter {
|
||||
timeout = setTimeout(() => {
|
||||
this.logger.info({ tag }, `cancelling wait for message as a response is no longer expected from the phone`)
|
||||
cancel({ reason: 'Not expecting a response', status: 422 })
|
||||
}, 5_000)
|
||||
}, this.connectOptions.maxQueryResponseTime)
|
||||
this.off('connection-phone-change', listener)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,6 +134,8 @@ export type WAConnectOptions = {
|
||||
* this keeps pinging the phone to send the chats over
|
||||
* */
|
||||
queryChatsTillReceived?: boolean
|
||||
/** max time for the phone to respond to a query */
|
||||
maxQueryResponseTime?: number
|
||||
}
|
||||
/** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */
|
||||
export const URL_REGEX = /[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)?/gi
|
||||
|
||||
Reference in New Issue
Block a user