aunubaileys 1.0.37 → 1.0.39

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.39 / Baru di 1.0.39
68
+
69
+ - 📰 **New `sock.newsletterSubscribed()`** — fetch **every newsletter this account follows** in one call, the newsletter analogue of `groupFetchAllParticipating()` that was missing until now (only `newsletterSubscribers(jid)`, the follower count of one newsletter, existed). Implemented over the same MEX path as the other newsletter methods: query id `6388546374527196`, path `xwa2_newsletter_subscribed` (WhatsApp's own MEX schema constants), added to the `QueryIds`/`XWAPaths` enums. Adapted from @itsliaaa/baileys.
70
+
71
+ ### 🆕 What's new in 1.0.38 / Baru di 1.0.38
72
+
73
+ - 📰 **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.
74
+
67
75
  ### 🆕 What's new in 1.0.37 / Baru di 1.0.37
68
76
 
69
77
  - 📣 **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.
@@ -7,6 +7,7 @@ export declare const makeNewsletterSocket: (sock: GroupsSocket) => {
7
7
  newsletterSubscribers: (jid: string) => Promise<{
8
8
  subscribers: number;
9
9
  }>;
10
+ newsletterSubscribed: () => Promise<unknown>;
10
11
  newsletterMetadata: (type: "invite" | "jid", key: string) => Promise<NewsletterMetadata | null>;
11
12
  newsletterFollow: (jid: string) => Promise<unknown>;
12
13
  newsletterUnfollow: (jid: string) => Promise<unknown>;
@@ -71,6 +71,10 @@ export const makeNewsletterSocket = (sock) => {
71
71
  newsletterSubscribers: async (jid) => {
72
72
  return executeWMexQuery({ newsletter_id: jid }, QueryIds.SUBSCRIBERS, XWAPaths.xwa2_newsletter_subscribers);
73
73
  },
74
+ // AunuBaileys: daftar semua newsletter yang diikuti akun ini (dari @itsliaaa/baileys)
75
+ newsletterSubscribed: async () => {
76
+ return executeWMexQuery({}, QueryIds.SUBSCRIBED, XWAPaths.xwa2_newsletter_subscribed);
77
+ },
74
78
  newsletterMetadata: async (type, key) => {
75
79
  const variables = {
76
80
  fetch_creation_time: true,
@@ -71,6 +71,23 @@ type Mentionable = {
71
71
  type Contextable = {
72
72
  /** add contextInfo to the message */
73
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
+ };
74
91
  };
75
92
  type ViewOnce = {
76
93
  viewOnce?: boolean;
@@ -1,6 +1,7 @@
1
1
  export declare enum XWAPaths {
2
2
  xwa2_newsletter_create = "xwa2_newsletter_create",
3
3
  xwa2_newsletter_subscribers = "xwa2_newsletter_subscribers",
4
+ xwa2_newsletter_subscribed = "xwa2_newsletter_subscribed",
4
5
  xwa2_newsletter_view = "xwa2_newsletter_view",
5
6
  xwa2_newsletter_metadata = "xwa2_newsletter",
6
7
  xwa2_newsletter_admin_count = "xwa2_newsletter_admin",
@@ -17,6 +18,7 @@ export declare enum QueryIds {
17
18
  UPDATE_METADATA = "24250201037901610",
18
19
  METADATA = "6563316087068696",
19
20
  SUBSCRIBERS = "9783111038412085",
21
+ SUBSCRIBED = "6388546374527196",
20
22
  FOLLOW = "7871414976211147",
21
23
  UNFOLLOW = "7238632346214362",
22
24
  MUTE = "29766401636284406",
@@ -2,6 +2,7 @@ export var XWAPaths;
2
2
  (function (XWAPaths) {
3
3
  XWAPaths["xwa2_newsletter_create"] = "xwa2_newsletter_create";
4
4
  XWAPaths["xwa2_newsletter_subscribers"] = "xwa2_newsletter_subscribers";
5
+ XWAPaths["xwa2_newsletter_subscribed"] = "xwa2_newsletter_subscribed";
5
6
  XWAPaths["xwa2_newsletter_view"] = "xwa2_newsletter_view";
6
7
  XWAPaths["xwa2_newsletter_metadata"] = "xwa2_newsletter";
7
8
  XWAPaths["xwa2_newsletter_admin_count"] = "xwa2_newsletter_admin";
@@ -21,6 +22,7 @@ export var QueryIds;
21
22
  QueryIds["UPDATE_METADATA"] = "24250201037901610";
22
23
  QueryIds["METADATA"] = "6563316087068696";
23
24
  QueryIds["SUBSCRIBERS"] = "9783111038412085";
25
+ QueryIds["SUBSCRIBED"] = "6388546374527196";
24
26
  QueryIds["FOLLOW"] = "7871414976211147";
25
27
  QueryIds["UNFOLLOW"] = "7238632346214362";
26
28
  QueryIds["MUTE"] = "29766401636284406";
@@ -791,6 +791,33 @@ 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
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aunubaileys",
3
3
  "type": "module",
4
- "version": "1.0.37",
4
+ "version": "1.0.39",
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",