aunubaileys 1.0.36 → 1.0.38

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 CHANGED
@@ -64,6 +64,14 @@ Everything else is pure upstream. When upstream moves, we rebase the patch layer
64
64
 
65
65
 
66
66
 
67
+ ### 🆕 What's new in 1.0.38 / Baru di 1.0.38
68
+
69
+ - 📰 **Ad-reply / link-preview cards as a direct message option** — attaching an `externalAdReply` card (title + thumbnail riding on top of a message) used to mean hand-assembling a full `contextInfo`. Now just pass `externalAdReply: { title, body, url, thumbnail, largeThumbnail }` in the message content: `url` maps to both `mediaUrl` and `sourceUrl`, `mediaType` defaults to 1 (image), and the result merges cleanly with an explicit `contextInfo` and with `mentions`/`mentionAll` when combined. One deliberate difference from the adaptation source (@itsliaaa/baileys): there, a missing `url` is silently replaced with the maintainer's donation link — here a missing url **stays empty**; this library never injects a third-party link into your messages. A non-Buffer thumbnail is rejected with a clear 400 error.
70
+
71
+ ### 🆕 What's new in 1.0.37 / Baru di 1.0.37
72
+
73
+ - 📣 **Mention everyone in a group without listing a single JID** — until now, mentioning all group members meant building a `mentions` array of every participant JID yourself: heavy for large groups and impossible without group metadata. The new `mentionAll: true` message option sets WhatsApp's native `nonJidMentions` contextInfo flag, and receiving clients render it as a mass mention with no JID list at all. To carry the flag on the wire, `ContextInfo.nonJidMentions` (field 70, uint32 — matching the current WhatsApp proto) was added to this package's WAProto with full encode/decode/verify/fromObject/toObject support, proven by a byte-level roundtrip test. `mentionAll` combines freely with ordinary `mentions`; existing `mentions` behaviour is unchanged. Adapted from @itsliaaa/baileys.
74
+
67
75
  ### 🆕 What's new in 1.0.36 / Baru di 1.0.36
68
76
 
69
77
  - 📜 **The license now carries the AunuCore Creative Network copyright** — the LICENSE file previously listed only the upstream (WhiskeySockets) copyright, even though AunuBaileys is developed and maintained by AunuCore Creative Network. The primary copyright line is now AunuCore Creative Network, with the upstream attribution retained directly below it exactly as the MIT License requires, plus one line explaining the package's origin. The license itself is unchanged: still MIT, the package.json `license` field is still "MIT", and package users' rights are exactly as before. No code changes in this release.
