@itsliaaa/baileys 0.1.12 → 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
  };
@@ -68127,32 +68103,10 @@ export const proto = $root.proto = (() => {
68127
68103
  this[ks[i]] = p[ks[i]];
68128
68104
  }
68129
68105
 
68130
- VideoEndCard.prototype.username = null;
68131
- VideoEndCard.prototype.caption = null;
68132
- VideoEndCard.prototype.thumbnailImageUrl = null;
68133
- VideoEndCard.prototype.profilePictureUrl = null;
68134
-
68135
- let $oneOfFields;
68136
-
68137
- Object.defineProperty(VideoEndCard.prototype, "_username", {
68138
- get: $util.oneOfGetter($oneOfFields = ["username"]),
68139
- set: $util.oneOfSetter($oneOfFields)
68140
- });
68141
-
68142
- Object.defineProperty(VideoEndCard.prototype, "_caption", {
68143
- get: $util.oneOfGetter($oneOfFields = ["caption"]),
68144
- set: $util.oneOfSetter($oneOfFields)
68145
- });
68146
-
68147
- Object.defineProperty(VideoEndCard.prototype, "_thumbnailImageUrl", {
68148
- get: $util.oneOfGetter($oneOfFields = ["thumbnailImageUrl"]),
68149
- set: $util.oneOfSetter($oneOfFields)
68150
- });
68151
-
68152
- Object.defineProperty(VideoEndCard.prototype, "_profilePictureUrl", {
68153
- get: $util.oneOfGetter($oneOfFields = ["profilePictureUrl"]),
68154
- set: $util.oneOfSetter($oneOfFields)
68155
- });
68106
+ VideoEndCard.prototype.username = "";
68107
+ VideoEndCard.prototype.caption = "";
68108
+ VideoEndCard.prototype.thumbnailImageUrl = "";
68109
+ VideoEndCard.prototype.profilePictureUrl = "";
68156
68110
 
68157
68111
  VideoEndCard.create = function create(properties) {
68158
68112
  return new VideoEndCard(properties);
@@ -68228,25 +68182,23 @@ export const proto = $root.proto = (() => {
68228
68182
  if (!o)
68229
68183
  o = {};
68230
68184
  var d = {};
68185
+ if (o.defaults) {
68186
+ d.username = "";
68187
+ d.caption = "";
68188
+ d.thumbnailImageUrl = "";
68189
+ d.profilePictureUrl = "";
68190
+ }
68231
68191
  if (m.username != null && m.hasOwnProperty("username")) {
68232
68192
  d.username = m.username;
68233
- if (o.oneofs)
68234
- d._username = "username";
68235
68193
  }
68236
68194
  if (m.caption != null && m.hasOwnProperty("caption")) {
68237
68195
  d.caption = m.caption;
68238
- if (o.oneofs)
68239
- d._caption = "caption";
68240
68196
  }
68241
68197
  if (m.thumbnailImageUrl != null && m.hasOwnProperty("thumbnailImageUrl")) {
68242
68198
  d.thumbnailImageUrl = m.thumbnailImageUrl;
68243
- if (o.oneofs)
68244
- d._thumbnailImageUrl = "thumbnailImageUrl";
68245
68199
  }
68246
68200
  if (m.profilePictureUrl != null && m.hasOwnProperty("profilePictureUrl")) {
68247
68201
  d.profilePictureUrl = m.profilePictureUrl;
68248
- if (o.oneofs)
68249
- d._profilePictureUrl = "profilePictureUrl";
68250
68202
  }
68251
68203
  return d;
68252
68204
  };
@@ -86253,28 +86205,11 @@ export const proto = $root.proto = (() => {
86253
86205
  this[ks[i]] = p[ks[i]];
86254
86206
  }
86255
86207
 
86256
- CustomPaymentMethod.prototype.credentialId = null;
86257
- CustomPaymentMethod.prototype.country = null;
86258
- CustomPaymentMethod.prototype.type = null;
86208
+ CustomPaymentMethod.prototype.credentialId = "";
86209
+ CustomPaymentMethod.prototype.country = "";
86210
+ CustomPaymentMethod.prototype.type = "";
86259
86211
  CustomPaymentMethod.prototype.metadata = $util.emptyArray;
86260
86212
 
86261
- let $oneOfFields;
86262
-
86263
- Object.defineProperty(CustomPaymentMethod.prototype, "_credentialId", {
86264
- get: $util.oneOfGetter($oneOfFields = ["credentialId"]),
86265
- set: $util.oneOfSetter($oneOfFields)
86266
- });
86267
-
86268
- Object.defineProperty(CustomPaymentMethod.prototype, "_country", {
86269
- get: $util.oneOfGetter($oneOfFields = ["country"]),
86270
- set: $util.oneOfSetter($oneOfFields)
86271
- });
86272
-
86273
- Object.defineProperty(CustomPaymentMethod.prototype, "_type", {
86274
- get: $util.oneOfGetter($oneOfFields = ["type"]),
86275
- set: $util.oneOfSetter($oneOfFields)
86276
- });
86277
-
86278
86213
  CustomPaymentMethod.create = function create(properties) {
86279
86214
  return new CustomPaymentMethod(properties);
86280
86215
  };
@@ -86363,20 +86298,19 @@ export const proto = $root.proto = (() => {
86363
86298
  if (o.arrays || o.defaults) {
86364
86299
  d.metadata = [];
86365
86300
  }
86301
+ if (o.defaults) {
86302
+ d.credentialId = "";
86303
+ d.country = "";
86304
+ d.type = "";
86305
+ }
86366
86306
  if (m.credentialId != null && m.hasOwnProperty("credentialId")) {
86367
86307
  d.credentialId = m.credentialId;
86368
- if (o.oneofs)
86369
- d._credentialId = "credentialId";
86370
86308
  }
86371
86309
  if (m.country != null && m.hasOwnProperty("country")) {
86372
86310
  d.country = m.country;
86373
- if (o.oneofs)
86374
- d._country = "country";
86375
86311
  }
86376
86312
  if (m.type != null && m.hasOwnProperty("type")) {
86377
86313
  d.type = m.type;
86378
- if (o.oneofs)
86379
- d._type = "type";
86380
86314
  }
86381
86315
  if (m.metadata && m.metadata.length) {
86382
86316
  d.metadata = [];
@@ -86410,20 +86344,8 @@ export const proto = $root.proto = (() => {
86410
86344
  this[ks[i]] = p[ks[i]];
86411
86345
  }
86412
86346
 
86413
- CustomPaymentMethodMetadata.prototype.key = null;
86414
- CustomPaymentMethodMetadata.prototype.value = null;
86415
-
86416
- let $oneOfFields;
86417
-
86418
- Object.defineProperty(CustomPaymentMethodMetadata.prototype, "_key", {
86419
- get: $util.oneOfGetter($oneOfFields = ["key"]),
86420
- set: $util.oneOfSetter($oneOfFields)
86421
- });
86422
-
86423
- Object.defineProperty(CustomPaymentMethodMetadata.prototype, "_value", {
86424
- get: $util.oneOfGetter($oneOfFields = ["value"]),
86425
- set: $util.oneOfSetter($oneOfFields)
86426
- });
86347
+ CustomPaymentMethodMetadata.prototype.key = "";
86348
+ CustomPaymentMethodMetadata.prototype.value = "";
86427
86349
 
86428
86350
  CustomPaymentMethodMetadata.create = function create(properties) {
86429
86351
  return new CustomPaymentMethodMetadata(properties);
@@ -86481,15 +86403,15 @@ export const proto = $root.proto = (() => {
86481
86403
  if (!o)
86482
86404
  o = {};
86483
86405
  var d = {};
86406
+ if (o.defaults) {
86407
+ d.key = "";
86408
+ d.value = "";
86409
+ }
86484
86410
  if (m.key != null && m.hasOwnProperty("key")) {
86485
86411
  d.key = m.key;
86486
- if (o.oneofs)
86487
- d._key = "key";
86488
86412
  }
86489
86413
  if (m.value != null && m.hasOwnProperty("value")) {
86490
86414
  d.value = m.value;
86491
- if (o.oneofs)
86492
- d._value = "value";
86493
86415
  }
86494
86416
  return d;
86495
86417
  };
@@ -87610,16 +87532,11 @@ export const proto = $root.proto = (() => {
87610
87532
  this[ks[i]] = p[ks[i]];
87611
87533
  }
87612
87534
 
87613
- InteractiveMessageAction.prototype.type = null;
87535
+ InteractiveMessageAction.prototype.type = 1;
87614
87536
  InteractiveMessageAction.prototype.agmId = null;
87615
87537
 
87616
87538
  let $oneOfFields;
87617
87539
 
87618
- Object.defineProperty(InteractiveMessageAction.prototype, "_type", {
87619
- get: $util.oneOfGetter($oneOfFields = ["type"]),
87620
- set: $util.oneOfSetter($oneOfFields)
87621
- });
87622
-
87623
87540
  Object.defineProperty(InteractiveMessageAction.prototype, "_agmId", {
87624
87541
  get: $util.oneOfGetter($oneOfFields = ["agmId"]),
87625
87542
  set: $util.oneOfSetter($oneOfFields)
@@ -87690,10 +87607,11 @@ export const proto = $root.proto = (() => {
87690
87607
  if (!o)
87691
87608
  o = {};
87692
87609
  var d = {};
87610
+ if (o.defaults) {
87611
+ d.type = o.enums === String ? "DISABLE_CTA" : 1;
87612
+ }
87693
87613
  if (m.type != null && m.hasOwnProperty("type")) {
87694
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;
87695
- if (o.oneofs)
87696
- d._type = "type";
87697
87615
  }
87698
87616
  if (m.agmId != null && m.hasOwnProperty("agmId")) {
87699
87617
  d.agmId = m.agmId;
@@ -89180,23 +89098,13 @@ export const proto = $root.proto = (() => {
89180
89098
  this[ks[i]] = p[ks[i]];
89181
89099
  }
89182
89100
 
89183
- MerchantPaymentPartnerAction.prototype.status = null;
89184
- MerchantPaymentPartnerAction.prototype.country = null;
89101
+ MerchantPaymentPartnerAction.prototype.status = 0;
89102
+ MerchantPaymentPartnerAction.prototype.country = "";
89185
89103
  MerchantPaymentPartnerAction.prototype.gatewayName = null;
89186
89104
  MerchantPaymentPartnerAction.prototype.credentialId = null;
89187
89105
 
89188
89106
  let $oneOfFields;
89189
89107
 
89190
- Object.defineProperty(MerchantPaymentPartnerAction.prototype, "_status", {
89191
- get: $util.oneOfGetter($oneOfFields = ["status"]),
89192
- set: $util.oneOfSetter($oneOfFields)
89193
- });
89194
-
89195
- Object.defineProperty(MerchantPaymentPartnerAction.prototype, "_country", {
89196
- get: $util.oneOfGetter($oneOfFields = ["country"]),
89197
- set: $util.oneOfSetter($oneOfFields)
89198
- });
89199
-
89200
89108
  Object.defineProperty(MerchantPaymentPartnerAction.prototype, "_gatewayName", {
89201
89109
  get: $util.oneOfGetter($oneOfFields = ["gatewayName"]),
89202
89110
  set: $util.oneOfSetter($oneOfFields)
@@ -89294,15 +89202,15 @@ export const proto = $root.proto = (() => {
89294
89202
  if (!o)
89295
89203
  o = {};
89296
89204
  var d = {};
89205
+ if (o.defaults) {
89206
+ d.status = o.enums === String ? "ACTIVE" : 0;
89207
+ d.country = "";
89208
+ }
89297
89209
  if (m.status != null && m.hasOwnProperty("status")) {
89298
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;
89299
- if (o.oneofs)
89300
- d._status = "status";
89301
89211
  }
89302
89212
  if (m.country != null && m.hasOwnProperty("country")) {
89303
89213
  d.country = m.country;
89304
- if (o.oneofs)
89305
- d._country = "country";
89306
89214
  }
89307
89215
  if (m.gatewayName != null && m.hasOwnProperty("gatewayName")) {
89308
89216
  d.gatewayName = m.gatewayName;
@@ -90421,20 +90329,8 @@ export const proto = $root.proto = (() => {
90421
90329
  this[ks[i]] = p[ks[i]];
90422
90330
  }
90423
90331
 
90424
- PaymentTosAction.prototype.paymentNotice = null;
90425
- PaymentTosAction.prototype.accepted = null;
90426
-
90427
- let $oneOfFields;
90428
-
90429
- Object.defineProperty(PaymentTosAction.prototype, "_paymentNotice", {
90430
- get: $util.oneOfGetter($oneOfFields = ["paymentNotice"]),
90431
- set: $util.oneOfSetter($oneOfFields)
90432
- });
90433
-
90434
- Object.defineProperty(PaymentTosAction.prototype, "_accepted", {
90435
- get: $util.oneOfGetter($oneOfFields = ["accepted"]),
90436
- set: $util.oneOfSetter($oneOfFields)
90437
- });
90332
+ PaymentTosAction.prototype.paymentNotice = 0;
90333
+ PaymentTosAction.prototype.accepted = false;
90438
90334
 
90439
90335
  PaymentTosAction.create = function create(properties) {
90440
90336
  return new PaymentTosAction(properties);
@@ -90501,15 +90397,15 @@ export const proto = $root.proto = (() => {
90501
90397
  if (!o)
90502
90398
  o = {};
90503
90399
  var d = {};
90400
+ if (o.defaults) {
90401
+ d.paymentNotice = o.enums === String ? "BR_PAY_PRIVACY_POLICY" : 0;
90402
+ d.accepted = false;
90403
+ }
90504
90404
  if (m.paymentNotice != null && m.hasOwnProperty("paymentNotice")) {
90505
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;
90506
- if (o.oneofs)
90507
- d._paymentNotice = "paymentNotice";
90508
90406
  }
90509
90407
  if (m.accepted != null && m.hasOwnProperty("accepted")) {
90510
90408
  d.accepted = m.accepted;
90511
- if (o.oneofs)
90512
- d._accepted = "accepted";
90513
90409
  }
90514
90410
  return d;
90515
90411
  };
@@ -92706,6 +92602,7 @@ export const proto = $root.proto = (() => {
92706
92602
 
92707
92603
  function StatusPrivacyAction(p) {
92708
92604
  this.userJid = [];
92605
+ this.customLists = [];
92709
92606
  if (p)
92710
92607
  for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
92711
92608
  if (p[ks[i]] != null)
@@ -92716,6 +92613,7 @@ export const proto = $root.proto = (() => {
92716
92613
  StatusPrivacyAction.prototype.userJid = $util.emptyArray;
92717
92614
  StatusPrivacyAction.prototype.shareToFB = null;
92718
92615
  StatusPrivacyAction.prototype.shareToIG = null;
92616
+ StatusPrivacyAction.prototype.customLists = $util.emptyArray;
92719
92617
 
92720
92618
  let $oneOfFields;
92721
92619
 
@@ -92751,6 +92649,10 @@ export const proto = $root.proto = (() => {
92751
92649
  w.uint32(24).bool(m.shareToFB);
92752
92650
  if (m.shareToIG != null && Object.hasOwnProperty.call(m, "shareToIG"))
92753
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
+ }
92754
92656
  return w;
92755
92657
  };
92756
92658
 
@@ -92781,6 +92683,12 @@ export const proto = $root.proto = (() => {
92781
92683
  m.shareToIG = r.bool();
92782
92684
  break;
92783
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
+ }
92784
92692
  default:
92785
92693
  r.skipType(t & 7);
92786
92694
  break;
@@ -92816,6 +92724,10 @@ export const proto = $root.proto = (() => {
92816
92724
  case 3:
92817
92725
  m.mode = 3;
92818
92726
  break;
92727
+ case "CUSTOM_LIST":
92728
+ case 4:
92729
+ m.mode = 4;
92730
+ break;
92819
92731
  }
92820
92732
  if (d.userJid) {
92821
92733
  if (!Array.isArray(d.userJid))
@@ -92831,6 +92743,16 @@ export const proto = $root.proto = (() => {
92831
92743
  if (d.shareToIG != null) {
92832
92744
  m.shareToIG = Boolean(d.shareToIG);
92833
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
+ }
92834
92756
  return m;
92835
92757
  };
92836
92758
 
@@ -92840,6 +92762,7 @@ export const proto = $root.proto = (() => {
92840
92762
  var d = {};
92841
92763
  if (o.arrays || o.defaults) {
92842
92764
  d.userJid = [];
92765
+ d.customLists = [];
92843
92766
  }
92844
92767
  if (m.mode != null && m.hasOwnProperty("mode")) {
92845
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;
@@ -92862,6 +92785,12 @@ export const proto = $root.proto = (() => {
92862
92785
  if (o.oneofs)
92863
92786
  d._shareToIG = "shareToIG";
92864
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
+ }
92865
92794
  return d;
92866
92795
  };
92867
92796
 
@@ -92876,12 +92805,199 @@ export const proto = $root.proto = (() => {
92876
92805
  return typeUrlPrefix + "/proto.SyncActionValue.StatusPrivacyAction";
92877
92806
  };
92878
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
+
92879
92994
  StatusPrivacyAction.StatusDistributionMode = (function() {
92880
92995
  const valuesById = {}, values = Object.create(valuesById);
92881
92996
  values[valuesById[0] = "ALLOW_LIST"] = 0;
92882
92997
  values[valuesById[1] = "DENY_LIST"] = 1;
92883
92998
  values[valuesById[2] = "CONTACTS"] = 2;
92884
92999
  values[valuesById[3] = "CLOSE_FRIENDS"] = 3;
93000
+ values[valuesById[4] = "CUSTOM_LIST"] = 4;
92885
93001
  return values;
92886
93002
  })();
92887
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,7 +700,8 @@ 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
703
+ const mediaPathMap = (newsletter ? NEWSLETTER_MEDIA_PATH_MAP : undefined) || MEDIA_PATH_MAP
704
+ // Lia@Changes 20-03-26 --- Add server thumb for newsletter media
701
705
  const serverThumb = newsletter ? '&server_thumb_gen=1' : ''
702
706
  const url = `https://${hostname}${mediaPathMap[mediaType]}/${fileEncSha256B64}?auth=${auth}&token=${fileEncSha256B64}${serverThumb}`;
703
707
  let result;
@@ -1345,10 +1345,8 @@ export const generateWAMessageContent = async (message, options) => {
1345
1345
  key.contextInfo = { externalAdReply };
1346
1346
  }
1347
1347
  }
1348
- if (
1349
- (hasOptionalProperty(message, 'mentions') && message.mentions?.length) ||
1350
- (hasOptionalProperty(message, 'mentionAll') && message.mentionAll)
1351
- ) {
1348
+ if ((hasOptionalProperty(message, 'mentions') && message.mentions?.length) ||
1349
+ (hasOptionalProperty(message, 'mentionAll') && message.mentionAll)) {
1352
1350
  const messageType = Object.keys(m)[0];
1353
1351
  const key = m[messageType];
1354
1352
  if ('contextInfo' in key && !!key.contextInfo) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itsliaaa/baileys",
3
- "version": "0.1.12",
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",