@itsliaaa/baileys 0.1.11 → 0.1.13

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/WAProto/index.js CHANGED
@@ -17544,32 +17544,10 @@ export const proto = $root.proto = (() => {
17544
17544
  this[ks[i]] = p[ks[i]];
17545
17545
  }
17546
17546
 
17547
- Citation.prototype.title = null;
17548
- Citation.prototype.subtitle = null;
17549
- Citation.prototype.cmsId = null;
17550
- Citation.prototype.imageUrl = null;
17551
-
17552
- let $oneOfFields;
17553
-
17554
- Object.defineProperty(Citation.prototype, "_title", {
17555
- get: $util.oneOfGetter($oneOfFields = ["title"]),
17556
- set: $util.oneOfSetter($oneOfFields)
17557
- });
17558
-
17559
- Object.defineProperty(Citation.prototype, "_subtitle", {
17560
- get: $util.oneOfGetter($oneOfFields = ["subtitle"]),
17561
- set: $util.oneOfSetter($oneOfFields)
17562
- });
17563
-
17564
- Object.defineProperty(Citation.prototype, "_cmsId", {
17565
- get: $util.oneOfGetter($oneOfFields = ["cmsId"]),
17566
- set: $util.oneOfSetter($oneOfFields)
17567
- });
17568
-
17569
- Object.defineProperty(Citation.prototype, "_imageUrl", {
17570
- get: $util.oneOfGetter($oneOfFields = ["imageUrl"]),
17571
- set: $util.oneOfSetter($oneOfFields)
17572
- });
17547
+ Citation.prototype.title = "";
17548
+ Citation.prototype.subtitle = "";
17549
+ Citation.prototype.cmsId = "";
17550
+ Citation.prototype.imageUrl = "";
17573
17551
 
17574
17552
  Citation.create = function create(properties) {
17575
17553
  return new Citation(properties);
@@ -17645,25 +17623,23 @@ export const proto = $root.proto = (() => {
17645
17623
  if (!o)
17646
17624
  o = {};
17647
17625
  var d = {};
17626
+ if (o.defaults) {
17627
+ d.title = "";
17628
+ d.subtitle = "";
17629
+ d.cmsId = "";
17630
+ d.imageUrl = "";
17631
+ }
17648
17632
  if (m.title != null && m.hasOwnProperty("title")) {
17649
17633
  d.title = m.title;
17650
- if (o.oneofs)
17651
- d._title = "title";
17652
17634
  }
17653
17635
  if (m.subtitle != null && m.hasOwnProperty("subtitle")) {
17654
17636
  d.subtitle = m.subtitle;
17655
- if (o.oneofs)
17656
- d._subtitle = "subtitle";
17657
17637
  }
17658
17638
  if (m.cmsId != null && m.hasOwnProperty("cmsId")) {
17659
17639
  d.cmsId = m.cmsId;
17660
- if (o.oneofs)
17661
- d._cmsId = "cmsId";
17662
17640
  }
17663
17641
  if (m.imageUrl != null && m.hasOwnProperty("imageUrl")) {
17664
17642
  d.imageUrl = m.imageUrl;
17665
- if (o.oneofs)
17666
- d._imageUrl = "imageUrl";
17667
17643
  }
17668
17644
  return d;
17669
17645
  };
@@ -26071,10 +26047,6 @@ export const proto = $root.proto = (() => {
26071
26047
  case 3:
26072
26048
  m.limitSharingTrigger = 3;
26073
26049
  break;
26074
- case "DEPRECATION":
26075
- case 4:
26076
- m.limitSharingTrigger = 4;
26077
- break;
26078
26050
  }
26079
26051
  if (d.limitSharingInitiatedByMe != null) {
26080
26052
  m.limitSharingInitiatedByMe = Boolean(d.limitSharingInitiatedByMe);
@@ -35927,10 +35899,6 @@ export const proto = $root.proto = (() => {
35927
35899
  case 3:
35928
35900
  m.trigger = 3;
35929
35901
  break;
35930
- case "DEPRECATION":
35931
- case 4:
35932
- m.trigger = 4;
35933
- break;
35934
35902
  }
35935
35903
  if (d.limitSharingSettingTimestamp != null) {
35936
35904
  if ($util.Long)
@@ -35995,7 +35963,6 @@ export const proto = $root.proto = (() => {
35995
35963
  values[valuesById[1] = "CHAT_SETTING"] = 1;
35996
35964
  values[valuesById[2] = "BIZ_SUPPORTS_FB_HOSTING"] = 2;
35997
35965
  values[valuesById[3] = "UNKNOWN_GROUP"] = 3;
35998
- values[valuesById[4] = "DEPRECATION"] = 4;
35999
35966
  return values;
36000
35967
  })();
36001
35968
 
@@ -68136,32 +68103,10 @@ export const proto = $root.proto = (() => {
68136
68103
  this[ks[i]] = p[ks[i]];
68137
68104
  }
68138
68105
 
68139
- VideoEndCard.prototype.username = null;
68140
- VideoEndCard.prototype.caption = null;
68141
- VideoEndCard.prototype.thumbnailImageUrl = null;
68142
- VideoEndCard.prototype.profilePictureUrl = null;
68143
-
68144
- let $oneOfFields;
68145
-
68146
- Object.defineProperty(VideoEndCard.prototype, "_username", {
68147
- get: $util.oneOfGetter($oneOfFields = ["username"]),
68148
- set: $util.oneOfSetter($oneOfFields)
68149
- });
68150
-
68151
- Object.defineProperty(VideoEndCard.prototype, "_caption", {
68152
- get: $util.oneOfGetter($oneOfFields = ["caption"]),
68153
- set: $util.oneOfSetter($oneOfFields)
68154
- });
68155
-
68156
- Object.defineProperty(VideoEndCard.prototype, "_thumbnailImageUrl", {
68157
- get: $util.oneOfGetter($oneOfFields = ["thumbnailImageUrl"]),
68158
- set: $util.oneOfSetter($oneOfFields)
68159
- });
68160
-
68161
- Object.defineProperty(VideoEndCard.prototype, "_profilePictureUrl", {
68162
- get: $util.oneOfGetter($oneOfFields = ["profilePictureUrl"]),
68163
- set: $util.oneOfSetter($oneOfFields)
68164
- });
68106
+ VideoEndCard.prototype.username = "";
68107
+ VideoEndCard.prototype.caption = "";
68108
+ VideoEndCard.prototype.thumbnailImageUrl = "";
68109
+ VideoEndCard.prototype.profilePictureUrl = "";
68165
68110
 
68166
68111
  VideoEndCard.create = function create(properties) {
68167
68112
  return new VideoEndCard(properties);
@@ -68237,25 +68182,23 @@ export const proto = $root.proto = (() => {
68237
68182
  if (!o)
68238
68183
  o = {};
68239
68184
  var d = {};
68185
+ if (o.defaults) {
68186
+ d.username = "";
68187
+ d.caption = "";
68188
+ d.thumbnailImageUrl = "";
68189
+ d.profilePictureUrl = "";
68190
+ }
68240
68191
  if (m.username != null && m.hasOwnProperty("username")) {
68241
68192
  d.username = m.username;
68242
- if (o.oneofs)
68243
- d._username = "username";
68244
68193
  }
68245
68194
  if (m.caption != null && m.hasOwnProperty("caption")) {
68246
68195
  d.caption = m.caption;
68247
- if (o.oneofs)
68248
- d._caption = "caption";
68249
68196
  }
68250
68197
  if (m.thumbnailImageUrl != null && m.hasOwnProperty("thumbnailImageUrl")) {
68251
68198
  d.thumbnailImageUrl = m.thumbnailImageUrl;
68252
- if (o.oneofs)
68253
- d._thumbnailImageUrl = "thumbnailImageUrl";
68254
68199
  }
68255
68200
  if (m.profilePictureUrl != null && m.hasOwnProperty("profilePictureUrl")) {
68256
68201
  d.profilePictureUrl = m.profilePictureUrl;
68257
- if (o.oneofs)
68258
- d._profilePictureUrl = "profilePictureUrl";
68259
68202
  }
68260
68203
  return d;
68261
68204
  };
@@ -85456,6 +85399,7 @@ export const proto = $root.proto = (() => {
85456
85399
  BusinessBroadcastListAction.prototype.participants = $util.emptyArray;
85457
85400
  BusinessBroadcastListAction.prototype.listName = null;
85458
85401
  BusinessBroadcastListAction.prototype.labelIds = $util.emptyArray;
85402
+ BusinessBroadcastListAction.prototype.audienceExpression = null;
85459
85403
 
85460
85404
  let $oneOfFields;
85461
85405
 
@@ -85469,6 +85413,11 @@ export const proto = $root.proto = (() => {
85469
85413
  set: $util.oneOfSetter($oneOfFields)
85470
85414
  });
85471
85415
 
85416
+ Object.defineProperty(BusinessBroadcastListAction.prototype, "_audienceExpression", {
85417
+ get: $util.oneOfGetter($oneOfFields = ["audienceExpression"]),
85418
+ set: $util.oneOfSetter($oneOfFields)
85419
+ });
85420
+
85472
85421
  BusinessBroadcastListAction.create = function create(properties) {
85473
85422
  return new BusinessBroadcastListAction(properties);
85474
85423
  };
@@ -85488,6 +85437,8 @@ export const proto = $root.proto = (() => {
85488
85437
  for (var i = 0; i < m.labelIds.length; ++i)
85489
85438
  w.uint32(34).string(m.labelIds[i]);
85490
85439
  }
85440
+ if (m.audienceExpression != null && Object.hasOwnProperty.call(m, "audienceExpression"))
85441
+ w.uint32(42).string(m.audienceExpression);
85491
85442
  return w;
85492
85443
  };
85493
85444
 
@@ -85520,6 +85471,10 @@ export const proto = $root.proto = (() => {
85520
85471
  m.labelIds.push(r.string());
85521
85472
  break;
85522
85473
  }
85474
+ case 5: {
85475
+ m.audienceExpression = r.string();
85476
+ break;
85477
+ }
85523
85478
  default:
85524
85479
  r.skipType(t & 7);
85525
85480
  break;
@@ -85556,6 +85511,9 @@ export const proto = $root.proto = (() => {
85556
85511
  m.labelIds[i] = String(d.labelIds[i]);
85557
85512
  }
85558
85513
  }
85514
+ if (d.audienceExpression != null) {
85515
+ m.audienceExpression = String(d.audienceExpression);
85516
+ }
85559
85517
  return m;
85560
85518
  };
85561
85519
 
@@ -85589,6 +85547,11 @@ export const proto = $root.proto = (() => {
85589
85547
  d.labelIds[j] = m.labelIds[j];
85590
85548
  }
85591
85549
  }
85550
+ if (m.audienceExpression != null && m.hasOwnProperty("audienceExpression")) {
85551
+ d.audienceExpression = m.audienceExpression;
85552
+ if (o.oneofs)
85553
+ d._audienceExpression = "audienceExpression";
85554
+ }
85592
85555
  return d;
85593
85556
  };
85594
85557
 
@@ -86242,28 +86205,11 @@ export const proto = $root.proto = (() => {
86242
86205
  this[ks[i]] = p[ks[i]];
86243
86206
  }
86244
86207
 
86245
- CustomPaymentMethod.prototype.credentialId = null;
86246
- CustomPaymentMethod.prototype.country = null;
86247
- CustomPaymentMethod.prototype.type = null;
86208
+ CustomPaymentMethod.prototype.credentialId = "";
86209
+ CustomPaymentMethod.prototype.country = "";
86210
+ CustomPaymentMethod.prototype.type = "";
86248
86211
  CustomPaymentMethod.prototype.metadata = $util.emptyArray;
86249
86212
 
86250
- let $oneOfFields;
86251
-
86252
- Object.defineProperty(CustomPaymentMethod.prototype, "_credentialId", {
86253
- get: $util.oneOfGetter($oneOfFields = ["credentialId"]),
86254
- set: $util.oneOfSetter($oneOfFields)
86255
- });
86256
-
86257
- Object.defineProperty(CustomPaymentMethod.prototype, "_country", {
86258
- get: $util.oneOfGetter($oneOfFields = ["country"]),
86259
- set: $util.oneOfSetter($oneOfFields)
86260
- });
86261
-
86262
- Object.defineProperty(CustomPaymentMethod.prototype, "_type", {
86263
- get: $util.oneOfGetter($oneOfFields = ["type"]),
86264
- set: $util.oneOfSetter($oneOfFields)
86265
- });
86266
-
86267
86213
  CustomPaymentMethod.create = function create(properties) {
86268
86214
  return new CustomPaymentMethod(properties);
86269
86215
  };
@@ -86352,20 +86298,19 @@ export const proto = $root.proto = (() => {
86352
86298
  if (o.arrays || o.defaults) {
86353
86299
  d.metadata = [];
86354
86300
  }
86301
+ if (o.defaults) {
86302
+ d.credentialId = "";
86303
+ d.country = "";
86304
+ d.type = "";
86305
+ }
86355
86306
  if (m.credentialId != null && m.hasOwnProperty("credentialId")) {
86356
86307
  d.credentialId = m.credentialId;
86357
- if (o.oneofs)
86358
- d._credentialId = "credentialId";
86359
86308
  }
86360
86309
  if (m.country != null && m.hasOwnProperty("country")) {
86361
86310
  d.country = m.country;
86362
- if (o.oneofs)
86363
- d._country = "country";
86364
86311
  }
86365
86312
  if (m.type != null && m.hasOwnProperty("type")) {
86366
86313
  d.type = m.type;
86367
- if (o.oneofs)
86368
- d._type = "type";
86369
86314
  }
86370
86315
  if (m.metadata && m.metadata.length) {
86371
86316
  d.metadata = [];
@@ -86399,20 +86344,8 @@ export const proto = $root.proto = (() => {
86399
86344
  this[ks[i]] = p[ks[i]];
86400
86345
  }
86401
86346
 
86402
- CustomPaymentMethodMetadata.prototype.key = null;
86403
- CustomPaymentMethodMetadata.prototype.value = null;
86404
-
86405
- let $oneOfFields;
86406
-
86407
- Object.defineProperty(CustomPaymentMethodMetadata.prototype, "_key", {
86408
- get: $util.oneOfGetter($oneOfFields = ["key"]),
86409
- set: $util.oneOfSetter($oneOfFields)
86410
- });
86411
-
86412
- Object.defineProperty(CustomPaymentMethodMetadata.prototype, "_value", {
86413
- get: $util.oneOfGetter($oneOfFields = ["value"]),
86414
- set: $util.oneOfSetter($oneOfFields)
86415
- });
86347
+ CustomPaymentMethodMetadata.prototype.key = "";
86348
+ CustomPaymentMethodMetadata.prototype.value = "";
86416
86349
 
86417
86350
  CustomPaymentMethodMetadata.create = function create(properties) {
86418
86351
  return new CustomPaymentMethodMetadata(properties);
@@ -86470,15 +86403,15 @@ export const proto = $root.proto = (() => {
86470
86403
  if (!o)
86471
86404
  o = {};
86472
86405
  var d = {};
86406
+ if (o.defaults) {
86407
+ d.key = "";
86408
+ d.value = "";
86409
+ }
86473
86410
  if (m.key != null && m.hasOwnProperty("key")) {
86474
86411
  d.key = m.key;
86475
- if (o.oneofs)
86476
- d._key = "key";
86477
86412
  }
86478
86413
  if (m.value != null && m.hasOwnProperty("value")) {
86479
86414
  d.value = m.value;
86480
- if (o.oneofs)
86481
- d._value = "value";
86482
86415
  }
86483
86416
  return d;
86484
86417
  };
@@ -87599,16 +87532,11 @@ export const proto = $root.proto = (() => {
87599
87532
  this[ks[i]] = p[ks[i]];
87600
87533
  }
87601
87534
 
87602
- InteractiveMessageAction.prototype.type = null;
87535
+ InteractiveMessageAction.prototype.type = 1;
87603
87536
  InteractiveMessageAction.prototype.agmId = null;
87604
87537
 
87605
87538
  let $oneOfFields;
87606
87539
 
87607
- Object.defineProperty(InteractiveMessageAction.prototype, "_type", {
87608
- get: $util.oneOfGetter($oneOfFields = ["type"]),
87609
- set: $util.oneOfSetter($oneOfFields)
87610
- });
87611
-
87612
87540
  Object.defineProperty(InteractiveMessageAction.prototype, "_agmId", {
87613
87541
  get: $util.oneOfGetter($oneOfFields = ["agmId"]),
87614
87542
  set: $util.oneOfSetter($oneOfFields)
@@ -87679,10 +87607,11 @@ export const proto = $root.proto = (() => {
87679
87607
  if (!o)
87680
87608
  o = {};
87681
87609
  var d = {};
87610
+ if (o.defaults) {
87611
+ d.type = o.enums === String ? "DISABLE_CTA" : 1;
87612
+ }
87682
87613
  if (m.type != null && m.hasOwnProperty("type")) {
87683
87614
  d.type = o.enums === String ? $root.proto.SyncActionValue.InteractiveMessageAction.InteractiveMessageActionMode[m.type] === undefined ? m.type : $root.proto.SyncActionValue.InteractiveMessageAction.InteractiveMessageActionMode[m.type] : m.type;
87684
- if (o.oneofs)
87685
- d._type = "type";
87686
87615
  }
87687
87616
  if (m.agmId != null && m.hasOwnProperty("agmId")) {
87688
87617
  d.agmId = m.agmId;
@@ -89169,23 +89098,13 @@ export const proto = $root.proto = (() => {
89169
89098
  this[ks[i]] = p[ks[i]];
89170
89099
  }
89171
89100
 
89172
- MerchantPaymentPartnerAction.prototype.status = null;
89173
- MerchantPaymentPartnerAction.prototype.country = null;
89101
+ MerchantPaymentPartnerAction.prototype.status = 0;
89102
+ MerchantPaymentPartnerAction.prototype.country = "";
89174
89103
  MerchantPaymentPartnerAction.prototype.gatewayName = null;
89175
89104
  MerchantPaymentPartnerAction.prototype.credentialId = null;
89176
89105
 
89177
89106
  let $oneOfFields;
89178
89107
 
89179
- Object.defineProperty(MerchantPaymentPartnerAction.prototype, "_status", {
89180
- get: $util.oneOfGetter($oneOfFields = ["status"]),
89181
- set: $util.oneOfSetter($oneOfFields)
89182
- });
89183
-
89184
- Object.defineProperty(MerchantPaymentPartnerAction.prototype, "_country", {
89185
- get: $util.oneOfGetter($oneOfFields = ["country"]),
89186
- set: $util.oneOfSetter($oneOfFields)
89187
- });
89188
-
89189
89108
  Object.defineProperty(MerchantPaymentPartnerAction.prototype, "_gatewayName", {
89190
89109
  get: $util.oneOfGetter($oneOfFields = ["gatewayName"]),
89191
89110
  set: $util.oneOfSetter($oneOfFields)
@@ -89283,15 +89202,15 @@ export const proto = $root.proto = (() => {
89283
89202
  if (!o)
89284
89203
  o = {};
89285
89204
  var d = {};
89205
+ if (o.defaults) {
89206
+ d.status = o.enums === String ? "ACTIVE" : 0;
89207
+ d.country = "";
89208
+ }
89286
89209
  if (m.status != null && m.hasOwnProperty("status")) {
89287
89210
  d.status = o.enums === String ? $root.proto.SyncActionValue.MerchantPaymentPartnerAction.Status[m.status] === undefined ? m.status : $root.proto.SyncActionValue.MerchantPaymentPartnerAction.Status[m.status] : m.status;
89288
- if (o.oneofs)
89289
- d._status = "status";
89290
89211
  }
89291
89212
  if (m.country != null && m.hasOwnProperty("country")) {
89292
89213
  d.country = m.country;
89293
- if (o.oneofs)
89294
- d._country = "country";
89295
89214
  }
89296
89215
  if (m.gatewayName != null && m.hasOwnProperty("gatewayName")) {
89297
89216
  d.gatewayName = m.gatewayName;
@@ -90410,20 +90329,8 @@ export const proto = $root.proto = (() => {
90410
90329
  this[ks[i]] = p[ks[i]];
90411
90330
  }
90412
90331
 
90413
- PaymentTosAction.prototype.paymentNotice = null;
90414
- PaymentTosAction.prototype.accepted = null;
90415
-
90416
- let $oneOfFields;
90417
-
90418
- Object.defineProperty(PaymentTosAction.prototype, "_paymentNotice", {
90419
- get: $util.oneOfGetter($oneOfFields = ["paymentNotice"]),
90420
- set: $util.oneOfSetter($oneOfFields)
90421
- });
90422
-
90423
- Object.defineProperty(PaymentTosAction.prototype, "_accepted", {
90424
- get: $util.oneOfGetter($oneOfFields = ["accepted"]),
90425
- set: $util.oneOfSetter($oneOfFields)
90426
- });
90332
+ PaymentTosAction.prototype.paymentNotice = 0;
90333
+ PaymentTosAction.prototype.accepted = false;
90427
90334
 
90428
90335
  PaymentTosAction.create = function create(properties) {
90429
90336
  return new PaymentTosAction(properties);
@@ -90490,15 +90397,15 @@ export const proto = $root.proto = (() => {
90490
90397
  if (!o)
90491
90398
  o = {};
90492
90399
  var d = {};
90400
+ if (o.defaults) {
90401
+ d.paymentNotice = o.enums === String ? "BR_PAY_PRIVACY_POLICY" : 0;
90402
+ d.accepted = false;
90403
+ }
90493
90404
  if (m.paymentNotice != null && m.hasOwnProperty("paymentNotice")) {
90494
90405
  d.paymentNotice = o.enums === String ? $root.proto.SyncActionValue.PaymentTosAction.PaymentNotice[m.paymentNotice] === undefined ? m.paymentNotice : $root.proto.SyncActionValue.PaymentTosAction.PaymentNotice[m.paymentNotice] : m.paymentNotice;
90495
- if (o.oneofs)
90496
- d._paymentNotice = "paymentNotice";
90497
90406
  }
90498
90407
  if (m.accepted != null && m.hasOwnProperty("accepted")) {
90499
90408
  d.accepted = m.accepted;
90500
- if (o.oneofs)
90501
- d._accepted = "accepted";
90502
90409
  }
90503
90410
  return d;
90504
90411
  };
@@ -92695,6 +92602,7 @@ export const proto = $root.proto = (() => {
92695
92602
 
92696
92603
  function StatusPrivacyAction(p) {
92697
92604
  this.userJid = [];
92605
+ this.customLists = [];
92698
92606
  if (p)
92699
92607
  for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
92700
92608
  if (p[ks[i]] != null)
@@ -92705,6 +92613,7 @@ export const proto = $root.proto = (() => {
92705
92613
  StatusPrivacyAction.prototype.userJid = $util.emptyArray;
92706
92614
  StatusPrivacyAction.prototype.shareToFB = null;
92707
92615
  StatusPrivacyAction.prototype.shareToIG = null;
92616
+ StatusPrivacyAction.prototype.customLists = $util.emptyArray;
92708
92617
 
92709
92618
  let $oneOfFields;
92710
92619
 
@@ -92740,6 +92649,10 @@ export const proto = $root.proto = (() => {
92740
92649
  w.uint32(24).bool(m.shareToFB);
92741
92650
  if (m.shareToIG != null && Object.hasOwnProperty.call(m, "shareToIG"))
92742
92651
  w.uint32(32).bool(m.shareToIG);
92652
+ if (m.customLists != null && m.customLists.length) {
92653
+ for (var i = 0; i < m.customLists.length; ++i)
92654
+ $root.proto.SyncActionValue.StatusPrivacyAction.CustomList.encode(m.customLists[i], w.uint32(42).fork()).ldelim();
92655
+ }
92743
92656
  return w;
92744
92657
  };
92745
92658
 
@@ -92770,6 +92683,12 @@ export const proto = $root.proto = (() => {
92770
92683
  m.shareToIG = r.bool();
92771
92684
  break;
92772
92685
  }
92686
+ case 5: {
92687
+ if (!(m.customLists && m.customLists.length))
92688
+ m.customLists = [];
92689
+ m.customLists.push($root.proto.SyncActionValue.StatusPrivacyAction.CustomList.decode(r, r.uint32()));
92690
+ break;
92691
+ }
92773
92692
  default:
92774
92693
  r.skipType(t & 7);
92775
92694
  break;
@@ -92805,6 +92724,10 @@ export const proto = $root.proto = (() => {
92805
92724
  case 3:
92806
92725
  m.mode = 3;
92807
92726
  break;
92727
+ case "CUSTOM_LIST":
92728
+ case 4:
92729
+ m.mode = 4;
92730
+ break;
92808
92731
  }
92809
92732
  if (d.userJid) {
92810
92733
  if (!Array.isArray(d.userJid))
@@ -92820,6 +92743,16 @@ export const proto = $root.proto = (() => {
92820
92743
  if (d.shareToIG != null) {
92821
92744
  m.shareToIG = Boolean(d.shareToIG);
92822
92745
  }
92746
+ if (d.customLists) {
92747
+ if (!Array.isArray(d.customLists))
92748
+ throw TypeError(".proto.SyncActionValue.StatusPrivacyAction.customLists: array expected");
92749
+ m.customLists = [];
92750
+ for (var i = 0; i < d.customLists.length; ++i) {
92751
+ if (typeof d.customLists[i] !== "object")
92752
+ throw TypeError(".proto.SyncActionValue.StatusPrivacyAction.customLists: object expected");
92753
+ m.customLists[i] = $root.proto.SyncActionValue.StatusPrivacyAction.CustomList.fromObject(d.customLists[i]);
92754
+ }
92755
+ }
92823
92756
  return m;
92824
92757
  };
92825
92758
 
@@ -92829,6 +92762,7 @@ export const proto = $root.proto = (() => {
92829
92762
  var d = {};
92830
92763
  if (o.arrays || o.defaults) {
92831
92764
  d.userJid = [];
92765
+ d.customLists = [];
92832
92766
  }
92833
92767
  if (m.mode != null && m.hasOwnProperty("mode")) {
92834
92768
  d.mode = o.enums === String ? $root.proto.SyncActionValue.StatusPrivacyAction.StatusDistributionMode[m.mode] === undefined ? m.mode : $root.proto.SyncActionValue.StatusPrivacyAction.StatusDistributionMode[m.mode] : m.mode;
@@ -92851,6 +92785,12 @@ export const proto = $root.proto = (() => {
92851
92785
  if (o.oneofs)
92852
92786
  d._shareToIG = "shareToIG";
92853
92787
  }
92788
+ if (m.customLists && m.customLists.length) {
92789
+ d.customLists = [];
92790
+ for (var j = 0; j < m.customLists.length; ++j) {
92791
+ d.customLists[j] = $root.proto.SyncActionValue.StatusPrivacyAction.CustomList.toObject(m.customLists[j], o);
92792
+ }
92793
+ }
92854
92794
  return d;
92855
92795
  };
92856
92796
 
@@ -92865,12 +92805,199 @@ export const proto = $root.proto = (() => {
92865
92805
  return typeUrlPrefix + "/proto.SyncActionValue.StatusPrivacyAction";
92866
92806
  };
92867
92807
 
92808
+ StatusPrivacyAction.CustomList = (function() {
92809
+
92810
+ function CustomList(p) {
92811
+ this.userJid = [];
92812
+ if (p)
92813
+ for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
92814
+ if (p[ks[i]] != null)
92815
+ this[ks[i]] = p[ks[i]];
92816
+ }
92817
+
92818
+ CustomList.prototype.id = null;
92819
+ CustomList.prototype.name = null;
92820
+ CustomList.prototype.emoji = null;
92821
+ CustomList.prototype.isSelected = null;
92822
+ CustomList.prototype.userJid = $util.emptyArray;
92823
+
92824
+ let $oneOfFields;
92825
+
92826
+ Object.defineProperty(CustomList.prototype, "_id", {
92827
+ get: $util.oneOfGetter($oneOfFields = ["id"]),
92828
+ set: $util.oneOfSetter($oneOfFields)
92829
+ });
92830
+
92831
+ Object.defineProperty(CustomList.prototype, "_name", {
92832
+ get: $util.oneOfGetter($oneOfFields = ["name"]),
92833
+ set: $util.oneOfSetter($oneOfFields)
92834
+ });
92835
+
92836
+ Object.defineProperty(CustomList.prototype, "_emoji", {
92837
+ get: $util.oneOfGetter($oneOfFields = ["emoji"]),
92838
+ set: $util.oneOfSetter($oneOfFields)
92839
+ });
92840
+
92841
+ Object.defineProperty(CustomList.prototype, "_isSelected", {
92842
+ get: $util.oneOfGetter($oneOfFields = ["isSelected"]),
92843
+ set: $util.oneOfSetter($oneOfFields)
92844
+ });
92845
+
92846
+ CustomList.create = function create(properties) {
92847
+ return new CustomList(properties);
92848
+ };
92849
+
92850
+ CustomList.encode = function encode(m, w) {
92851
+ if (!w)
92852
+ w = $Writer.create();
92853
+ if (m.id != null && Object.hasOwnProperty.call(m, "id"))
92854
+ w.uint32(8).int64(m.id);
92855
+ if (m.name != null && Object.hasOwnProperty.call(m, "name"))
92856
+ w.uint32(18).string(m.name);
92857
+ if (m.emoji != null && Object.hasOwnProperty.call(m, "emoji"))
92858
+ w.uint32(26).string(m.emoji);
92859
+ if (m.isSelected != null && Object.hasOwnProperty.call(m, "isSelected"))
92860
+ w.uint32(32).bool(m.isSelected);
92861
+ if (m.userJid != null && m.userJid.length) {
92862
+ for (var i = 0; i < m.userJid.length; ++i)
92863
+ w.uint32(42).string(m.userJid[i]);
92864
+ }
92865
+ return w;
92866
+ };
92867
+
92868
+ CustomList.decode = function decode(r, l, e) {
92869
+ if (!(r instanceof $Reader))
92870
+ r = $Reader.create(r);
92871
+ var c = l === undefined ? r.len : r.pos + l, m = new $root.proto.SyncActionValue.StatusPrivacyAction.CustomList();
92872
+ while (r.pos < c) {
92873
+ var t = r.uint32();
92874
+ if (t === e)
92875
+ break;
92876
+ switch (t >>> 3) {
92877
+ case 1: {
92878
+ m.id = r.int64();
92879
+ break;
92880
+ }
92881
+ case 2: {
92882
+ m.name = r.string();
92883
+ break;
92884
+ }
92885
+ case 3: {
92886
+ m.emoji = r.string();
92887
+ break;
92888
+ }
92889
+ case 4: {
92890
+ m.isSelected = r.bool();
92891
+ break;
92892
+ }
92893
+ case 5: {
92894
+ if (!(m.userJid && m.userJid.length))
92895
+ m.userJid = [];
92896
+ m.userJid.push(r.string());
92897
+ break;
92898
+ }
92899
+ default:
92900
+ r.skipType(t & 7);
92901
+ break;
92902
+ }
92903
+ }
92904
+ return m;
92905
+ };
92906
+
92907
+ CustomList.fromObject = function fromObject(d) {
92908
+ if (d instanceof $root.proto.SyncActionValue.StatusPrivacyAction.CustomList)
92909
+ return d;
92910
+ var m = new $root.proto.SyncActionValue.StatusPrivacyAction.CustomList();
92911
+ if (d.id != null) {
92912
+ if ($util.Long)
92913
+ (m.id = $util.Long.fromValue(d.id)).unsigned = false;
92914
+ else if (typeof d.id === "string")
92915
+ m.id = parseInt(d.id, 10);
92916
+ else if (typeof d.id === "number")
92917
+ m.id = d.id;
92918
+ else if (typeof d.id === "object")
92919
+ m.id = new $util.LongBits(d.id.low >>> 0, d.id.high >>> 0).toNumber();
92920
+ }
92921
+ if (d.name != null) {
92922
+ m.name = String(d.name);
92923
+ }
92924
+ if (d.emoji != null) {
92925
+ m.emoji = String(d.emoji);
92926
+ }
92927
+ if (d.isSelected != null) {
92928
+ m.isSelected = Boolean(d.isSelected);
92929
+ }
92930
+ if (d.userJid) {
92931
+ if (!Array.isArray(d.userJid))
92932
+ throw TypeError(".proto.SyncActionValue.StatusPrivacyAction.CustomList.userJid: array expected");
92933
+ m.userJid = [];
92934
+ for (var i = 0; i < d.userJid.length; ++i) {
92935
+ m.userJid[i] = String(d.userJid[i]);
92936
+ }
92937
+ }
92938
+ return m;
92939
+ };
92940
+
92941
+ CustomList.toObject = function toObject(m, o) {
92942
+ if (!o)
92943
+ o = {};
92944
+ var d = {};
92945
+ if (o.arrays || o.defaults) {
92946
+ d.userJid = [];
92947
+ }
92948
+ if (m.id != null && m.hasOwnProperty("id")) {
92949
+ if (typeof m.id === "number")
92950
+ d.id = o.longs === String ? String(m.id) : m.id;
92951
+ else
92952
+ d.id = o.longs === String ? longToString(m.id) : o.longs === Number ? longToNumber(m.id) : m.id;
92953
+ if (o.oneofs)
92954
+ d._id = "id";
92955
+ }
92956
+ if (m.name != null && m.hasOwnProperty("name")) {
92957
+ d.name = m.name;
92958
+ if (o.oneofs)
92959
+ d._name = "name";
92960
+ }
92961
+ if (m.emoji != null && m.hasOwnProperty("emoji")) {
92962
+ d.emoji = m.emoji;
92963
+ if (o.oneofs)
92964
+ d._emoji = "emoji";
92965
+ }
92966
+ if (m.isSelected != null && m.hasOwnProperty("isSelected")) {
92967
+ d.isSelected = m.isSelected;
92968
+ if (o.oneofs)
92969
+ d._isSelected = "isSelected";
92970
+ }
92971
+ if (m.userJid && m.userJid.length) {
92972
+ d.userJid = [];
92973
+ for (var j = 0; j < m.userJid.length; ++j) {
92974
+ d.userJid[j] = m.userJid[j];
92975
+ }
92976
+ }
92977
+ return d;
92978
+ };
92979
+
92980
+ CustomList.prototype.toJSON = function toJSON() {
92981
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
92982
+ };
92983
+
92984
+ CustomList.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
92985
+ if (typeUrlPrefix === undefined) {
92986
+ typeUrlPrefix = "type.googleapis.com";
92987
+ }
92988
+ return typeUrlPrefix + "/proto.SyncActionValue.StatusPrivacyAction.CustomList";
92989
+ };
92990
+
92991
+ return CustomList;
92992
+ })();
92993
+
92868
92994
  StatusPrivacyAction.StatusDistributionMode = (function() {
92869
92995
  const valuesById = {}, values = Object.create(valuesById);
92870
92996
  values[valuesById[0] = "ALLOW_LIST"] = 0;
92871
92997
  values[valuesById[1] = "DENY_LIST"] = 1;
92872
92998
  values[valuesById[2] = "CONTACTS"] = 2;
92873
92999
  values[valuesById[3] = "CLOSE_FRIENDS"] = 3;
93000
+ values[valuesById[4] = "CUSTOM_LIST"] = 4;
92874
93001
  return values;
92875
93002
  })();
92876
93003
 
@@ -18,6 +18,7 @@ export const makeMessagesRecvSocket = (config) => {
18
18
  const { ev, authState, ws, messageMutex, notificationMutex, receiptMutex, signalRepository, query, upsertMessage, resyncAppState, onUnexpectedError, assertSessions, sendNode, relayMessage, sendReceipt, uploadPreKeys, sendPeerDataOperationMessage, generateMessageTag, messageRetryManager } = sock;
19
19
  /** this mutex ensures that each retryRequest will wait for the previous one to finish */
20
20
  const retryMutex = makeMutex();
21
+ const devicesMutex = makeMutex();
21
22
  const msgRetryCache = config.msgRetryCounterCache ||
22
23
  new NodeCache({
23
24
  stdTTL: DEFAULT_CACHE_TTLS.MSG_RETRY, // 1 hour
@@ -33,6 +34,11 @@ export const makeMessagesRecvSocket = (config) => {
33
34
  stdTTL: DEFAULT_CACHE_TTLS.MSG_RETRY, // 1 hour
34
35
  useClones: false
35
36
  });
37
+ const userDevicesCache = config.userDevicesCache ??=
38
+ new NodeCache({
39
+ stdTTL: DEFAULT_CACHE_TTLS.USER_DEVICES, // 5 minutes
40
+ useClones: false
41
+ });
36
42
  // Debounce identity-change session refreshes per JID to avoid bursts
37
43
  const identityAssertDebounce = new NodeCache({ stdTTL: 5, useClones: false });
38
44
  let sendActiveReceipts = false;
@@ -615,6 +621,64 @@ export const makeMessagesRecvSocket = (config) => {
615
621
  break;
616
622
  }
617
623
  };
624
+ const handleDevicesNotification = async (node) => {
625
+ const [child] = getAllBinaryNodeChildren(node);
626
+ const from = jidNormalizedUser(node.attrs.from);
627
+ const devices = getBinaryNodeChildren(child, 'device');
628
+ if (areJidsSameUser(from, authState.creds.me.id) ||
629
+ areJidsSameUser(from, authState.creds.me.lid)) {
630
+ const deviceJids = devices.map(d => d.attrs.jid);
631
+ logger.info({ deviceJids }, 'got my own devices');
632
+ }
633
+ if (!devices || !devices.length || !devices[0]) {
634
+ logger.debug({ from }, 'no devices in notification, skipping');
635
+ return;
636
+ }
637
+ const deviceJid = devices[0].attrs.jid;
638
+ const decoded = jidDecode(deviceJid);
639
+ if (!decoded) return;
640
+ const { user, device } = decoded;
641
+ const tag = child.tag;
642
+ if (!deviceJid) {
643
+ logger.debug({ tag }, 'no device jid in notification, skipping');
644
+ return;
645
+ }
646
+ await devicesMutex.mutex(async () => {
647
+ if (tag === 'update') {
648
+ logger.debug({ user }, `${user}'s device list updated, dropping cached devices`);
649
+ if (userDevicesCache) {
650
+ await userDevicesCache.del(user);
651
+ }
652
+ return;
653
+ }
654
+ const existingCache = (await (userDevicesCache?.get(user))) || [];
655
+ if (!existingCache.length) {
656
+ logger.debug({ user, tag }, 'device list not cached, skipping cache update')
657
+ return;
658
+ }
659
+ const deviceHash = child.attrs.device_hash;
660
+ let updatedDevices = [];
661
+ switch (tag) {
662
+ case 'add':
663
+ logger.info({ deviceHash }, 'device added');
664
+ updatedDevices = [
665
+ ...existingCache.filter(d => d.device !== device),
666
+ { user, device }
667
+ ];
668
+ break;
669
+ case 'remove':
670
+ logger.info({ deviceHash }, 'device removed');
671
+ updatedDevices = existingCache.filter(d => d.device !== device);
672
+ break;
673
+ default:
674
+ logger.debug({ tag }, 'Unknown device list change tag');
675
+ return;
676
+ }
677
+ if (updatedDevices.length > 0 && userDevicesCache) {
678
+ await userDevicesCache.set(user, updatedDevices);
679
+ }
680
+ });
681
+ };
618
682
  const processNotification = async (node) => {
619
683
  const result = {};
620
684
  const [child] = getAllBinaryNodeChildren(node);
@@ -639,13 +703,12 @@ export const makeMessagesRecvSocket = (config) => {
639
703
  await handleEncryptNotification(node);
640
704
  break;
641
705
  case 'devices':
642
- const devices = getBinaryNodeChildren(child, 'device');
643
- if (areJidsSameUser(child.attrs.jid, authState.creds.me.id) ||
644
- areJidsSameUser(child.attrs.lid, authState.creds.me.lid)) {
645
- const deviceData = devices.map(d => ({ id: d.attrs.jid, lid: d.attrs.lid }));
646
- logger.info({ deviceData }, 'my own devices changed');
706
+ try {
707
+ await handleDevicesNotification(node);
708
+ }
709
+ catch (error) {
710
+ logger.error({ error, node }, 'failed to handle devices notification');
647
711
  }
648
- //TODO: drop a new event, add hashes
649
712
  break;
650
713
  case 'server_sync':
651
714
  const update = getBinaryNodeChild(node, 'collection');
@@ -15,7 +15,7 @@ export const makeMessagesSocket = (config) => {
15
15
  const { logger, linkPreviewImageThumbnailWidth, generateHighQualityLinkPreview, options: httpRequestOptions, patchMessageBeforeSending, cachedGroupMetadata, enableRecentMessageCache, maxMsgRetryCount } = config;
16
16
  const sock = makeNewsletterSocket(config);
17
17
  const { ev, authState, messageMutex, signalRepository, upsertMessage, query, fetchPrivacySettings, sendNode, groupMetadata, groupToggleEphemeral } = sock;
18
- const userDevicesCache = config.userDevicesCache ||
18
+ const userDevicesCache = config.userDevicesCache ??=
19
19
  new NodeCache({
20
20
  stdTTL: DEFAULT_CACHE_TTLS.USER_DEVICES, // 5 minutes
21
21
  useClones: false
@@ -98,10 +98,11 @@ export async function getMediaKeys(buffer, mediaType) {
98
98
  }
99
99
  /** Extracts video thumb using FFMPEG */
100
100
  export const extractVideoThumb = async (path, time, size) => {
101
- const ff = spawn('ffmpeg', [
101
+ const ffmpeg = spawn('ffmpeg', [
102
102
  '-loglevel', 'error',
103
103
  '-ss', String(time),
104
104
  '-i', path,
105
+ '-an', '-sn', '-dn',
105
106
  '-map_metadata', '-1',
106
107
  '-vf', `scale=${size.width}:-1`,
107
108
  '-frames:v', '1',
@@ -111,18 +112,20 @@ export const extractVideoThumb = async (path, time, size) => {
111
112
  ], {
112
113
  stdio: ['ignore', 'pipe', 'pipe']
113
114
  });
114
- const stdoutChunks = [];
115
+ let buffer = Buffer.alloc(0);
115
116
  const stderrChunks = [];
116
- ff.stdout.on('data', chunk => stdoutChunks.push(chunk));
117
- ff.stderr.on('data', chunk => stderrChunks.push(chunk));
118
- const [code] = await once(ff, 'close');
117
+ ffmpeg.stdout.on('data', (chunk) => {
118
+ buffer = Buffer.concat([buffer, chunk]);
119
+ });
120
+ ffmpeg.stderr.on('data', (chunk) => stderrChunks.push(chunk));
121
+ const [code] = await once(ffmpeg, 'close');
119
122
  if (code !== 0) {
120
123
  throw new Boom(
121
124
  `FFmpeg failed (code ${code}):\n` +
122
125
  Buffer.concat(stderrChunks).toString('utf8')
123
126
  );
124
127
  }
125
- return Buffer.concat(stdoutChunks);
128
+ return buffer;
126
129
  };
127
130
  export const extractImageThumb = async (bufferOrFilePath, width = 32) => {
128
131
  // TODO: Move entirely to sharp, removing jimp as it supports readable streams
@@ -697,8 +700,10 @@ export const getWAUploadToServer = ({ customUploadHosts, fetchAgent, logger, opt
697
700
  logger.debug(`uploading to "${hostname}"`);
698
701
  const auth = encodeURIComponent(uploadInfo.auth);
699
702
  // Lia@Changes 06-02-26 --- Switch media path map for newsletter uploads
700
- const mediaPathMap = newsletter ? NEWSLETTER_MEDIA_PATH_MAP : MEDIA_PATH_MAP
701
- const url = `https://${hostname}${mediaPathMap[mediaType]}/${fileEncSha256B64}?auth=${auth}&token=${fileEncSha256B64}`;
703
+ const mediaPathMap = (newsletter ? NEWSLETTER_MEDIA_PATH_MAP : undefined) || MEDIA_PATH_MAP
704
+ // Lia@Changes 20-03-26 --- Add server thumb for newsletter media
705
+ const serverThumb = newsletter ? '&server_thumb_gen=1' : ''
706
+ const url = `https://${hostname}${mediaPathMap[mediaType]}/${fileEncSha256B64}?auth=${auth}&token=${fileEncSha256B64}${serverThumb}`;
702
707
  let result;
703
708
  try {
704
709
  result = await uploadMedia({
@@ -715,7 +720,8 @@ export const getWAUploadToServer = ({ customUploadHosts, fetchAgent, logger, opt
715
720
  meta_hmac: result.meta_hmac,
716
721
  fbid: result.fbid,
717
722
  ts: result.ts,
718
- handle: result.handle
723
+ thumbnailDirectPath: result.thumbnail_info?.thumbnail_direct_path,
724
+ thumbnailSha256: result.thumbnail_info?.thumbnail_sha256
719
725
  };
720
726
  break;
721
727
  }
@@ -133,7 +133,7 @@ export const prepareWAMessageMedia = async (message, options) => {
133
133
  logger?.info({ key: cacheableKey }, 'Preparing raw media for newsletter');
134
134
  const { filePath, fileSha256, fileLength } = await getRawMediaUploadData(uploadData.media, options.mediaTypeOverride || mediaType, logger);
135
135
  const fileSha256B64 = fileSha256.toString('base64');
136
- const [{ mediaUrl, directPath }] = await Promise.all([
136
+ const [{ mediaUrl, directPath, thumbnailDirectPath, thumbnailSha256 }] = await Promise.all([
137
137
  (async () => {
138
138
  const result = options.upload(filePath, {
139
139
  fileEncSha256B64: fileSha256B64,
@@ -177,6 +177,8 @@ export const prepareWAMessageMedia = async (message, options) => {
177
177
  directPath,
178
178
  fileSha256,
179
179
  fileLength,
180
+ thumbnailDirectPath,
181
+ thumbnailSha256,
180
182
  ...uploadData
181
183
  })
182
184
  });
@@ -1343,10 +1345,8 @@ export const generateWAMessageContent = async (message, options) => {
1343
1345
  key.contextInfo = { externalAdReply };
1344
1346
  }
1345
1347
  }
1346
- if (
1347
- (hasOptionalProperty(message, 'mentions') && message.mentions?.length) ||
1348
- (hasOptionalProperty(message, 'mentionAll') && message.mentionAll)
1349
- ) {
1348
+ if ((hasOptionalProperty(message, 'mentions') && message.mentions?.length) ||
1349
+ (hasOptionalProperty(message, 'mentionAll') && message.mentionAll)) {
1350
1350
  const messageType = Object.keys(m)[0];
1351
1351
  const key = m[messageType];
1352
1352
  if ('contextInfo' in key && !!key.contextInfo) {
@@ -1448,7 +1448,7 @@ export const generateWAMessageFromContent = (jid, message, options) => {
1448
1448
  const timestamp = unixTimestampSeconds(options.timestamp);
1449
1449
  const isNewsletter = isJidNewsletter(jid);
1450
1450
  const { quoted, userJid } = options;
1451
- if (quoted) {
1451
+ if (quoted && !isNewsletter) {
1452
1452
  const participant = quoted.key.fromMe
1453
1453
  ? userJid // TODO: Add support for LIDs
1454
1454
  : quoted.participant || quoted.key.participant || quoted.key.remoteJid;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itsliaaa/baileys",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "A simple fork of Baileys for WhatsApp automation",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",