@@ -1055,6 +1055,7 @@ message ContextInfo {
1055
1055
  optional MemberLabel memberLabel = 62;
1056
1056
  optional bool isQuestion = 63;
1057
1057
  optional StatusSourceType statusSourceType = 64;
1058
+ optional uint32 nonJidMentions = 70;
1058
1059
  message AdReplyInfo {
1059
1060
  optional string advertiserName = 1;
1060
1061
  optional MediaType mediaType = 2;
@@ -10877,6 +10877,9 @@ export namespace proto {
10877
10877
 
10878
10878
  /** ContextInfo statusSourceType */
10879
10879
  statusSourceType?: (proto.ContextInfo.StatusSourceType|null);
10880
+
10881
+ /** ContextInfo nonJidMentions */
10882
+ nonJidMentions?: (number|null);
10880
10883
  }
10881
10884
 
10882
10885
  /** Represents a ContextInfo. */
@@ -11029,6 +11032,9 @@ export namespace proto {
11029
11032
  /** ContextInfo statusSourceType. */
11030
11033
  public statusSourceType?: (proto.ContextInfo.StatusSourceType|null);
11031
11034
 
11035
+ /** ContextInfo nonJidMentions. */
11036
+ public nonJidMentions?: (number|null);
11037
+
11032
11038
  /**
11033
11039
  * Creates a new ContextInfo instance using the specified properties.
11034
11040
  * @param [properties] Properties to set
package/WAProto/index.js CHANGED
@@ -32303,6 +32303,7 @@ export const proto = $root.proto = (() => {
32303
32303
  * @property {proto.IMemberLabel|null} [memberLabel] ContextInfo memberLabel
32304
32304
  * @property {boolean|null} [isQuestion] ContextInfo isQuestion
32305
32305
  * @property {proto.ContextInfo.StatusSourceType|null} [statusSourceType] ContextInfo statusSourceType
32306
+ * @property {number|null} [nonJidMentions] ContextInfo nonJidMentions
32306
32307
  */
32307
32308
 
32308
32309
  /**
@@ -32698,6 +32699,14 @@ export const proto = $root.proto = (() => {
32698
32699
  */
32699
32700
  ContextInfo.prototype.statusSourceType = null;
32700
32701
 
32702
+ /**
32703
+ * ContextInfo nonJidMentions.
32704
+ * @member {number|null|undefined} nonJidMentions
32705
+ * @memberof proto.ContextInfo
32706
+ * @instance
32707
+ */
32708
+ ContextInfo.prototype.nonJidMentions = null;
32709
+
32701
32710
  // OneOf field names bound to virtual getters and setters
32702
32711
  let $oneOfFields;
32703
32712
 
@@ -32971,6 +32980,12 @@ export const proto = $root.proto = (() => {
32971
32980
  set: $util.oneOfSetter($oneOfFields)
32972
32981
  });
32973
32982
 
32983
+ // Virtual OneOf for proto3 optional field
32984
+ Object.defineProperty(ContextInfo.prototype, "_nonJidMentions", {
32985
+ get: $util.oneOfGetter($oneOfFields = ["nonJidMentions"]),
32986
+ set: $util.oneOfSetter($oneOfFields)
32987
+ });
32988
+
32974
32989
  /**
32975
32990
  * Creates a new ContextInfo instance using the specified properties.
32976
32991
  * @function create
@@ -33091,6 +33106,8 @@ export const proto = $root.proto = (() => {
33091
33106
  writer.uint32(/* id 63, wireType 0 =*/504).bool(message.isQuestion);
33092
33107
  if (message.statusSourceType != null && Object.hasOwnProperty.call(message, "statusSourceType"))
33093
33108
  writer.uint32(/* id 64, wireType 0 =*/512).int32(message.statusSourceType);
33109
+ if (message.nonJidMentions != null && Object.hasOwnProperty.call(message, "nonJidMentions"))
33110
+ writer.uint32(/* id 70, wireType 0 =*/560).uint32(message.nonJidMentions);
33094
33111
  return writer;
33095
33112
  };
33096
33113
 
@@ -33317,6 +33334,10 @@ export const proto = $root.proto = (() => {
33317
33334
  message.statusSourceType = reader.int32();
33318
33335
  break;
33319
33336
  }
33337
+ case 70: {
33338
+ message.nonJidMentions = reader.uint32();
33339
+ break;
33340
+ }
33320
33341
  default:
33321
33342
  reader.skipType(tag & 7);
33322
33343
  break;
@@ -33661,6 +33682,11 @@ export const proto = $root.proto = (() => {
33661
33682
  break;
33662
33683
  }
33663
33684
  }
33685
+ if (message.nonJidMentions != null && message.hasOwnProperty("nonJidMentions")) {
33686
+ properties._nonJidMentions = 1;
33687
+ if (!$util.isInteger(message.nonJidMentions))
33688
+ return "nonJidMentions: integer expected";
33689
+ }
33664
33690
  return null;
33665
33691
  };
33666
33692
 
@@ -33923,6 +33949,8 @@ export const proto = $root.proto = (() => {
33923
33949
  message.statusSourceType = 5;
33924
33950
  break;
33925
33951
  }
33952
+ if (object.nonJidMentions != null)
33953
+ message.nonJidMentions = object.nonJidMentions >>> 0;
33926
33954
  return message;
33927
33955
  };
33928
33956
 
@@ -34181,6 +34209,11 @@ export const proto = $root.proto = (() => {
34181
34209
  if (options.oneofs)
34182
34210
  object._statusSourceType = "statusSourceType";
34183
34211
  }
34212
+ if (message.nonJidMentions != null && message.hasOwnProperty("nonJidMentions")) {
34213
+ object.nonJidMentions = message.nonJidMentions;
34214
+ if (options.oneofs)
34215
+ object._nonJidMentions = "nonJidMentions";
34216
+ }
34184
34217
  return object;
34185
34218
  };
34186
34219
 
@@ -65,10 +65,29 @@ export interface WAUrlInfo {
65
65
  type Mentionable = {
66
66
  /** list of jids that are mentioned in the accompanying text */
67
67
  mentions?: string[];
68
+ /** mention all group participants via the native non-JID mention flag (no JID list needed) */
69
+ mentionAll?: boolean;
68
70
  };
69
71
  type Contextable = {
70
72
  /** add contextInfo to the message */
71
73
  contextInfo?: proto.IContextInfo;
74
+ /**
75
+ * shorthand for contextInfo.externalAdReply — renders an ad-reply / link-preview
76
+ * card without hand-writing contextInfo. `url` maps to both mediaUrl and sourceUrl;
77
+ * a missing url stays empty (no fallback link is ever injected).
78
+ */
79
+ externalAdReply?: {
80
+ title?: string;
81
+ body?: string;
82
+ url?: string;
83
+ mediaType?: proto.Message.ExternalAdReplyInfo.MediaType;
84
+ /** thumbnail image bytes */
85
+ thumbnail?: Buffer;
86
+ thumbnailUrl?: string;
87
+ /** render the large thumbnail variant */
88
+ largeThumbnail?: boolean;
89
+ showAdAttribution?: boolean;
90
+ };
72
91
  };
73
92
  type ViewOnce = {
74
93
  viewOnce?: boolean;
@@ -791,18 +791,52 @@ export const generateWAMessageContent = async (message, options) => {
791
791
  else {
792
792
  m = await prepareWAMessageMedia(message, options);
793
793
  }
794
+ // AunuBaileys: externalAdReply langsung sebagai opsi pesan (diadaptasi dari @itsliaaa/baileys;
795
+ // tanpa fallback URL pihak ketiga — url kosong tetap kosong)
796
+ if ('externalAdReply' in message && !!message.externalAdReply) {
797
+ const messageType = Object.keys(m)[0];
798
+ const key = m[messageType];
799
+ const ad = message.externalAdReply;
800
+ if ('thumbnail' in ad && ad.thumbnail !== undefined && !Buffer.isBuffer(ad.thumbnail)) {
801
+ throw new Boom('externalAdReply thumbnail must be a Buffer', { statusCode: 400 });
802
+ }
803
+ const externalAdReply = {
804
+ title: ad.title,
805
+ body: ad.body,
806
+ mediaType: ad.mediaType ?? 1,
807
+ mediaUrl: ad.url,
808
+ sourceUrl: ad.url,
809
+ thumbnail: ad.thumbnail,
810
+ thumbnailUrl: ad.thumbnailUrl,
811
+ renderLargerThumbnail: ad.largeThumbnail,
812
+ showAdAttribution: ad.showAdAttribution
813
+ };
814
+ if ('contextInfo' in key && !!key.contextInfo) {
815
+ key.contextInfo.externalAdReply = { ...key.contextInfo.externalAdReply, ...externalAdReply };
816
+ }
817
+ else if (key) {
818
+ key.contextInfo = { externalAdReply };
819
+ }
820
+ }
794
821
  if ('viewOnce' in message && !!message.viewOnce) {
795
822
  m = { viewOnceMessage: { message: m } };
796
823
  }
797
- if ('mentions' in message && message.mentions?.length) {
824
+ if (('mentions' in message && message.mentions?.length) ||
825
+ ('mentionAll' in message && !!message.mentionAll)) {
798
826
  const messageType = Object.keys(m)[0];
799
827
  const key = m[messageType];
800
828
  if ('contextInfo' in key && !!key.contextInfo) {
801
- key.contextInfo.mentionedJid = message.mentions;
829
+ if (message.mentions?.length) {
830
+ key.contextInfo.mentionedJid = message.mentions;
831
+ }
832
+ if (message.mentionAll) {
833
+ key.contextInfo.nonJidMentions = 1;
834
+ }
802
835
  }
803
836
  else if (key) {
804
837
  key.contextInfo = {
805
- mentionedJid: message.mentions
838
+ ...(message.mentions?.length ? { mentionedJid: message.mentions } : {}),
839
+ ...(message.mentionAll ? { nonJidMentions: 1 } : {})
806
840
  };
807
841
  }
808
842
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aunubaileys",
3
3
  "type": "module",
4
- "version": "1.0.36",
4
+ "version": "1.0.38",
5
5
  "description": "AunuBaileys \u2014 a WhatsApp Web API for bots that never sleep. Full upstream power with the beloved in-memory store restored and pairing that just works. Forged by AunuCore.",
6
6
  "keywords": [
7
7
  "whatsapp",