@hiroosy/baileys-lite 0.4.4 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5921,6 +5921,7 @@ export namespace proto {
5921
5921
  encCommentMessage?: (proto.Message.IEncCommentMessage|null);
5922
5922
  bcallMessage?: (proto.Message.IBCallMessage|null);
5923
5923
  lottieStickerMessage?: (proto.Message.IFutureProofMessage|null);
5924
+ audioStickerMessage?: (proto.Message.IFutureProofMessage|null);
5924
5925
  eventMessage?: (proto.Message.IEventMessage|null);
5925
5926
  encEventResponseMessage?: (proto.Message.IEncEventResponseMessage|null);
5926
5927
  commentMessage?: (proto.Message.ICommentMessage|null);
@@ -6032,6 +6033,7 @@ export namespace proto {
6032
6033
  public encCommentMessage?: (proto.Message.IEncCommentMessage|null);
6033
6034
  public bcallMessage?: (proto.Message.IBCallMessage|null);
6034
6035
  public lottieStickerMessage?: (proto.Message.IFutureProofMessage|null);
6036
+ public audioStickerMessage?: (proto.Message.IFutureProofMessage|null);
6035
6037
  public eventMessage?: (proto.Message.IEventMessage|null);
6036
6038
  public encEventResponseMessage?: (proto.Message.IEncEventResponseMessage|null);
6037
6039
  public commentMessage?: (proto.Message.ICommentMessage|null);
@@ -10266,6 +10268,7 @@ export namespace proto {
10266
10268
  accessibilityLabel?: (string|null);
10267
10269
  premium?: (number|null);
10268
10270
  emojis?: (string|null);
10271
+ audioMessage?: (proto.Message.IAudioMessage|null);
10269
10272
  }
10270
10273
 
10271
10274
  class StickerMessage implements IStickerMessage {
@@ -10292,6 +10295,7 @@ export namespace proto {
10292
10295
  public accessibilityLabel?: (string|null);
10293
10296
  public premium?: (number|null);
10294
10297
  public emojis?: (string|null);
10298
+ public audioMessage?: (proto.Message.IAudioMessage|null);
10295
10299
  public static create(properties?: proto.Message.IStickerMessage): proto.Message.StickerMessage;
10296
10300
  public static encode(m: proto.Message.IStickerMessage, w?: $protobuf.Writer): $protobuf.Writer;
10297
10301
  public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message.StickerMessage;
@@ -67,6 +67,7 @@ Message.prototype.messageHistoryBundle = null;
67
67
  Message.prototype.encCommentMessage = null;
68
68
  Message.prototype.bcallMessage = null;
69
69
  Message.prototype.lottieStickerMessage = null;
70
+ Message.prototype.audioStickerMessage = null;
70
71
  Message.prototype.eventMessage = null;
71
72
  Message.prototype.encEventResponseMessage = null;
72
73
  Message.prototype.commentMessage = null;
@@ -361,6 +362,10 @@ Object.defineProperty(Message.prototype, "_lottieStickerMessage", {
361
362
  get: $util.oneOfGetter($oneOfFields = ["lottieStickerMessage"]),
362
363
  set: $util.oneOfSetter($oneOfFields)
363
364
  });
365
+ Object.defineProperty(Message.prototype, "_audioStickerMessage", {
366
+ get: $util.oneOfGetter($oneOfFields = ["audioStickerMessage"]),
367
+ set: $util.oneOfSetter($oneOfFields)
368
+ });
364
369
  Object.defineProperty(Message.prototype, "_eventMessage", {
365
370
  get: $util.oneOfGetter($oneOfFields = ["eventMessage"]),
366
371
  set: $util.oneOfSetter($oneOfFields)
@@ -671,6 +676,8 @@ if (m.bcallMessage != null && Object.hasOwnProperty.call(m, "bcallMessage"))
671
676
  $root.proto.Message.BCallMessage.encode(m.bcallMessage, w.uint32(578).fork()).ldelim();
672
677
  if (m.lottieStickerMessage != null && Object.hasOwnProperty.call(m, "lottieStickerMessage"))
673
678
  $root.proto.Message.FutureProofMessage.encode(m.lottieStickerMessage, w.uint32(594).fork()).ldelim();
679
+ if (m.audioStickerMessage != null && Object.hasOwnProperty.call(m, "audioStickerMessage"))
680
+ $root.proto.Message.FutureProofMessage.encode(m.audioStickerMessage, w.uint32(1074).fork()).ldelim();
674
681
  if (m.eventMessage != null && Object.hasOwnProperty.call(m, "eventMessage"))
675
682
  $root.proto.Message.EventMessage.encode(m.eventMessage, w.uint32(602).fork()).ldelim();
676
683
  if (m.encEventResponseMessage != null && Object.hasOwnProperty.call(m, "encEventResponseMessage"))
@@ -1024,6 +1031,10 @@ case 74: {
1024
1031
  m.lottieStickerMessage = $root.proto.Message.FutureProofMessage.decode(r, r.uint32(), undefined, n + 1);
1025
1032
  break;
1026
1033
  }
1034
+ case 134: {
1035
+ m.audioStickerMessage = $root.proto.Message.FutureProofMessage.decode(r, r.uint32(), undefined, n + 1);
1036
+ break;
1037
+ }
1027
1038
  case 75: {
1028
1039
  m.eventMessage = $root.proto.Message.EventMessage.decode(r, r.uint32(), undefined, n + 1);
1029
1040
  break;
@@ -1527,6 +1538,11 @@ if (typeof d.lottieStickerMessage !== "object")
1527
1538
  throw TypeError(".proto.Message.lottieStickerMessage: object expected");
1528
1539
  m.lottieStickerMessage = $root.proto.Message.FutureProofMessage.fromObject(d.lottieStickerMessage, n + 1);
1529
1540
  }
1541
+ if (d.audioStickerMessage != null) {
1542
+ if (typeof d.audioStickerMessage !== "object")
1543
+ throw TypeError(".proto.Message.audioStickerMessage: object expected");
1544
+ m.audioStickerMessage = $root.proto.Message.FutureProofMessage.fromObject(d.audioStickerMessage, n + 1);
1545
+ }
1530
1546
  if (d.eventMessage != null) {
1531
1547
  if (typeof d.eventMessage !== "object")
1532
1548
  throw TypeError(".proto.Message.eventMessage: object expected");
@@ -2068,6 +2084,11 @@ d.lottieStickerMessage = $root.proto.Message.FutureProofMessage.toObject(m.lotti
2068
2084
  if (o.oneofs)
2069
2085
  d._lottieStickerMessage = "lottieStickerMessage";
2070
2086
  }
2087
+ if (m.audioStickerMessage != null && m.hasOwnProperty("audioStickerMessage")) {
2088
+ d.audioStickerMessage = $root.proto.Message.FutureProofMessage.toObject(m.audioStickerMessage, o);
2089
+ if (o.oneofs)
2090
+ d._audioStickerMessage = "audioStickerMessage";
2091
+ }
2071
2092
  if (m.eventMessage != null && m.hasOwnProperty("eventMessage")) {
2072
2093
  d.eventMessage = $root.proto.Message.EventMessage.toObject(m.eventMessage, o);
2073
2094
  if (o.oneofs)
@@ -29175,6 +29196,7 @@ StickerMessage.prototype.isLottie = null;
29175
29196
  StickerMessage.prototype.accessibilityLabel = null;
29176
29197
  StickerMessage.prototype.premium = null;
29177
29198
  StickerMessage.prototype.emojis = null;
29199
+ StickerMessage.prototype.audioMessage = null;
29178
29200
  let $oneOfFields;
29179
29201
  Object.defineProperty(StickerMessage.prototype, "_url", {
29180
29202
  get: $util.oneOfGetter($oneOfFields = ["url"]),
@@ -29264,6 +29286,10 @@ Object.defineProperty(StickerMessage.prototype, "_emojis", {
29264
29286
  get: $util.oneOfGetter($oneOfFields = ["emojis"]),
29265
29287
  set: $util.oneOfSetter($oneOfFields)
29266
29288
  });
29289
+ Object.defineProperty(StickerMessage.prototype, "_audioMessage", {
29290
+ get: $util.oneOfGetter($oneOfFields = ["audioMessage"]),
29291
+ set: $util.oneOfSetter($oneOfFields)
29292
+ });
29267
29293
  StickerMessage.create = function create(properties) {
29268
29294
  return new StickerMessage(properties);
29269
29295
  };
@@ -29314,6 +29340,8 @@ if (m.premium != null && Object.hasOwnProperty.call(m, "premium"))
29314
29340
  w.uint32(192).int32(m.premium);
29315
29341
  if (m.emojis != null && Object.hasOwnProperty.call(m, "emojis"))
29316
29342
  w.uint32(202).string(m.emojis);
29343
+ if (m.audioMessage != null && Object.hasOwnProperty.call(m, "audioMessage"))
29344
+ $root.proto.Message.AudioMessage.encode(m.audioMessage, w.uint32(210).fork()).ldelim();
29317
29345
  return w;
29318
29346
  };
29319
29347
  StickerMessage.decode = function decode(r, l, e, n) {
@@ -29417,6 +29445,10 @@ case 25: {
29417
29445
  m.emojis = r.string();
29418
29446
  break;
29419
29447
  }
29448
+ case 26: {
29449
+ m.audioMessage = $root.proto.Message.AudioMessage.decode(r, r.uint32(), undefined, n + 1);
29450
+ break;
29451
+ }
29420
29452
  default:
29421
29453
  r.skipType(t & 7, n);
29422
29454
  break;
@@ -29536,6 +29568,11 @@ m.premium = d.premium | 0;
29536
29568
  if (d.emojis != null) {
29537
29569
  m.emojis = String(d.emojis);
29538
29570
  }
29571
+ if (d.audioMessage != null) {
29572
+ if (typeof d.audioMessage !== "object")
29573
+ throw TypeError(".proto.Message.StickerMessage.audioMessage: object expected");
29574
+ m.audioMessage = $root.proto.Message.AudioMessage.fromObject(d.audioMessage, n + 1);
29575
+ }
29539
29576
  return m;
29540
29577
  };
29541
29578
  StickerMessage.toObject = function toObject(m, o) {
@@ -29661,6 +29698,11 @@ d.emojis = m.emojis;
29661
29698
  if (o.oneofs)
29662
29699
  d._emojis = "emojis";
29663
29700
  }
29701
+ if (m.audioMessage != null && m.hasOwnProperty("audioMessage")) {
29702
+ d.audioMessage = $root.proto.Message.AudioMessage.toObject(m.audioMessage, o);
29703
+ if (o.oneofs)
29704
+ d._audioMessage = "audioMessage";
29705
+ }
29664
29706
  return d;
29665
29707
  };
29666
29708
  StickerMessage.prototype.toJSON = function toJSON() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiroosy/baileys-lite",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "A Lightweight Baileys built with Pure NodeJs 18+",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,9 +17,9 @@ import {
17
17
  generateMdTagPrefix,
18
18
  generateRegistrationNode,
19
19
  getCodeFromWSError,
20
- getCompanionPlatformId,
21
20
  getErrorCodeFromStreamError,
22
21
  getNextPreKeysNode,
22
+ getPairingCodePlatformId,
23
23
  makeNoiseHandler,
24
24
  promiseTimeout,
25
25
  signedKeyPair,
@@ -618,7 +618,7 @@ export const makeSocket = config => {
618
618
  authState.creds.me = { id: jidEncode(phone, 's.whatsapp.net'), name: '~' }
619
619
  ev.emit('creds.update', authState.creds)
620
620
  try {
621
- await sendNode({
621
+ await query({
622
622
  tag: 'iq',
623
623
  attrs: { to: S_WHATSAPP_NET, type: 'set', id: generateMessageTag(), xmlns: 'md' },
624
624
  content: [
@@ -628,7 +628,7 @@ export const makeSocket = config => {
628
628
  content: [
629
629
  { tag: 'link_code_pairing_wrapped_companion_ephemeral_pub', attrs: {}, content: await generatePairingKey() },
630
630
  { tag: 'companion_server_auth_key_pub', attrs: {}, content: authState.creds.noiseKey.public },
631
- { tag: 'companion_platform_id', attrs: {}, content: getCompanionPlatformId(browser) },
631
+ { tag: 'companion_platform_id', attrs: {}, content: getPairingCodePlatformId(browser) },
632
632
  { tag: 'companion_platform_display', attrs: {}, content: `${browser[1]} (${browser[0]})` },
633
633
  { tag: 'link_code_pairing_nonce', attrs: {}, content: '0' }
634
634
  ]
@@ -484,6 +484,8 @@ export const getCompanionWebClientType = ([os, browserName]) => {
484
484
 
485
485
  export const getCompanionPlatformId = browser => getCompanionWebClientType(browser).toString()
486
486
 
487
+ export const getPairingCodePlatformId = browser => (browser[1].toLocaleLowerCase().includes('android') ? 'e' : getCompanionPlatformId(browser))
488
+
487
489
  export const buildPairingQRData = (ref, noiseKeyB64, identityKeyB64, advB64, browser) =>
488
490
  'https://wa.me/settings/linked_devices#' + [ref, noiseKeyB64, identityKeyB64, advB64, getCompanionPlatformId(browser)].join(',')
489
491
 
@@ -890,9 +892,7 @@ const WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX = Buffer.from([6, 5])
890
892
 
891
893
  const getUserAgent = config => ({
892
894
  appVersion: { primary: config.version[0], secondary: config.version[1], tertiary: config.version[2] },
893
- platform: config.browser[1].toLocaleLowerCase().includes('android')
894
- ? proto.ClientPayload.UserAgent.Platform.ANDROID
895
- : proto.ClientPayload.UserAgent.Platform.WEB,
895
+ platform: proto.ClientPayload.UserAgent.Platform.WEB,
896
896
  releaseChannel: proto.ClientPayload.UserAgent.ReleaseChannel.RELEASE,
897
897
  osVersion: '0.1',
898
898
  device: 'Desktop',
@@ -920,9 +920,9 @@ const getClientPayload = config => {
920
920
  const payload = {
921
921
  connectType: proto.ClientPayload.ConnectType.WIFI_UNKNOWN,
922
922
  connectReason: proto.ClientPayload.ConnectReason.USER_ACTIVATED,
923
- userAgent: getUserAgent(config)
923
+ userAgent: getUserAgent(config),
924
+ webInfo: getWebInfo(config)
924
925
  }
925
- if (!config.browser[1].toLocaleLowerCase().includes('android')) payload.webInfo = getWebInfo(config)
926
926
  if (config.pushName) payload.pushName = config.pushName
927
927
  return payload
928
928
  }