@itsliaaa/baileys 0.1.30 โ 0.1.31
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.
- package/README.md +151 -28
- package/WAProto/index.js +380 -0
- package/lib/Defaults/index.js +1 -1
- package/lib/Utils/generics.js +1 -1
- package/lib/Utils/messages.js +115 -133
- package/lib/Utils/use-single-file-auth-state.js +31 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,14 +53,19 @@ Hi everyone,
|
|
|
53
53
|
>
|
|
54
54
|
> Thank you for taking the time to read this ๐ค
|
|
55
55
|
|
|
56
|
+
> [!NOTE]
|
|
57
|
+
๐ This project is maintained with limited scope and is not intended to replace upstream Baileys.
|
|
58
|
+
>
|
|
59
|
+
> ๐ And, really sorry for my bad english.
|
|
60
|
+
|
|
56
61
|
### ๐ ๏ธ Internal Adjustments
|
|
57
62
|
- ๐ผ๏ธ Fixed an issue where media could not be sent to newsletters due to an upstream issue.
|
|
58
63
|
- ๐ Reintroduced [`makeInMemoryStore`](#%EF%B8%8F-implementing-a-data-store) with a minimal ESM adaptation and small adjustments for Baileys v7.
|
|
59
64
|
- ๐ฆ Switched FFmpeg execution from `exec` to `spawn` for safer process handling.
|
|
60
65
|
- ๐๏ธ Added [`@napi-rs/image`](https://www.npmjs.com/package/@napi-rs/image) as a supported image processing backend in [`getImageProcessingLibrary()`](#%EF%B8%8F-image-processing), offering a balance between performance and compatibility.
|
|
61
66
|
|
|
62
|
-
### ๐จ
|
|
63
|
-
- ๐ฉ Expanded
|
|
67
|
+
### ๐จ Messages Handling & Compatibility
|
|
68
|
+
- ๐ฉ Expanded messages support for:
|
|
64
69
|
- ๐ผ๏ธ [Album Message](#%EF%B8%8F-album-image--video)
|
|
65
70
|
- ๐ค [Group Status Message](#4%EF%B8%8Fโฃ-group-status)
|
|
66
71
|
- ๐๐ป [Interactive Message](#-sending-interactive-messages) (buttons, lists, native flows, templates, carousels).
|
|
@@ -82,10 +87,68 @@ Hi everyone,
|
|
|
82
87
|
- ๐ [`secureMetaServiceLabel`](#6%EF%B8%8Fโฃ-secure-meta-service-label) - Secure meta service label on message **[NEW]**
|
|
83
88
|
- ๐ [`raw`](#5%EF%B8%8Fโฃ-raw) - Build your message manually **(DO NOT USE FOR EXPLOITATION)**
|
|
84
89
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
### ๐ Index
|
|
91
|
+
- [๐ฅ Installation](#-installation)
|
|
92
|
+
- [๐งฉ Import (ESM & CJS)](#-import-esm--cjs)
|
|
93
|
+
- [๐ Connect to WhatsApp (Quick Step)](#-connect-to-whatsapp-quick-step)
|
|
94
|
+
- [๐๏ธ Implementing Data Store](#%EF%B8%8F-implementing-data-store)
|
|
95
|
+
- [๐ชช WhatsApp IDs Explain](#-whatsapp-ids-explain)
|
|
96
|
+
- [โ๏ธ Sending Messages](#%EF%B8%8F-sending-messages)
|
|
97
|
+
- [๐ Text](#-text)
|
|
98
|
+
- [๐ Mention](#-mention)
|
|
99
|
+
- [๐ Reaction](#-reaction)
|
|
100
|
+
- [๐ Pin Message](#-pin-message)
|
|
101
|
+
- [โก๏ธ Forward Message](#%EF%B8%8F-forward-message)
|
|
102
|
+
- [๐ค Contact](#-contact)
|
|
103
|
+
- [๐ Location](#-location)
|
|
104
|
+
- [๐๏ธ Event](#%EF%B8%8F-event)
|
|
105
|
+
- [๐ฅ Group Invite](#-group-invite)
|
|
106
|
+
- [๐๏ธ Product](#%EF%B8%8F-product)
|
|
107
|
+
- [๐ Poll](#-poll)
|
|
108
|
+
- [๐ญ Button Response](#-button-response)
|
|
109
|
+
- [โจ Rich Response](#-rich-response)
|
|
110
|
+
- [๐งพ Message with Code Block](#-message-with-code-block)
|
|
111
|
+
- [๐ Message with Table](#-message-with-table)
|
|
112
|
+
- [๐๏ธ Status Mention](#%EF%B8%8F-status-mention)
|
|
113
|
+
- [๐ Sending Media Messages](#-sending-media-messages)
|
|
114
|
+
- [๐ผ๏ธ Image](#%EF%B8%8F-image)
|
|
115
|
+
- [๐ฅ Video](#-video)
|
|
116
|
+
- [๐ Sticker](#-sticker)
|
|
117
|
+
- [๐ฝ Audio](#-audio)
|
|
118
|
+
- [๐๏ธ Document](#%EF%B8%8F-document)
|
|
119
|
+
- [๐ผ๏ธ Album (Image & Video)](#%EF%B8%8F-album-image--video)
|
|
120
|
+
- [๐ฆ Sticker Pack](#-sticker-pack)
|
|
121
|
+
- [๐๐ป Sending Interactive Messages](#-sending-interactive-messages)
|
|
122
|
+
- [1๏ธโฃ Buttons](#1%EF%B8%8Fโฃ-buttons)
|
|
123
|
+
- [2๏ธโฃ List](#2%EF%B8%8Fโฃ-list)
|
|
124
|
+
- [3๏ธโฃ Interactive](#3%EF%B8%8Fโฃ-interactive)
|
|
125
|
+
- [4๏ธโฃ Hydrated Template](#4%EF%B8%8Fโฃ-hydrated-template)
|
|
126
|
+
- [๐ณ Sending Payment Messages](#-sending-payment-messages)
|
|
127
|
+
- [1๏ธโฃ Invite Payment](#1%EF%B8%8Fโฃ-invite-payment)
|
|
128
|
+
- [2๏ธโฃ Invoice](#2%EF%B8%8Fโฃ-invoice)
|
|
129
|
+
- [3๏ธโฃ Order](#3%EF%B8%8Fโฃ-order)
|
|
130
|
+
- [4๏ธโฃ Request Payment](#4%EF%B8%8Fโฃ-request-payment)
|
|
131
|
+
- [๐๏ธ Other Message Options](#%EF%B8%8F-other-message-options)
|
|
132
|
+
- [1๏ธโฃ AI Icon](#1%EF%B8%8Fโฃ-ai-icon)
|
|
133
|
+
- [2๏ธโฃ Ephemeral](#2%EF%B8%8Fโฃ-ephemeral)
|
|
134
|
+
- [3๏ธโฃ External Ad Reply](#3%EF%B8%8Fโฃ-external-ad-reply)
|
|
135
|
+
- [4๏ธโฃ Group Status](#4%EF%B8%8Fโฃ-group-status)
|
|
136
|
+
- [5๏ธโฃ Raw](#5%EF%B8%8Fโฃ-raw)
|
|
137
|
+
- [6๏ธโฃ Secure Meta Service Label](#6%EF%B8%8Fโฃ-secure-meta-service-label)
|
|
138
|
+
- [7๏ธโฃ View Once](#7%EF%B8%8Fโฃ-view-once)
|
|
139
|
+
- [8๏ธโฃ View Once V2](#8%EF%B8%8Fโฃ-view-once-v2)
|
|
140
|
+
- [9๏ธโฃ View Once V2 Extension](#9%EF%B8%8Fโฃ-view-once-v2-extension)
|
|
141
|
+
- [โป๏ธ Modify Messages](#%EF%B8%8F-modify-messages)
|
|
142
|
+
- [๐๏ธ Delete Messages](#%EF%B8%8F-delete-messages)
|
|
143
|
+
- [โ๏ธ Edit Messages](#%EF%B8%8F-edit-messages)
|
|
144
|
+
- [๐งฐ Additional Contents](#-additional-contents)
|
|
145
|
+
- [๐ท๏ธ Find User ID (JID|PN/LID)](#%EF%B8%8F-find-user-id-jidpnlid)
|
|
146
|
+
- [๐ Request Custom Pairing Code](#-request-custom-pairing-code)
|
|
147
|
+
- [๐ผ๏ธ Image Processing](#%EF%B8%8F-image-processing)
|
|
148
|
+
- [๐ฃ Newsletter Management](#-newsletter-management)
|
|
149
|
+
- [๐ฅ Group Management](#-group-management)
|
|
150
|
+
- [๐ฆ Fork Base](#-fork-base)
|
|
151
|
+
- [๐ฃ Credits](#-credits)
|
|
89
152
|
|
|
90
153
|
### ๐ฅ Installation
|
|
91
154
|
|
|
@@ -322,6 +385,15 @@ sock.sendMessage(jid, {
|
|
|
322
385
|
})
|
|
323
386
|
```
|
|
324
387
|
|
|
388
|
+
#### โก๏ธ Forward Message
|
|
389
|
+
|
|
390
|
+
```javascript
|
|
391
|
+
sock.sendMessage(jid, {
|
|
392
|
+
forward: message,
|
|
393
|
+
force: true // --- Optional
|
|
394
|
+
})
|
|
395
|
+
```
|
|
396
|
+
|
|
325
397
|
#### ๐ค Contact
|
|
326
398
|
|
|
327
399
|
```javascript
|
|
@@ -385,11 +457,12 @@ sock.sendMessage(jid, {
|
|
|
385
457
|
#### ๐ฅ Group Invite
|
|
386
458
|
|
|
387
459
|
```javascript
|
|
460
|
+
const inviteCode = groupUrl
|
|
461
|
+
.split('chat.whatsapp.com/')[1]
|
|
462
|
+
?.split('?')[0]
|
|
463
|
+
|
|
388
464
|
const groupJid = '1201111111111@g.us'
|
|
389
465
|
const groupName = '@itsliaaa/baileys'
|
|
390
|
-
const inviteCode = groupUrl
|
|
391
|
-
.split('chat.whatsapp.com/')[1]?
|
|
392
|
-
.split('?')[0]
|
|
393
466
|
|
|
394
467
|
sock.sendMessage(jid, {
|
|
395
468
|
groupInvite: {
|
|
@@ -404,6 +477,32 @@ sock.sendMessage(jid, {
|
|
|
404
477
|
})
|
|
405
478
|
```
|
|
406
479
|
|
|
480
|
+
#### ๐๏ธ Product
|
|
481
|
+
|
|
482
|
+
```javascript
|
|
483
|
+
import { randomUUID } from 'crypto'
|
|
484
|
+
|
|
485
|
+
sock.sendMessage(jid, {
|
|
486
|
+
image: {
|
|
487
|
+
url: './path/to/image.jpg'
|
|
488
|
+
},
|
|
489
|
+
body: '๐๐ป Check my product here!',
|
|
490
|
+
footer: '@itsliaaa/baileys',
|
|
491
|
+
product: {
|
|
492
|
+
currencyCode: 'IDR',
|
|
493
|
+
description: '๐๏ธ Interesting product!',
|
|
494
|
+
priceAmount1000: 70_000_000,
|
|
495
|
+
productId: randomUUID(),
|
|
496
|
+
productImageCount: 1,
|
|
497
|
+
salePriceAmount1000: 65_000_000,
|
|
498
|
+
signedUrl: 'https://www.npmjs.com/package/@itsliaaa/baileys',
|
|
499
|
+
title: '๐ฆ Starseed (Premium)',
|
|
500
|
+
url: 'https://www.npmjs.com/package/@itsliaaa/baileys'
|
|
501
|
+
},
|
|
502
|
+
businessOwnerJid: '0@s.whatsapp.net'
|
|
503
|
+
})
|
|
504
|
+
```
|
|
505
|
+
|
|
407
506
|
#### ๐ Poll
|
|
408
507
|
|
|
409
508
|
```javascript
|
|
@@ -463,7 +562,7 @@ sock.sendMessage(jid, {
|
|
|
463
562
|
})
|
|
464
563
|
```
|
|
465
564
|
|
|
466
|
-
#### ๐ญ Response
|
|
565
|
+
#### ๐ญ Button Response
|
|
467
566
|
|
|
468
567
|
```javascript
|
|
469
568
|
// --- Using buttonsResponseMessage
|
|
@@ -675,6 +774,20 @@ sock.sendMessage(jid, {
|
|
|
675
774
|
})
|
|
676
775
|
```
|
|
677
776
|
|
|
777
|
+
#### ๐๏ธ Document
|
|
778
|
+
|
|
779
|
+
```javascript
|
|
780
|
+
sock.sendMessage(jid, {
|
|
781
|
+
document: {
|
|
782
|
+
url: './path/to/document.pdf'
|
|
783
|
+
},
|
|
784
|
+
mimetype: 'application/pdf',
|
|
785
|
+
caption: 'โจ My work!'
|
|
786
|
+
}, {
|
|
787
|
+
quoted: message
|
|
788
|
+
})
|
|
789
|
+
```
|
|
790
|
+
|
|
678
791
|
#### ๐ผ๏ธ Album (Image & Video)
|
|
679
792
|
|
|
680
793
|
```javascript
|
|
@@ -828,7 +941,7 @@ sock.sendMessage(jid, {
|
|
|
828
941
|
image: {
|
|
829
942
|
url: './path/to/image.jpg'
|
|
830
943
|
},
|
|
831
|
-
caption: '
|
|
944
|
+
caption: '??๏ธ Interactive!',
|
|
832
945
|
footer: '@itsliaaa/baileys',
|
|
833
946
|
optionText: '๐๐ป Select Options', // --- Optional, wrap all native flow into a single list
|
|
834
947
|
optionTitle: '๐ Select Options', // --- Optional
|
|
@@ -992,23 +1105,7 @@ sock.sendMessage(chat, {
|
|
|
992
1105
|
})
|
|
993
1106
|
```
|
|
994
1107
|
|
|
995
|
-
#### 4๏ธโฃ
|
|
996
|
-
|
|
997
|
-
```javascript
|
|
998
|
-
sock.sendMessage(jid, {
|
|
999
|
-
image: {
|
|
1000
|
-
url: './path/to/image.jpg'
|
|
1001
|
-
},
|
|
1002
|
-
product: {
|
|
1003
|
-
title: '๐ My Product'
|
|
1004
|
-
},
|
|
1005
|
-
businessOwnerJid: '0@s.whatsapp.net' // --- Must included
|
|
1006
|
-
}, {
|
|
1007
|
-
quoted: message
|
|
1008
|
-
})
|
|
1009
|
-
```
|
|
1010
|
-
|
|
1011
|
-
#### 5๏ธโฃ Request Payment
|
|
1108
|
+
#### 4๏ธโฃ Request Payment
|
|
1012
1109
|
|
|
1013
1110
|
```javascript
|
|
1014
1111
|
sock.sendMessage(jid, {
|
|
@@ -1162,6 +1259,32 @@ sock.sendMessage(jid, {
|
|
|
1162
1259
|
})
|
|
1163
1260
|
```
|
|
1164
1261
|
|
|
1262
|
+
### โป๏ธ Modify Messages
|
|
1263
|
+
|
|
1264
|
+
#### ๐๏ธ Delete Messages
|
|
1265
|
+
|
|
1266
|
+
```javascript
|
|
1267
|
+
sock.sendMessage(jid, {
|
|
1268
|
+
delete: message.key
|
|
1269
|
+
})
|
|
1270
|
+
```
|
|
1271
|
+
|
|
1272
|
+
#### โ๏ธ Edit Messages
|
|
1273
|
+
|
|
1274
|
+
```javascript
|
|
1275
|
+
// --- Edit plain text
|
|
1276
|
+
sock.sendMessage(jid, {
|
|
1277
|
+
text: 'โจ I mean, nice!',
|
|
1278
|
+
edit: message.key
|
|
1279
|
+
})
|
|
1280
|
+
|
|
1281
|
+
// --- Edit media messages caption
|
|
1282
|
+
sock.sendMessage(jid, {
|
|
1283
|
+
caption: 'โจ I mean, here is the image!',
|
|
1284
|
+
edit: message.key
|
|
1285
|
+
})
|
|
1286
|
+
```
|
|
1287
|
+
|
|
1165
1288
|
### ๐งฐ Additional Contents
|
|
1166
1289
|
|
|
1167
1290
|
#### ๐ท๏ธ Find User ID (JID|PN/LID)
|
package/WAProto/index.js
CHANGED
|
@@ -73291,6 +73291,8 @@ export const proto = $root.proto = (() => {
|
|
|
73291
73291
|
values[valuesById[83] = "CUSTOMER_DATA_ACTION"] = 83;
|
|
73292
73292
|
values[valuesById[84] = "SUBSCRIPTIONS_SYNC_V2_ACTION"] = 84;
|
|
73293
73293
|
values[valuesById[85] = "THREAD_PIN_ACTION"] = 85;
|
|
73294
|
+
values[valuesById[86] = "AUTO_ORGANIZE_BUSINESS_CHAT_SETTING"] = 86;
|
|
73295
|
+
values[valuesById[87] = "BIZ_AI_SETTINGS_NUDGE_ACTION"] = 87;
|
|
73294
73296
|
values[valuesById[10001] = "SHARE_OWN_PN"] = 10001;
|
|
73295
73297
|
values[valuesById[10002] = "BUSINESS_BROADCAST_ACTION"] = 10002;
|
|
73296
73298
|
values[valuesById[10003] = "AI_THREAD_DELETE_ACTION"] = 10003;
|
|
@@ -83461,6 +83463,8 @@ export const proto = $root.proto = (() => {
|
|
|
83461
83463
|
SyncActionValue.prototype.customerDataAction = null;
|
|
83462
83464
|
SyncActionValue.prototype.subscriptionsSyncV2Action = null;
|
|
83463
83465
|
SyncActionValue.prototype.threadPinAction = null;
|
|
83466
|
+
SyncActionValue.prototype.autoOrganizeBusinessChatSetting = null;
|
|
83467
|
+
SyncActionValue.prototype.bizAiSettingsNudgeAction = null;
|
|
83464
83468
|
|
|
83465
83469
|
let $oneOfFields;
|
|
83466
83470
|
|
|
@@ -83844,6 +83848,16 @@ export const proto = $root.proto = (() => {
|
|
|
83844
83848
|
set: $util.oneOfSetter($oneOfFields)
|
|
83845
83849
|
});
|
|
83846
83850
|
|
|
83851
|
+
Object.defineProperty(SyncActionValue.prototype, "_autoOrganizeBusinessChatSetting", {
|
|
83852
|
+
get: $util.oneOfGetter($oneOfFields = ["autoOrganizeBusinessChatSetting"]),
|
|
83853
|
+
set: $util.oneOfSetter($oneOfFields)
|
|
83854
|
+
});
|
|
83855
|
+
|
|
83856
|
+
Object.defineProperty(SyncActionValue.prototype, "_bizAiSettingsNudgeAction", {
|
|
83857
|
+
get: $util.oneOfGetter($oneOfFields = ["bizAiSettingsNudgeAction"]),
|
|
83858
|
+
set: $util.oneOfSetter($oneOfFields)
|
|
83859
|
+
});
|
|
83860
|
+
|
|
83847
83861
|
SyncActionValue.create = function create(properties) {
|
|
83848
83862
|
return new SyncActionValue(properties);
|
|
83849
83863
|
};
|
|
@@ -84003,6 +84017,10 @@ export const proto = $root.proto = (() => {
|
|
|
84003
84017
|
$root.proto.SyncActionValue.SubscriptionsSyncV2Action.encode(m.subscriptionsSyncV2Action, w.uint32(674).fork()).ldelim();
|
|
84004
84018
|
if (m.threadPinAction != null && Object.hasOwnProperty.call(m, "threadPinAction"))
|
|
84005
84019
|
$root.proto.SyncActionValue.ThreadPinAction.encode(m.threadPinAction, w.uint32(682).fork()).ldelim();
|
|
84020
|
+
if (m.autoOrganizeBusinessChatSetting != null && Object.hasOwnProperty.call(m, "autoOrganizeBusinessChatSetting"))
|
|
84021
|
+
$root.proto.SyncActionValue.AutoOrganizeBusinessChatSetting.encode(m.autoOrganizeBusinessChatSetting, w.uint32(690).fork()).ldelim();
|
|
84022
|
+
if (m.bizAiSettingsNudgeAction != null && Object.hasOwnProperty.call(m, "bizAiSettingsNudgeAction"))
|
|
84023
|
+
$root.proto.SyncActionValue.BizAISettingsNudgeAction.encode(m.bizAiSettingsNudgeAction, w.uint32(698).fork()).ldelim();
|
|
84006
84024
|
return w;
|
|
84007
84025
|
};
|
|
84008
84026
|
|
|
@@ -84319,6 +84337,14 @@ export const proto = $root.proto = (() => {
|
|
|
84319
84337
|
m.threadPinAction = $root.proto.SyncActionValue.ThreadPinAction.decode(r, r.uint32());
|
|
84320
84338
|
break;
|
|
84321
84339
|
}
|
|
84340
|
+
case 86: {
|
|
84341
|
+
m.autoOrganizeBusinessChatSetting = $root.proto.SyncActionValue.AutoOrganizeBusinessChatSetting.decode(r, r.uint32());
|
|
84342
|
+
break;
|
|
84343
|
+
}
|
|
84344
|
+
case 87: {
|
|
84345
|
+
m.bizAiSettingsNudgeAction = $root.proto.SyncActionValue.BizAISettingsNudgeAction.decode(r, r.uint32());
|
|
84346
|
+
break;
|
|
84347
|
+
}
|
|
84322
84348
|
default:
|
|
84323
84349
|
r.skipType(t & 7);
|
|
84324
84350
|
break;
|
|
@@ -84716,6 +84742,16 @@ export const proto = $root.proto = (() => {
|
|
|
84716
84742
|
throw TypeError(".proto.SyncActionValue.threadPinAction: object expected");
|
|
84717
84743
|
m.threadPinAction = $root.proto.SyncActionValue.ThreadPinAction.fromObject(d.threadPinAction);
|
|
84718
84744
|
}
|
|
84745
|
+
if (d.autoOrganizeBusinessChatSetting != null) {
|
|
84746
|
+
if (typeof d.autoOrganizeBusinessChatSetting !== "object")
|
|
84747
|
+
throw TypeError(".proto.SyncActionValue.autoOrganizeBusinessChatSetting: object expected");
|
|
84748
|
+
m.autoOrganizeBusinessChatSetting = $root.proto.SyncActionValue.AutoOrganizeBusinessChatSetting.fromObject(d.autoOrganizeBusinessChatSetting);
|
|
84749
|
+
}
|
|
84750
|
+
if (d.bizAiSettingsNudgeAction != null) {
|
|
84751
|
+
if (typeof d.bizAiSettingsNudgeAction !== "object")
|
|
84752
|
+
throw TypeError(".proto.SyncActionValue.bizAiSettingsNudgeAction: object expected");
|
|
84753
|
+
m.bizAiSettingsNudgeAction = $root.proto.SyncActionValue.BizAISettingsNudgeAction.fromObject(d.bizAiSettingsNudgeAction);
|
|
84754
|
+
}
|
|
84719
84755
|
return m;
|
|
84720
84756
|
};
|
|
84721
84757
|
|
|
@@ -85106,6 +85142,16 @@ export const proto = $root.proto = (() => {
|
|
|
85106
85142
|
if (o.oneofs)
|
|
85107
85143
|
d._threadPinAction = "threadPinAction";
|
|
85108
85144
|
}
|
|
85145
|
+
if (m.autoOrganizeBusinessChatSetting != null && m.hasOwnProperty("autoOrganizeBusinessChatSetting")) {
|
|
85146
|
+
d.autoOrganizeBusinessChatSetting = $root.proto.SyncActionValue.AutoOrganizeBusinessChatSetting.toObject(m.autoOrganizeBusinessChatSetting, o);
|
|
85147
|
+
if (o.oneofs)
|
|
85148
|
+
d._autoOrganizeBusinessChatSetting = "autoOrganizeBusinessChatSetting";
|
|
85149
|
+
}
|
|
85150
|
+
if (m.bizAiSettingsNudgeAction != null && m.hasOwnProperty("bizAiSettingsNudgeAction")) {
|
|
85151
|
+
d.bizAiSettingsNudgeAction = $root.proto.SyncActionValue.BizAISettingsNudgeAction.toObject(m.bizAiSettingsNudgeAction, o);
|
|
85152
|
+
if (o.oneofs)
|
|
85153
|
+
d._bizAiSettingsNudgeAction = "bizAiSettingsNudgeAction";
|
|
85154
|
+
}
|
|
85109
85155
|
return d;
|
|
85110
85156
|
};
|
|
85111
85157
|
|
|
@@ -85530,6 +85576,93 @@ export const proto = $root.proto = (() => {
|
|
|
85530
85576
|
return ArchiveChatAction;
|
|
85531
85577
|
})();
|
|
85532
85578
|
|
|
85579
|
+
SyncActionValue.AutoOrganizeBusinessChatSetting = (function() {
|
|
85580
|
+
|
|
85581
|
+
function AutoOrganizeBusinessChatSetting(p) {
|
|
85582
|
+
if (p)
|
|
85583
|
+
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
85584
|
+
if (p[ks[i]] != null)
|
|
85585
|
+
this[ks[i]] = p[ks[i]];
|
|
85586
|
+
}
|
|
85587
|
+
|
|
85588
|
+
AutoOrganizeBusinessChatSetting.prototype.autoOrganize = null;
|
|
85589
|
+
|
|
85590
|
+
let $oneOfFields;
|
|
85591
|
+
|
|
85592
|
+
Object.defineProperty(AutoOrganizeBusinessChatSetting.prototype, "_autoOrganize", {
|
|
85593
|
+
get: $util.oneOfGetter($oneOfFields = ["autoOrganize"]),
|
|
85594
|
+
set: $util.oneOfSetter($oneOfFields)
|
|
85595
|
+
});
|
|
85596
|
+
|
|
85597
|
+
AutoOrganizeBusinessChatSetting.create = function create(properties) {
|
|
85598
|
+
return new AutoOrganizeBusinessChatSetting(properties);
|
|
85599
|
+
};
|
|
85600
|
+
|
|
85601
|
+
AutoOrganizeBusinessChatSetting.encode = function encode(m, w) {
|
|
85602
|
+
if (!w)
|
|
85603
|
+
w = $Writer.create();
|
|
85604
|
+
if (m.autoOrganize != null && Object.hasOwnProperty.call(m, "autoOrganize"))
|
|
85605
|
+
w.uint32(8).bool(m.autoOrganize);
|
|
85606
|
+
return w;
|
|
85607
|
+
};
|
|
85608
|
+
|
|
85609
|
+
AutoOrganizeBusinessChatSetting.decode = function decode(r, l, e) {
|
|
85610
|
+
if (!(r instanceof $Reader))
|
|
85611
|
+
r = $Reader.create(r);
|
|
85612
|
+
var c = l === undefined ? r.len : r.pos + l, m = new $root.proto.SyncActionValue.AutoOrganizeBusinessChatSetting();
|
|
85613
|
+
while (r.pos < c) {
|
|
85614
|
+
var t = r.uint32();
|
|
85615
|
+
if (t === e)
|
|
85616
|
+
break;
|
|
85617
|
+
switch (t >>> 3) {
|
|
85618
|
+
case 1: {
|
|
85619
|
+
m.autoOrganize = r.bool();
|
|
85620
|
+
break;
|
|
85621
|
+
}
|
|
85622
|
+
default:
|
|
85623
|
+
r.skipType(t & 7);
|
|
85624
|
+
break;
|
|
85625
|
+
}
|
|
85626
|
+
}
|
|
85627
|
+
return m;
|
|
85628
|
+
};
|
|
85629
|
+
|
|
85630
|
+
AutoOrganizeBusinessChatSetting.fromObject = function fromObject(d) {
|
|
85631
|
+
if (d instanceof $root.proto.SyncActionValue.AutoOrganizeBusinessChatSetting)
|
|
85632
|
+
return d;
|
|
85633
|
+
var m = new $root.proto.SyncActionValue.AutoOrganizeBusinessChatSetting();
|
|
85634
|
+
if (d.autoOrganize != null) {
|
|
85635
|
+
m.autoOrganize = Boolean(d.autoOrganize);
|
|
85636
|
+
}
|
|
85637
|
+
return m;
|
|
85638
|
+
};
|
|
85639
|
+
|
|
85640
|
+
AutoOrganizeBusinessChatSetting.toObject = function toObject(m, o) {
|
|
85641
|
+
if (!o)
|
|
85642
|
+
o = {};
|
|
85643
|
+
var d = {};
|
|
85644
|
+
if (m.autoOrganize != null && m.hasOwnProperty("autoOrganize")) {
|
|
85645
|
+
d.autoOrganize = m.autoOrganize;
|
|
85646
|
+
if (o.oneofs)
|
|
85647
|
+
d._autoOrganize = "autoOrganize";
|
|
85648
|
+
}
|
|
85649
|
+
return d;
|
|
85650
|
+
};
|
|
85651
|
+
|
|
85652
|
+
AutoOrganizeBusinessChatSetting.prototype.toJSON = function toJSON() {
|
|
85653
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
85654
|
+
};
|
|
85655
|
+
|
|
85656
|
+
AutoOrganizeBusinessChatSetting.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
85657
|
+
if (typeUrlPrefix === undefined) {
|
|
85658
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
85659
|
+
}
|
|
85660
|
+
return typeUrlPrefix + "/proto.SyncActionValue.AutoOrganizeBusinessChatSetting";
|
|
85661
|
+
};
|
|
85662
|
+
|
|
85663
|
+
return AutoOrganizeBusinessChatSetting;
|
|
85664
|
+
})();
|
|
85665
|
+
|
|
85533
85666
|
SyncActionValue.AvatarUpdatedAction = (function() {
|
|
85534
85667
|
|
|
85535
85668
|
function AvatarUpdatedAction(p) {
|
|
@@ -85673,6 +85806,193 @@ export const proto = $root.proto = (() => {
|
|
|
85673
85806
|
return AvatarUpdatedAction;
|
|
85674
85807
|
})();
|
|
85675
85808
|
|
|
85809
|
+
SyncActionValue.BizAISettingsNudgeAction = (function() {
|
|
85810
|
+
|
|
85811
|
+
function BizAISettingsNudgeAction(p) {
|
|
85812
|
+
if (p)
|
|
85813
|
+
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
85814
|
+
if (p[ks[i]] != null)
|
|
85815
|
+
this[ks[i]] = p[ks[i]];
|
|
85816
|
+
}
|
|
85817
|
+
|
|
85818
|
+
BizAISettingsNudgeAction.prototype.category = null;
|
|
85819
|
+
BizAISettingsNudgeAction.prototype.version = null;
|
|
85820
|
+
BizAISettingsNudgeAction.prototype.updatedAtMs = null;
|
|
85821
|
+
|
|
85822
|
+
let $oneOfFields;
|
|
85823
|
+
|
|
85824
|
+
Object.defineProperty(BizAISettingsNudgeAction.prototype, "_category", {
|
|
85825
|
+
get: $util.oneOfGetter($oneOfFields = ["category"]),
|
|
85826
|
+
set: $util.oneOfSetter($oneOfFields)
|
|
85827
|
+
});
|
|
85828
|
+
|
|
85829
|
+
Object.defineProperty(BizAISettingsNudgeAction.prototype, "_version", {
|
|
85830
|
+
get: $util.oneOfGetter($oneOfFields = ["version"]),
|
|
85831
|
+
set: $util.oneOfSetter($oneOfFields)
|
|
85832
|
+
});
|
|
85833
|
+
|
|
85834
|
+
Object.defineProperty(BizAISettingsNudgeAction.prototype, "_updatedAtMs", {
|
|
85835
|
+
get: $util.oneOfGetter($oneOfFields = ["updatedAtMs"]),
|
|
85836
|
+
set: $util.oneOfSetter($oneOfFields)
|
|
85837
|
+
});
|
|
85838
|
+
|
|
85839
|
+
BizAISettingsNudgeAction.create = function create(properties) {
|
|
85840
|
+
return new BizAISettingsNudgeAction(properties);
|
|
85841
|
+
};
|
|
85842
|
+
|
|
85843
|
+
BizAISettingsNudgeAction.encode = function encode(m, w) {
|
|
85844
|
+
if (!w)
|
|
85845
|
+
w = $Writer.create();
|
|
85846
|
+
if (m.category != null && Object.hasOwnProperty.call(m, "category"))
|
|
85847
|
+
w.uint32(8).int32(m.category);
|
|
85848
|
+
if (m.version != null && Object.hasOwnProperty.call(m, "version"))
|
|
85849
|
+
w.uint32(16).int64(m.version);
|
|
85850
|
+
if (m.updatedAtMs != null && Object.hasOwnProperty.call(m, "updatedAtMs"))
|
|
85851
|
+
w.uint32(24).int64(m.updatedAtMs);
|
|
85852
|
+
return w;
|
|
85853
|
+
};
|
|
85854
|
+
|
|
85855
|
+
BizAISettingsNudgeAction.decode = function decode(r, l, e) {
|
|
85856
|
+
if (!(r instanceof $Reader))
|
|
85857
|
+
r = $Reader.create(r);
|
|
85858
|
+
var c = l === undefined ? r.len : r.pos + l, m = new $root.proto.SyncActionValue.BizAISettingsNudgeAction();
|
|
85859
|
+
while (r.pos < c) {
|
|
85860
|
+
var t = r.uint32();
|
|
85861
|
+
if (t === e)
|
|
85862
|
+
break;
|
|
85863
|
+
switch (t >>> 3) {
|
|
85864
|
+
case 1: {
|
|
85865
|
+
m.category = r.int32();
|
|
85866
|
+
break;
|
|
85867
|
+
}
|
|
85868
|
+
case 2: {
|
|
85869
|
+
m.version = r.int64();
|
|
85870
|
+
break;
|
|
85871
|
+
}
|
|
85872
|
+
case 3: {
|
|
85873
|
+
m.updatedAtMs = r.int64();
|
|
85874
|
+
break;
|
|
85875
|
+
}
|
|
85876
|
+
default:
|
|
85877
|
+
r.skipType(t & 7);
|
|
85878
|
+
break;
|
|
85879
|
+
}
|
|
85880
|
+
}
|
|
85881
|
+
return m;
|
|
85882
|
+
};
|
|
85883
|
+
|
|
85884
|
+
BizAISettingsNudgeAction.fromObject = function fromObject(d) {
|
|
85885
|
+
if (d instanceof $root.proto.SyncActionValue.BizAISettingsNudgeAction)
|
|
85886
|
+
return d;
|
|
85887
|
+
var m = new $root.proto.SyncActionValue.BizAISettingsNudgeAction();
|
|
85888
|
+
switch (d.category) {
|
|
85889
|
+
default:
|
|
85890
|
+
if (typeof d.category === "number") {
|
|
85891
|
+
m.category = d.category;
|
|
85892
|
+
break;
|
|
85893
|
+
}
|
|
85894
|
+
break;
|
|
85895
|
+
case "UNKNOWN":
|
|
85896
|
+
case 0:
|
|
85897
|
+
m.category = 0;
|
|
85898
|
+
break;
|
|
85899
|
+
case "INSTRUCTIONS":
|
|
85900
|
+
case 1:
|
|
85901
|
+
m.category = 1;
|
|
85902
|
+
break;
|
|
85903
|
+
case "RESPONSE_SETTINGS":
|
|
85904
|
+
case 2:
|
|
85905
|
+
m.category = 2;
|
|
85906
|
+
break;
|
|
85907
|
+
case "EXAMPLE_RESPONSES":
|
|
85908
|
+
case 3:
|
|
85909
|
+
m.category = 3;
|
|
85910
|
+
break;
|
|
85911
|
+
case "KNOWLEDGE":
|
|
85912
|
+
case 4:
|
|
85913
|
+
m.category = 4;
|
|
85914
|
+
break;
|
|
85915
|
+
case "LEAD_GEN":
|
|
85916
|
+
case 5:
|
|
85917
|
+
m.category = 5;
|
|
85918
|
+
break;
|
|
85919
|
+
}
|
|
85920
|
+
if (d.version != null) {
|
|
85921
|
+
if ($util.Long)
|
|
85922
|
+
(m.version = $util.Long.fromValue(d.version)).unsigned = false;
|
|
85923
|
+
else if (typeof d.version === "string")
|
|
85924
|
+
m.version = parseInt(d.version, 10);
|
|
85925
|
+
else if (typeof d.version === "number")
|
|
85926
|
+
m.version = d.version;
|
|
85927
|
+
else if (typeof d.version === "object")
|
|
85928
|
+
m.version = new $util.LongBits(d.version.low >>> 0, d.version.high >>> 0).toNumber();
|
|
85929
|
+
}
|
|
85930
|
+
if (d.updatedAtMs != null) {
|
|
85931
|
+
if ($util.Long)
|
|
85932
|
+
(m.updatedAtMs = $util.Long.fromValue(d.updatedAtMs)).unsigned = false;
|
|
85933
|
+
else if (typeof d.updatedAtMs === "string")
|
|
85934
|
+
m.updatedAtMs = parseInt(d.updatedAtMs, 10);
|
|
85935
|
+
else if (typeof d.updatedAtMs === "number")
|
|
85936
|
+
m.updatedAtMs = d.updatedAtMs;
|
|
85937
|
+
else if (typeof d.updatedAtMs === "object")
|
|
85938
|
+
m.updatedAtMs = new $util.LongBits(d.updatedAtMs.low >>> 0, d.updatedAtMs.high >>> 0).toNumber();
|
|
85939
|
+
}
|
|
85940
|
+
return m;
|
|
85941
|
+
};
|
|
85942
|
+
|
|
85943
|
+
BizAISettingsNudgeAction.toObject = function toObject(m, o) {
|
|
85944
|
+
if (!o)
|
|
85945
|
+
o = {};
|
|
85946
|
+
var d = {};
|
|
85947
|
+
if (m.category != null && m.hasOwnProperty("category")) {
|
|
85948
|
+
d.category = o.enums === String ? $root.proto.SyncActionValue.BizAISettingsNudgeAction.BizAISettingsCategory[m.category] === undefined ? m.category : $root.proto.SyncActionValue.BizAISettingsNudgeAction.BizAISettingsCategory[m.category] : m.category;
|
|
85949
|
+
if (o.oneofs)
|
|
85950
|
+
d._category = "category";
|
|
85951
|
+
}
|
|
85952
|
+
if (m.version != null && m.hasOwnProperty("version")) {
|
|
85953
|
+
if (typeof m.version === "number")
|
|
85954
|
+
d.version = o.longs === String ? String(m.version) : m.version;
|
|
85955
|
+
else
|
|
85956
|
+
d.version = o.longs === String ? longToString(m.version) : o.longs === Number ? longToNumber(m.version) : m.version;
|
|
85957
|
+
if (o.oneofs)
|
|
85958
|
+
d._version = "version";
|
|
85959
|
+
}
|
|
85960
|
+
if (m.updatedAtMs != null && m.hasOwnProperty("updatedAtMs")) {
|
|
85961
|
+
if (typeof m.updatedAtMs === "number")
|
|
85962
|
+
d.updatedAtMs = o.longs === String ? String(m.updatedAtMs) : m.updatedAtMs;
|
|
85963
|
+
else
|
|
85964
|
+
d.updatedAtMs = o.longs === String ? longToString(m.updatedAtMs) : o.longs === Number ? longToNumber(m.updatedAtMs) : m.updatedAtMs;
|
|
85965
|
+
if (o.oneofs)
|
|
85966
|
+
d._updatedAtMs = "updatedAtMs";
|
|
85967
|
+
}
|
|
85968
|
+
return d;
|
|
85969
|
+
};
|
|
85970
|
+
|
|
85971
|
+
BizAISettingsNudgeAction.prototype.toJSON = function toJSON() {
|
|
85972
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
85973
|
+
};
|
|
85974
|
+
|
|
85975
|
+
BizAISettingsNudgeAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
85976
|
+
if (typeUrlPrefix === undefined) {
|
|
85977
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
85978
|
+
}
|
|
85979
|
+
return typeUrlPrefix + "/proto.SyncActionValue.BizAISettingsNudgeAction";
|
|
85980
|
+
};
|
|
85981
|
+
|
|
85982
|
+
BizAISettingsNudgeAction.BizAISettingsCategory = (function() {
|
|
85983
|
+
const valuesById = {}, values = Object.create(valuesById);
|
|
85984
|
+
values[valuesById[0] = "UNKNOWN"] = 0;
|
|
85985
|
+
values[valuesById[1] = "INSTRUCTIONS"] = 1;
|
|
85986
|
+
values[valuesById[2] = "RESPONSE_SETTINGS"] = 2;
|
|
85987
|
+
values[valuesById[3] = "EXAMPLE_RESPONSES"] = 3;
|
|
85988
|
+
values[valuesById[4] = "KNOWLEDGE"] = 4;
|
|
85989
|
+
values[valuesById[5] = "LEAD_GEN"] = 5;
|
|
85990
|
+
return values;
|
|
85991
|
+
})();
|
|
85992
|
+
|
|
85993
|
+
return BizAISettingsNudgeAction;
|
|
85994
|
+
})();
|
|
85995
|
+
|
|
85676
85996
|
SyncActionValue.BotWelcomeRequestAction = (function() {
|
|
85677
85997
|
|
|
85678
85998
|
function BotWelcomeRequestAction(p) {
|
|
@@ -93685,6 +94005,7 @@ export const proto = $root.proto = (() => {
|
|
|
93685
94005
|
function StatusPrivacyAction(p) {
|
|
93686
94006
|
this.userJid = [];
|
|
93687
94007
|
this.customLists = [];
|
|
94008
|
+
this.modes = [];
|
|
93688
94009
|
if (p)
|
|
93689
94010
|
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
|
93690
94011
|
if (p[ks[i]] != null)
|
|
@@ -93696,6 +94017,7 @@ export const proto = $root.proto = (() => {
|
|
|
93696
94017
|
StatusPrivacyAction.prototype.shareToFB = null;
|
|
93697
94018
|
StatusPrivacyAction.prototype.shareToIG = null;
|
|
93698
94019
|
StatusPrivacyAction.prototype.customLists = $util.emptyArray;
|
|
94020
|
+
StatusPrivacyAction.prototype.modes = $util.emptyArray;
|
|
93699
94021
|
|
|
93700
94022
|
let $oneOfFields;
|
|
93701
94023
|
|
|
@@ -93735,6 +94057,12 @@ export const proto = $root.proto = (() => {
|
|
|
93735
94057
|
for (var i = 0; i < m.customLists.length; ++i)
|
|
93736
94058
|
$root.proto.SyncActionValue.StatusPrivacyAction.CustomList.encode(m.customLists[i], w.uint32(42).fork()).ldelim();
|
|
93737
94059
|
}
|
|
94060
|
+
if (m.modes != null && m.modes.length) {
|
|
94061
|
+
w.uint32(50).fork();
|
|
94062
|
+
for (var i = 0; i < m.modes.length; ++i)
|
|
94063
|
+
w.int32(m.modes[i]);
|
|
94064
|
+
w.ldelim();
|
|
94065
|
+
}
|
|
93738
94066
|
return w;
|
|
93739
94067
|
};
|
|
93740
94068
|
|
|
@@ -93771,6 +94099,17 @@ export const proto = $root.proto = (() => {
|
|
|
93771
94099
|
m.customLists.push($root.proto.SyncActionValue.StatusPrivacyAction.CustomList.decode(r, r.uint32()));
|
|
93772
94100
|
break;
|
|
93773
94101
|
}
|
|
94102
|
+
case 6: {
|
|
94103
|
+
if (!(m.modes && m.modes.length))
|
|
94104
|
+
m.modes = [];
|
|
94105
|
+
if ((t & 7) === 2) {
|
|
94106
|
+
var c2 = r.uint32() + r.pos;
|
|
94107
|
+
while (r.pos < c2)
|
|
94108
|
+
m.modes.push(r.int32());
|
|
94109
|
+
} else
|
|
94110
|
+
m.modes.push(r.int32());
|
|
94111
|
+
break;
|
|
94112
|
+
}
|
|
93774
94113
|
default:
|
|
93775
94114
|
r.skipType(t & 7);
|
|
93776
94115
|
break;
|
|
@@ -93835,6 +94174,40 @@ export const proto = $root.proto = (() => {
|
|
|
93835
94174
|
m.customLists[i] = $root.proto.SyncActionValue.StatusPrivacyAction.CustomList.fromObject(d.customLists[i]);
|
|
93836
94175
|
}
|
|
93837
94176
|
}
|
|
94177
|
+
if (d.modes) {
|
|
94178
|
+
if (!Array.isArray(d.modes))
|
|
94179
|
+
throw TypeError(".proto.SyncActionValue.StatusPrivacyAction.modes: array expected");
|
|
94180
|
+
m.modes = [];
|
|
94181
|
+
for (var i = 0; i < d.modes.length; ++i) {
|
|
94182
|
+
switch (d.modes[i]) {
|
|
94183
|
+
default:
|
|
94184
|
+
if (typeof d.modes[i] === "number") {
|
|
94185
|
+
m.modes[i] = d.modes[i];
|
|
94186
|
+
break;
|
|
94187
|
+
}
|
|
94188
|
+
case "ALLOW_LIST":
|
|
94189
|
+
case 0:
|
|
94190
|
+
m.modes[i] = 0;
|
|
94191
|
+
break;
|
|
94192
|
+
case "DENY_LIST":
|
|
94193
|
+
case 1:
|
|
94194
|
+
m.modes[i] = 1;
|
|
94195
|
+
break;
|
|
94196
|
+
case "CONTACTS":
|
|
94197
|
+
case 2:
|
|
94198
|
+
m.modes[i] = 2;
|
|
94199
|
+
break;
|
|
94200
|
+
case "CLOSE_FRIENDS":
|
|
94201
|
+
case 3:
|
|
94202
|
+
m.modes[i] = 3;
|
|
94203
|
+
break;
|
|
94204
|
+
case "CUSTOM_LIST":
|
|
94205
|
+
case 4:
|
|
94206
|
+
m.modes[i] = 4;
|
|
94207
|
+
break;
|
|
94208
|
+
}
|
|
94209
|
+
}
|
|
94210
|
+
}
|
|
93838
94211
|
return m;
|
|
93839
94212
|
};
|
|
93840
94213
|
|
|
@@ -93845,6 +94218,7 @@ export const proto = $root.proto = (() => {
|
|
|
93845
94218
|
if (o.arrays || o.defaults) {
|
|
93846
94219
|
d.userJid = [];
|
|
93847
94220
|
d.customLists = [];
|
|
94221
|
+
d.modes = [];
|
|
93848
94222
|
}
|
|
93849
94223
|
if (m.mode != null && m.hasOwnProperty("mode")) {
|
|
93850
94224
|
d.mode = o.enums === String ? $root.proto.SyncActionValue.StatusPrivacyAction.StatusDistributionMode[m.mode] === undefined ? m.mode : $root.proto.SyncActionValue.StatusPrivacyAction.StatusDistributionMode[m.mode] : m.mode;
|
|
@@ -93873,6 +94247,12 @@ export const proto = $root.proto = (() => {
|
|
|
93873
94247
|
d.customLists[j] = $root.proto.SyncActionValue.StatusPrivacyAction.CustomList.toObject(m.customLists[j], o);
|
|
93874
94248
|
}
|
|
93875
94249
|
}
|
|
94250
|
+
if (m.modes && m.modes.length) {
|
|
94251
|
+
d.modes = [];
|
|
94252
|
+
for (var j = 0; j < m.modes.length; ++j) {
|
|
94253
|
+
d.modes[j] = o.enums === String ? $root.proto.SyncActionValue.StatusPrivacyAction.StatusDistributionMode[m.modes[j]] === undefined ? m.modes[j] : $root.proto.SyncActionValue.StatusPrivacyAction.StatusDistributionMode[m.modes[j]] : m.modes[j];
|
|
94254
|
+
}
|
|
94255
|
+
}
|
|
93876
94256
|
return d;
|
|
93877
94257
|
};
|
|
93878
94258
|
|
package/lib/Defaults/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { proto } from '../../WAProto/index.js';
|
|
|
2
2
|
import { makeLibSignalRepository } from '../Signal/libsignal.js';
|
|
3
3
|
import { Browsers } from '../Utils/browser-utils.js';
|
|
4
4
|
import logger from '../Utils/logger.js';
|
|
5
|
-
const version = [2, 3000,
|
|
5
|
+
const version = [2, 3000, 1037828507];
|
|
6
6
|
export const UNAUTHORIZED_CODES = [401, 403, 419];
|
|
7
7
|
export const BIZ_BOT_SUPPORT_PAYLOAD = '{"version":1,"is_ai_message":true,"should_upload_client_logs":false,"should_show_system_message":false,"ticket_id":"7004947587700716","citation_items":[],"ticket_locale":"us"}';
|
|
8
8
|
export const DEFAULT_ORIGIN = 'https://web.whatsapp.com';
|
package/lib/Utils/generics.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Boom } from '@hapi/boom';
|
|
2
2
|
import { createHash, randomBytes, randomFillSync } from 'crypto';
|
|
3
3
|
import { proto } from '../../WAProto/index.js';
|
|
4
|
-
const baileysVersion = [2, 3000,
|
|
4
|
+
const baileysVersion = [2, 3000, 1037828507];
|
|
5
5
|
import { DisconnectReason } from '../Types/index.js';
|
|
6
6
|
import { getAllBinaryNodeChildren, jidDecode } from '../WABinary/index.js';
|
|
7
7
|
import { sha256 } from './crypto.js';
|
package/lib/Utils/messages.js
CHANGED
|
@@ -12,6 +12,7 @@ import { generateMessageIDV2, getKeyAuthor, unixTimestampSeconds } from './gener
|
|
|
12
12
|
import { downloadContentFromMessage, encryptedStream, generateThumbnail, getAudioDuration, getAudioWaveform, getImageProcessingLibrary, getRawMediaUploadData, getStream, toBuffer } from './messages-media.js';
|
|
13
13
|
import { prepareRichResponseMessage } from './rich-message-utils.js';
|
|
14
14
|
import { shouldIncludeReportingToken } from './reporting-utils.js';
|
|
15
|
+
const CONCURRENCY_LIMIT = 10;
|
|
15
16
|
const MIMETYPE_MAP = {
|
|
16
17
|
image: 'image/jpeg',
|
|
17
18
|
video: 'video/mp4',
|
|
@@ -244,7 +245,7 @@ export const prepareWAMessageMedia = async (message, options) => {
|
|
|
244
245
|
}
|
|
245
246
|
if (cacheableKey) {
|
|
246
247
|
logger?.debug({ cacheableKey }, 'set cache (background)');
|
|
247
|
-
options.mediaCache.set(cacheableKey, WAProto.Message.encode(obj).finish())
|
|
248
|
+
options.mediaCache.set(cacheableKey, WAProto.Message.encode(obj).finish());
|
|
248
249
|
}
|
|
249
250
|
return obj;
|
|
250
251
|
};
|
|
@@ -288,6 +289,7 @@ const prepareProductMessage = async (message, options) => {
|
|
|
288
289
|
* Credits: Work on ensuring stickerPackMessage fields are valid by @jlucaso1 (https://github.com/jlucaso1).
|
|
289
290
|
* based on https://github.com/WhiskeySockets/Baileys/pull/1561
|
|
290
291
|
*/
|
|
292
|
+
// Lia@Changes 21-04-26 --- Enhanced prepareStickerPackMessage
|
|
291
293
|
const prepareStickerPackMessage = async (message, options) => {
|
|
292
294
|
const { cover, stickers = [], name = '๐ฆ Sticker Pack', publisher = 'GitHub: itsliaaa', description = '๐ท๏ธ itsliaaa/baileys' } = message;
|
|
293
295
|
if (stickers.length > 60) {
|
|
@@ -299,136 +301,124 @@ const prepareStickerPackMessage = async (message, options) => {
|
|
|
299
301
|
if (!cover) {
|
|
300
302
|
throw new Boom('Sticker pack must contain a cover', { statusCode: 400 });
|
|
301
303
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
304
|
+
const logger = options.logger;
|
|
305
|
+
// Lia@Changes 01-02-26 --- Add caching for sticker pack
|
|
306
|
+
let cacheableKey = false;
|
|
307
|
+
if (Array.isArray(stickers) && stickers.length && options.mediaCache) {
|
|
308
|
+
const urls = [];
|
|
309
|
+
for (let i = 0; i < stickers.length; i++) {
|
|
310
|
+
const data = stickers[i].data;
|
|
311
|
+
if (typeof data === 'object' && data?.url) {
|
|
312
|
+
urls.push(data.url);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (urls.length > 0) {
|
|
316
|
+
cacheableKey = 'sticker:' + urls.join('@');
|
|
317
|
+
}
|
|
318
|
+
}
|
|
316
319
|
if (cacheableKey) {
|
|
317
320
|
const mediaBuff = await options.mediaCache.get(cacheableKey);
|
|
318
321
|
if (mediaBuff) {
|
|
319
|
-
|
|
322
|
+
logger?.debug({ cacheableKey }, 'got media cache hit');
|
|
320
323
|
return proto.Message.StickerPackMessage.decode(mediaBuff);
|
|
321
324
|
}
|
|
322
325
|
}
|
|
323
326
|
const lib = await getImageProcessingLibrary();
|
|
327
|
+
const hasSharp = 'sharp' in lib && !!lib.sharp?.default;
|
|
328
|
+
const hasImage = 'image' in lib && !!lib.image?.Transformer;
|
|
329
|
+
const hasJimp = 'jimp' in lib && !!lib.jimp?.Jimp;
|
|
330
|
+
if (!hasSharp && !hasImage) {
|
|
331
|
+
throw new Boom('No image processing library (sharp or @napi-rs/image) available for converting sticker to WebP.');
|
|
332
|
+
}
|
|
324
333
|
const stickerPackIdValue = generateMessageIDV2();
|
|
325
334
|
const stickerData = {};
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
const
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
.
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
335
|
+
const stickerMetadata = new Array(stickers.length);
|
|
336
|
+
for (let i = 0; i < stickers.length; i += CONCURRENCY_LIMIT) {
|
|
337
|
+
const promises = [];
|
|
338
|
+
const chunkEnd = Math.min(i + CONCURRENCY_LIMIT, stickers.length);
|
|
339
|
+
for (let j = i; j < chunkEnd; j++) {
|
|
340
|
+
promises.push((async (index) => {
|
|
341
|
+
const sticker = stickers[index];
|
|
342
|
+
const { stream } = await getStream(sticker.data);
|
|
343
|
+
const buffer = await toBuffer(stream);
|
|
344
|
+
let webpBuffer;
|
|
345
|
+
let isAnimated = false;
|
|
346
|
+
if (isWebPBuffer(buffer)) {
|
|
347
|
+
webpBuffer = buffer;
|
|
348
|
+
isAnimated = isAnimatedWebP(buffer);
|
|
349
|
+
}
|
|
350
|
+
else if (hasSharp) {
|
|
351
|
+
webpBuffer = await lib.sharp.default(buffer)
|
|
352
|
+
.resize(512, 512, { fit: 'inside' })
|
|
353
|
+
.webp({ quality: 80 })
|
|
354
|
+
.toBuffer();
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
webpBuffer = await new lib.image.Transformer(buffer)
|
|
358
|
+
.resize(512, 512)
|
|
359
|
+
.webp(80);
|
|
360
|
+
}
|
|
361
|
+
if (webpBuffer.length > 1024 * 1024) {
|
|
362
|
+
throw new Boom(`Sticker at index ${index} exceeds the 1MB size limit`, { statusCode: 400 });
|
|
363
|
+
}
|
|
364
|
+
const hash = sha256(webpBuffer).toString('base64').replace(/\//g, '-');
|
|
365
|
+
const fileName = `${hash}.webp`;
|
|
366
|
+
stickerData[fileName] = [new Uint8Array(webpBuffer), { level: 0 }];
|
|
367
|
+
stickerMetadata[index] = {
|
|
368
|
+
fileName,
|
|
369
|
+
mimetype: 'image/webp',
|
|
370
|
+
isAnimated,
|
|
371
|
+
emojis: sticker.emojis || ['โจ'],
|
|
372
|
+
accessibilityLabel: sticker.accessibilityLabel || 'โ'
|
|
373
|
+
};
|
|
374
|
+
})(j));
|
|
356
375
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
if (webpBuffer.length > 1024 * 1024) {
|
|
361
|
-
throw new Boom(`Sticker at index ${i} exceeds the 1MB size limit`, { statusCode: 400 });
|
|
362
|
-
}
|
|
363
|
-
const hash = sha256(webpBuffer).toString('base64').replace(/\//g, '-');
|
|
364
|
-
const fileName = hash + '.webp';
|
|
365
|
-
stickerData[fileName] = [new Uint8Array(webpBuffer), { level: 0 }];
|
|
366
|
-
return {
|
|
367
|
-
fileName,
|
|
368
|
-
mimetype: 'image/webp',
|
|
369
|
-
isAnimated,
|
|
370
|
-
emojis: sticker.emojis || ['โจ'],
|
|
371
|
-
accessibilityLabel: sticker.accessibilityLabel || 'โ'
|
|
372
|
-
};
|
|
373
|
-
});
|
|
374
|
-
const stickerMetadata = await Promise.all(stickerPromises);
|
|
375
|
-
// Process and add cover/tray icon to the ZIP
|
|
376
|
-
const trayIconFileName = stickerPackIdValue + '.webp';
|
|
376
|
+
await Promise.all(promises);
|
|
377
|
+
}
|
|
378
|
+
const trayIconFileName = `${stickerPackIdValue}.webp`;
|
|
377
379
|
const { stream: coverStream } = await getStream(cover);
|
|
378
380
|
const coverBuffer = await toBuffer(coverStream);
|
|
379
381
|
let coverWebpBuffer;
|
|
380
|
-
|
|
381
|
-
if (isCoverWebP) {
|
|
382
|
-
// Already WebP - preserve original to keep exif metadata
|
|
382
|
+
if (isWebPBuffer(coverBuffer)) {
|
|
383
383
|
coverWebpBuffer = coverBuffer;
|
|
384
384
|
}
|
|
385
|
-
else if (
|
|
386
|
-
coverWebpBuffer = await lib
|
|
387
|
-
.sharp
|
|
388
|
-
.default(coverBuffer)
|
|
385
|
+
else if (hasSharp) {
|
|
386
|
+
coverWebpBuffer = await lib.sharp.default(coverBuffer)
|
|
389
387
|
.resize(512, 512, { fit: 'inside' })
|
|
390
388
|
.webp({ quality: 80 })
|
|
391
389
|
.toBuffer();
|
|
392
390
|
}
|
|
393
|
-
else
|
|
394
|
-
coverWebpBuffer = await new lib
|
|
395
|
-
.image
|
|
396
|
-
.Transformer(coverBuffer)
|
|
391
|
+
else {
|
|
392
|
+
coverWebpBuffer = await new lib.image.Transformer(coverBuffer)
|
|
397
393
|
.resize(512, 512)
|
|
398
394
|
.webp(80);
|
|
399
395
|
}
|
|
400
|
-
else {
|
|
401
|
-
throw new Boom('No image processing library (sharp or @napi-rs/image) available for converting cover to WebP. Either install sharp or @napi-rs/image or provide cover in WebP format.');
|
|
402
|
-
}
|
|
403
|
-
// Add cover to ZIP data
|
|
404
396
|
stickerData[trayIconFileName] = [new Uint8Array(coverWebpBuffer), { level: 0 }];
|
|
405
397
|
const zipBuffer = await new Promise((resolve, reject) => {
|
|
406
|
-
zip(stickerData, (error, data) =>
|
|
407
|
-
if (error) {
|
|
408
|
-
reject(error);
|
|
409
|
-
} else {
|
|
410
|
-
resolve(Buffer.from(data));
|
|
411
|
-
}
|
|
412
|
-
});
|
|
398
|
+
zip(stickerData, (error, data) => error ? reject(error) : resolve(Buffer.from(data)));
|
|
413
399
|
});
|
|
414
|
-
const stickerPackSize = zipBuffer.length;
|
|
415
400
|
const stickerPackUpload = await encryptedStream(zipBuffer, 'sticker-pack', {
|
|
416
|
-
logger
|
|
401
|
+
logger,
|
|
417
402
|
opts: options.options
|
|
418
403
|
});
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
404
|
+
let stickerPackUploadResult;
|
|
405
|
+
try {
|
|
406
|
+
stickerPackUploadResult = await options.upload(stickerPackUpload.encFilePath, {
|
|
407
|
+
fileEncSha256B64: stickerPackUpload.fileEncSha256.toString('base64'),
|
|
408
|
+
mediaType: 'sticker-pack',
|
|
409
|
+
timeoutMs: options.mediaUploadTimeoutMs
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
finally {
|
|
413
|
+
fs.unlink(stickerPackUpload.encFilePath).catch(() => logger?.warn('failed to remove tmp file'));
|
|
414
|
+
}
|
|
425
415
|
const obj = {
|
|
426
|
-
name
|
|
427
|
-
publisher
|
|
416
|
+
name,
|
|
417
|
+
publisher,
|
|
428
418
|
stickerPackId: stickerPackIdValue,
|
|
429
419
|
packDescription: description,
|
|
430
420
|
stickerPackOrigin: proto.Message.StickerPackMessage.StickerPackOrigin.USER_CREATED,
|
|
431
|
-
stickerPackSize:
|
|
421
|
+
stickerPackSize: zipBuffer.length,
|
|
432
422
|
stickers: stickerMetadata,
|
|
433
423
|
fileSha256: stickerPackUpload.fileSha256,
|
|
434
424
|
fileEncSha256: stickerPackUpload.fileEncSha256,
|
|
@@ -436,31 +426,19 @@ const prepareStickerPackMessage = async (message, options) => {
|
|
|
436
426
|
directPath: stickerPackUploadResult.directPath,
|
|
437
427
|
fileLength: stickerPackUpload.fileLength,
|
|
438
428
|
mediaKeyTimestamp: unixTimestampSeconds(),
|
|
439
|
-
trayIconFileName
|
|
429
|
+
trayIconFileName
|
|
440
430
|
};
|
|
441
431
|
try {
|
|
442
|
-
// Reuse the cover buffer we already processed for thumbnail generation
|
|
443
432
|
let thumbnailBuffer;
|
|
444
|
-
if (
|
|
445
|
-
thumbnailBuffer = await lib
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
}
|
|
452
|
-
if ('image' in lib && lib.image?.Transformer) {
|
|
453
|
-
thumbnailBuffer = await new lib
|
|
454
|
-
.image
|
|
455
|
-
.Transformer(coverBuffer)
|
|
456
|
-
.resize(252, 252)
|
|
457
|
-
.jpeg();
|
|
458
|
-
}
|
|
459
|
-
else if ('jimp' in lib && lib.jimp?.Jimp) {
|
|
433
|
+
if (hasSharp) {
|
|
434
|
+
thumbnailBuffer = await lib.sharp.default(coverBuffer).resize(252, 252).jpeg().toBuffer();
|
|
435
|
+
}
|
|
436
|
+
else if (hasImage) {
|
|
437
|
+
thumbnailBuffer = await new lib.image.Transformer(coverBuffer).resize(252, 252).jpeg();
|
|
438
|
+
}
|
|
439
|
+
else if (hasJimp) {
|
|
460
440
|
const jimpImage = await lib.jimp.Jimp.read(coverBuffer);
|
|
461
|
-
thumbnailBuffer = await jimpImage
|
|
462
|
-
.resize({ w: 252, h: 252 })
|
|
463
|
-
.getBuffer('image/jpeg');
|
|
441
|
+
thumbnailBuffer = await jimpImage.resize({ w: 252, h: 252 }).getBuffer('image/jpeg');
|
|
464
442
|
}
|
|
465
443
|
else {
|
|
466
444
|
throw new Error('No image processing library available for thumbnail generation');
|
|
@@ -469,16 +447,21 @@ const prepareStickerPackMessage = async (message, options) => {
|
|
|
469
447
|
throw new Error('Failed to generate thumbnail buffer');
|
|
470
448
|
}
|
|
471
449
|
const thumbUpload = await encryptedStream(thumbnailBuffer, 'thumbnail-sticker-pack', {
|
|
472
|
-
logger
|
|
450
|
+
logger,
|
|
473
451
|
opts: options.options,
|
|
474
|
-
mediaKey: stickerPackUpload.mediaKey
|
|
475
|
-
});
|
|
476
|
-
const thumbUploadResult = await options.upload(thumbUpload.encFilePath, {
|
|
477
|
-
fileEncSha256B64: thumbUpload.fileEncSha256.toString('base64'),
|
|
478
|
-
mediaType: 'thumbnail-sticker-pack',
|
|
479
|
-
timeoutMs: options.mediaUploadTimeoutMs
|
|
452
|
+
mediaKey: stickerPackUpload.mediaKey
|
|
480
453
|
});
|
|
481
|
-
|
|
454
|
+
let thumbUploadResult;
|
|
455
|
+
try {
|
|
456
|
+
thumbUploadResult = await options.upload(thumbUpload.encFilePath, {
|
|
457
|
+
fileEncSha256B64: thumbUpload.fileEncSha256.toString('base64'),
|
|
458
|
+
mediaType: 'thumbnail-sticker-pack',
|
|
459
|
+
timeoutMs: options.mediaUploadTimeoutMs
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
finally {
|
|
463
|
+
fs.unlink(thumbUpload.encFilePath).catch(() => logger?.warn('failed to remove tmp file'));
|
|
464
|
+
}
|
|
482
465
|
Object.assign(obj, {
|
|
483
466
|
thumbnailDirectPath: thumbUploadResult.directPath,
|
|
484
467
|
thumbnailSha256: thumbUpload.fileSha256,
|
|
@@ -489,14 +472,13 @@ const prepareStickerPackMessage = async (message, options) => {
|
|
|
489
472
|
});
|
|
490
473
|
}
|
|
491
474
|
catch (error) {
|
|
492
|
-
|
|
475
|
+
logger?.warn(`Thumbnail generation failed: ${error}`);
|
|
493
476
|
}
|
|
494
|
-
const content = obj;
|
|
495
477
|
if (cacheableKey) {
|
|
496
|
-
|
|
497
|
-
options.mediaCache.set(cacheableKey, WAProto.Message.StickerPackMessage.encode(
|
|
478
|
+
logger?.debug({ cacheableKey }, 'set cache (background)');
|
|
479
|
+
options.mediaCache.set(cacheableKey, WAProto.Message.StickerPackMessage.encode(obj).finish());
|
|
498
480
|
}
|
|
499
|
-
return WAProto.Message.StickerPackMessage.fromObject(
|
|
481
|
+
return WAProto.Message.StickerPackMessage.fromObject(obj);
|
|
500
482
|
};
|
|
501
483
|
// Lia@Changes 30-01-26 --- Add native flow button helper for interactive message
|
|
502
484
|
const prepareNativeFlowButtons = (message) => {
|
|
@@ -3,27 +3,38 @@ import { DEFAULT_CACHE_TTLS } from '../Defaults/index.js';
|
|
|
3
3
|
import { proto } from '../../WAProto/index.js';
|
|
4
4
|
import { initAuthCreds } from './auth-utils.js';
|
|
5
5
|
import { BufferJSON } from './generics.js';
|
|
6
|
+
import { LRUCache } from 'lru-cache';
|
|
6
7
|
// Lia@Changes 25-03-26 --- Add useSingleFileAuthState with integrated cache
|
|
7
8
|
const FLUSH_TIMEOUT_MS = 3000;
|
|
8
|
-
// Lia@
|
|
9
|
+
// Lia@Changes 22-04-26 --- Enhanced useSingleFileAuthState with LRUCache
|
|
9
10
|
export const useSingleFileAuthState = async (fileName) => {
|
|
10
|
-
const cache = new
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const cache = new LRUCache({
|
|
12
|
+
max: 10000,
|
|
13
|
+
ttl: 1000 * DEFAULT_CACHE_TTLS.SIGNAL_STORE,
|
|
14
|
+
updateAgeOnGet: false,
|
|
15
|
+
updateAgeOnHas: false,
|
|
16
|
+
ttlAutopurge: true
|
|
17
|
+
});
|
|
18
|
+
let fileData = {},
|
|
19
|
+
isLoaded = false,
|
|
20
|
+
isWriting = false,
|
|
21
|
+
isNeedWrite = false,
|
|
22
|
+
flushTimeout = null,
|
|
23
|
+
loadPromise = null;
|
|
16
24
|
const loadKey = () => {
|
|
17
25
|
if (isLoaded) return;
|
|
18
26
|
if (loadPromise) return loadPromise;
|
|
19
27
|
loadPromise = (async () => {
|
|
20
28
|
try {
|
|
21
29
|
const data = JSON.parse(await readFile(fileName, 'utf-8'), BufferJSON.reviver);
|
|
22
|
-
|
|
30
|
+
fileData = data || {};
|
|
31
|
+
for (const [keyName, value] of Object.entries(fileData)) {
|
|
23
32
|
cache.set(keyName, value);
|
|
24
33
|
}
|
|
25
34
|
}
|
|
26
|
-
catch {
|
|
35
|
+
catch {
|
|
36
|
+
fileData = {};
|
|
37
|
+
}
|
|
27
38
|
isLoaded = true;
|
|
28
39
|
loadPromise = null;
|
|
29
40
|
})();
|
|
@@ -41,20 +52,20 @@ export const useSingleFileAuthState = async (fileName) => {
|
|
|
41
52
|
do {
|
|
42
53
|
isNeedWrite = false;
|
|
43
54
|
const tempFile = fileName + '.temp';
|
|
44
|
-
|
|
45
|
-
await writeFile(tempFile, JSON.stringify(value, BufferJSON.replacer));
|
|
55
|
+
await writeFile(tempFile, JSON.stringify(fileData, BufferJSON.replacer));
|
|
46
56
|
await rename(tempFile, fileName);
|
|
47
|
-
}
|
|
48
|
-
while (isNeedWrite);
|
|
57
|
+
} while (isNeedWrite);
|
|
49
58
|
isWriting = false;
|
|
50
59
|
}, FLUSH_TIMEOUT_MS);
|
|
51
60
|
};
|
|
52
61
|
const writeKey = (keyName, value) => {
|
|
53
62
|
cache.set(keyName, value);
|
|
63
|
+
fileData[keyName] = value;
|
|
54
64
|
flushKey();
|
|
55
65
|
};
|
|
56
66
|
const removeKey = (keyName) => {
|
|
57
67
|
cache.delete(keyName);
|
|
68
|
+
delete fileData[keyName];
|
|
58
69
|
flushKey();
|
|
59
70
|
};
|
|
60
71
|
const fileInfo = await stat(fileName).catch(() => null);
|
|
@@ -65,7 +76,7 @@ export const useSingleFileAuthState = async (fileName) => {
|
|
|
65
76
|
throw new Error(`found something that is not a file at ${fileName}, either delete it or specify a different location`);
|
|
66
77
|
}
|
|
67
78
|
await loadKey();
|
|
68
|
-
const creds =
|
|
79
|
+
const creds = fileData['creds'] || initAuthCreds();
|
|
69
80
|
return {
|
|
70
81
|
state: {
|
|
71
82
|
creds,
|
|
@@ -73,7 +84,12 @@ export const useSingleFileAuthState = async (fileName) => {
|
|
|
73
84
|
get: (type, ids) => {
|
|
74
85
|
const data = {};
|
|
75
86
|
for (const id of ids) {
|
|
76
|
-
|
|
87
|
+
const keyName = type + id;
|
|
88
|
+
let value = cache.get(keyName);
|
|
89
|
+
if (value === undefined && fileData[keyName] !== undefined) {
|
|
90
|
+
value = fileData[keyName];
|
|
91
|
+
cache.set(keyName, value);
|
|
92
|
+
}
|
|
77
93
|
if (type === 'app-state-sync-key' && value) {
|
|
78
94
|
value = proto.Message.AppStateSyncKeyData.fromObject(value);
|
|
79
95
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itsliaaa/baileys",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
4
4
|
"description": "Enhanced Baileys v7 with fixed newsletter media upload, plus support for interactive messages, albums, and more message types.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|