@badzz88/baileys 8.5.3 → 8.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,26 @@
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', { value: true })
3
+ exports.waitForBackoff = exports.setProtocolBackoffMs = void 0
4
+
5
+ const backoffPromises = new Map()
6
+
7
+ const setProtocolBackoffMs = (protocolName, ms) => {
8
+ backoffPromises.set(protocolName, new Promise(resolve => setTimeout(resolve, ms)))
9
+ }
10
+ exports.setProtocolBackoffMs = setProtocolBackoffMs
11
+
12
+ const shouldWaitForBackoff = query => {
13
+ if (query.context === 'interactive') {
14
+ return false
15
+ }
16
+ const protocolNames = query.protocols.map(p => p.name)
17
+ return !(protocolNames.includes('devices') && (query.context === 'message' || query.context === 'voip'))
18
+ }
19
+
20
+ const waitForBackoff = async query => {
21
+ if (!shouldWaitForBackoff(query)) {
22
+ return
23
+ }
24
+ await Promise.all(query.protocols.map(p => backoffPromises.get(p.name)))
25
+ }
26
+ exports.waitForBackoff = waitForBackoff
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@badzz88/baileys",
3
- "version": "8.5.3",
3
+ "version": "8.5.5",
4
4
  "description": "Baileys Whatsapp Api Modification By Badzz88",
5
5
  "keywords": [
6
6
  "whatsapp",