n4lyx 3.0.4 → 3.0.6

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.
@@ -1,4 +1,12 @@
1
1
  "use strict";
2
+ // ─────────────────────────────────────────────────────────────────────────────
3
+ // Socket/chats.js — N4TZZ Fixed Edition
4
+ // Fixes:
5
+ // - profilePictureUrl: tidak crash saat 404 / item-not-found, return null
6
+ // - upsertMessage: dedup logic stable, tidak double-emit
7
+ // - syncState: transition logic lebih robust
8
+ // - semua privacy method: stable & tidak silent-fail
9
+ // ─────────────────────────────────────────────────────────────────────────────
2
10
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
11
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
12
  };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // ─────────────────────────────────────────────────────────────────────────────
3
- // Socket/groups.js — Fixed
4
- // Fixes: extractGroupMetadata robust, all group methods stable
3
+ // Socket/groups.js — N4TZZ Fixed + Extended Edition
4
+ // NEW: getJoinedGroups, getFollowedChannels, getAllContacts
5
5
  // ─────────────────────────────────────────────────────────────────────────────
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.extractGroupMetadata = exports.makeGroupsSocket = void 0;
@@ -17,46 +17,119 @@ const makeGroupsSocket = (config) => {
17
17
  const { authState, ev, query, upsertMessage } = sock;
18
18
 
19
19
  const groupQuery = async (jid, type, content) => query({
20
- tag: "iq",
21
- attrs: { type, xmlns: "w:g2", to: jid },
22
- content,
20
+ tag: "iq", attrs: { type, xmlns: "w:g2", to: jid }, content,
23
21
  });
24
22
 
25
23
  const groupMetadata = async (jid) => {
26
- const result = await groupQuery(jid, "get", [
27
- { tag: "query", attrs: { request: "interactive" } },
28
- ]);
24
+ const result = await groupQuery(jid, "get", [{ tag: "query", attrs: { request: "interactive" } }]);
29
25
  return (0, exports.extractGroupMetadata)(result);
30
26
  };
31
27
 
32
28
  const groupFetchAllParticipating = async () => {
33
29
  const result = await query({
34
- tag: "iq",
35
- attrs: { to: "@g.us", xmlns: "w:g2", type: "get" },
36
- content: [{
37
- tag: "participating",
38
- attrs: {},
39
- content: [
40
- { tag: "participants", attrs: {} },
41
- { tag: "description", attrs: {} },
42
- ],
43
- }],
30
+ tag: "iq", attrs: { to: "@g.us", xmlns: "w:g2", type: "get" },
31
+ content: [{ tag: "participating", attrs: {}, content: [{ tag: "participants", attrs: {} }, { tag: "description", attrs: {} }] }],
44
32
  });
45
- const data = {};
33
+ const data = {};
46
34
  const groupsChild = (0, WABinary_1.getBinaryNodeChild)(result, "groups");
47
35
  if (groupsChild) {
48
- const groups = (0, WABinary_1.getBinaryNodeChildren)(groupsChild, "group");
49
- for (const groupNode of groups) {
50
- const meta = (0, exports.extractGroupMetadata)({
51
- tag: "result", attrs: {}, content: [groupNode],
52
- });
53
- data[meta.id] = meta;
36
+ for (const groupNode of (0, WABinary_1.getBinaryNodeChildren)(groupsChild, "group")) {
37
+ const meta = (0, exports.extractGroupMetadata)({ tag: "result", attrs: {}, content: [groupNode] });
38
+ if (meta?.id) data[meta.id] = meta;
54
39
  }
55
40
  }
56
41
  sock.ev.emit("groups.update", Object.values(data));
57
42
  return data;
58
43
  };
59
44
 
45
+ // ─── NEW: Get all joined groups as clean array ────────────────────────────
46
+ const getJoinedGroups = async () => {
47
+ const all = await groupFetchAllParticipating();
48
+ return Object.values(all).map(g => ({
49
+ id: g.id,
50
+ name: g.subject || "Unnamed Group",
51
+ description: g.desc || "",
52
+ owner: g.owner || null,
53
+ memberCount: g.size || (g.participants?.length ?? 0),
54
+ participants: g.participants || [],
55
+ creation: g.creation || null,
56
+ announce: g.announce || false,
57
+ restrict: g.restrict || false,
58
+ isCommunity: g.isCommunity || false,
59
+ joinApprovalMode: g.joinApprovalMode || false,
60
+ ephemeralDuration: g.ephemeralDuration || null,
61
+ inviteCode: null, // fetch separately if needed
62
+ }));
63
+ };
64
+
65
+ // ─── NEW: Get all followed newsletter channels ────────────────────────────
66
+ const getFollowedChannels = async () => {
67
+ try {
68
+ const encoder = new TextEncoder();
69
+ const result = await query({
70
+ tag: "iq",
71
+ attrs: { id: sock.generateMessageTag?.() || Math.random().toString(36).slice(2), type: "get", xmlns: "w:mex", to: WABinary_1.S_WHATSAPP_NET },
72
+ content: [{
73
+ tag: "query",
74
+ attrs: { query_id: "9010885495661893" },
75
+ content: encoder.encode(JSON.stringify({ variables: { fetch_viewer_metadata: true, fetch_full_image: true } })),
76
+ }],
77
+ }).catch(() => null);
78
+ if (!result) return [];
79
+ const resultNode = (0, WABinary_1.getBinaryNodeChild)(result, "result");
80
+ const buff = resultNode?.content?.toString();
81
+ if (!buff) return [];
82
+ let parsed;
83
+ try { parsed = JSON.parse(buff); } catch { return []; }
84
+ const edges = parsed?.data?.xwa2_newsletter_subscriptions?.edges
85
+ || parsed?.data?.newsletter_subscriptions?.edges
86
+ || [];
87
+ return edges.map(edge => {
88
+ const node = edge?.node || edge;
89
+ const tm = node?.thread_metadata || {};
90
+ return {
91
+ id: node?.id || null,
92
+ name: tm?.name?.text || "Unknown Channel",
93
+ description: tm?.description?.text || "",
94
+ handle: tm?.handle || null,
95
+ subscribers: +(tm?.subscribers_count) || 0,
96
+ picture: tm?.picture?.direct_path || null,
97
+ preview: tm?.preview?.direct_path || null,
98
+ verification: tm?.verification || null,
99
+ invite: tm?.invite || null,
100
+ role: node?.viewer_metadata?.role || "SUBSCRIBER",
101
+ isMuted: (node?.viewer_metadata?.mute_expire_time || 0) > 0,
102
+ url: tm?.invite ? `https://whatsapp.com/channel/${tm.invite}` : null,
103
+ };
104
+ }).filter(c => c.id);
105
+ } catch (e) {
106
+ sock.logger?.warn?.("[getFollowedChannels]", e?.message);
107
+ return [];
108
+ }
109
+ };
110
+
111
+ // ─── NEW: Get all contacts from internal store ────────────────────────────
112
+ const getAllContacts = async () => {
113
+ try {
114
+ const raw = sock.store?.contacts || {};
115
+ const entries = Object.entries(raw);
116
+ if (!entries.length) return [];
117
+ return entries
118
+ .filter(([jid]) => jid.endsWith("@s.whatsapp.net"))
119
+ .map(([jid, c]) => ({
120
+ jid,
121
+ name: c.name || c.notify || null,
122
+ notify: c.notify || null,
123
+ verifiedName: c.verifiedName || null,
124
+ imgUrl: c.imgUrl || null,
125
+ status: c.status || null,
126
+ }));
127
+ } catch (e) {
128
+ sock.logger?.warn?.("[getAllContacts]", e?.message);
129
+ return [];
130
+ }
131
+ };
132
+
60
133
  sock.ws.on("CB:ib,,dirty", async (node) => {
61
134
  const { attrs } = (0, WABinary_1.getBinaryNodeChild)(node, "dirty");
62
135
  if (attrs.type !== "groups") return;
@@ -66,259 +139,86 @@ const makeGroupsSocket = (config) => {
66
139
 
67
140
  return {
68
141
  ...sock,
69
- groupQuery,
70
- groupMetadata,
142
+ groupQuery, groupMetadata,
143
+ getJoinedGroups, getFollowedChannels, getAllContacts,
71
144
 
72
145
  groupCreate: async (subject, participants) => {
73
- const key = (0, Utils_1.generateMessageIDV2)();
74
- const result = await groupQuery("@g.us", "set", [{
75
- tag: "create",
76
- attrs: { subject, key },
77
- content: participants.map(jid => ({
78
- tag: "participant", attrs: { jid },
79
- })),
80
- }]);
146
+ const result = await groupQuery("@g.us", "set", [{ tag: "create", attrs: { subject, key: (0, Utils_1.generateMessageIDV2)() }, content: participants.map(jid => ({ tag: "participant", attrs: { jid } })) }]);
81
147
  return (0, exports.extractGroupMetadata)(result);
82
148
  },
83
-
84
- groupLeave: async (id) => {
85
- await groupQuery("@g.us", "set", [{
86
- tag: "leave",
87
- attrs: {},
88
- content: [{ tag: "group", attrs: { id } }],
89
- }]);
90
- },
91
-
92
- groupUpdateSubject: async (jid, subject) => {
93
- await groupQuery(jid, "set", [{
94
- tag: "subject",
95
- attrs: {},
96
- content: Buffer.from(subject, "utf-8"),
97
- }]);
98
- },
99
-
149
+ groupLeave: async (id) => { await groupQuery("@g.us", "set", [{ tag: "leave", attrs: {}, content: [{ tag: "group", attrs: { id } }] }]); },
150
+ groupUpdateSubject: async (jid, subject) => { await groupQuery(jid, "set", [{ tag: "subject", attrs: {}, content: Buffer.from(subject, "utf-8") }]); },
100
151
  groupRequestParticipantsList: async (jid) => {
101
- const result = await groupQuery(jid, "get", [{
102
- tag: "membership_approval_requests", attrs: {},
103
- }]);
104
- const node = (0, WABinary_1.getBinaryNodeChild)(result, "membership_approval_requests");
105
- const participants = (0, WABinary_1.getBinaryNodeChildren)(node, "membership_approval_request");
106
- return participants.map(v => v.attrs);
152
+ const result = await groupQuery(jid, "get", [{ tag: "membership_approval_requests", attrs: {} }]);
153
+ return (0, WABinary_1.getBinaryNodeChildren)((0, WABinary_1.getBinaryNodeChild)(result, "membership_approval_requests"), "membership_approval_request").map(v => v.attrs);
107
154
  },
108
-
109
155
  groupRequestParticipantsUpdate: async (jid, participants, action) => {
110
- const result = await groupQuery(jid, "set", [{
111
- tag: "membership_requests_action",
112
- attrs: {},
113
- content: [{
114
- tag: action,
115
- attrs: {},
116
- content: participants.map(jid => ({
117
- tag: "participant", attrs: { jid },
118
- })),
119
- }],
120
- }]);
121
- const node = (0, WABinary_1.getBinaryNodeChild)(result, "membership_requests_action");
122
- const nodeAction = (0, WABinary_1.getBinaryNodeChild)(node, action);
123
- const participantsAffected = (0, WABinary_1.getBinaryNodeChildren)(nodeAction, "participant");
124
- return participantsAffected.map(p => ({
125
- status: p.attrs.error || "200",
126
- jid: p.attrs.jid,
127
- }));
156
+ const result = await groupQuery(jid, "set", [{ tag: "membership_requests_action", attrs: {}, content: [{ tag: action, attrs: {}, content: participants.map(jid => ({ tag: "participant", attrs: { jid } })) }] }]);
157
+ return (0, WABinary_1.getBinaryNodeChildren)((0, WABinary_1.getBinaryNodeChild)((0, WABinary_1.getBinaryNodeChild)(result, "membership_requests_action"), action), "participant").map(p => ({ status: p.attrs.error || "200", jid: p.attrs.jid }));
128
158
  },
129
-
130
159
  groupParticipantsUpdate: async (jid, participants, action) => {
131
- const result = await groupQuery(jid, "set", [{
132
- tag: action,
133
- attrs: {},
134
- content: participants.map(jid => ({
135
- tag: "participant", attrs: { jid },
136
- })),
137
- }]);
138
- const node = (0, WABinary_1.getBinaryNodeChild)(result, action);
139
- const participantsAffected = (0, WABinary_1.getBinaryNodeChildren)(node, "participant");
140
- return participantsAffected.map(p => ({
141
- status: p.attrs.error || "200",
142
- jid: p.attrs.jid,
143
- content: p,
144
- }));
160
+ const result = await groupQuery(jid, "set", [{ tag: action, attrs: {}, content: participants.map(jid => ({ tag: "participant", attrs: { jid } })) }]);
161
+ return (0, WABinary_1.getBinaryNodeChildren)((0, WABinary_1.getBinaryNodeChild)(result, action), "participant").map(p => ({ status: p.attrs.error || "200", jid: p.attrs.jid, content: p }));
145
162
  },
146
-
147
163
  groupUpdateDescription: async (jid, description) => {
148
164
  const metadata = await groupMetadata(jid);
149
- const prev = metadata.descId ?? null;
150
- await groupQuery(jid, "set", [{
151
- tag: "description",
152
- attrs: {
153
- ...(description ? { id: (0, Utils_1.generateMessageIDV2)() } : { delete: "true" }),
154
- ...(prev ? { prev } : {}),
155
- },
156
- content: description
157
- ? [{ tag: "body", attrs: {}, content: Buffer.from(description, "utf-8") }]
158
- : undefined,
159
- }]);
160
- },
161
-
162
- groupInviteCode: async (jid) => {
163
- const result = await groupQuery(jid, "get", [{ tag: "invite", attrs: {} }]);
164
- const inviteNode = (0, WABinary_1.getBinaryNodeChild)(result, "invite");
165
- return inviteNode?.attrs?.code;
165
+ await groupQuery(jid, "set", [{ tag: "description", attrs: { ...(description ? { id: (0, Utils_1.generateMessageIDV2)() } : { delete: "true" }), ...(metadata.descId ? { prev: metadata.descId } : {}) }, content: description ? [{ tag: "body", attrs: {}, content: Buffer.from(description, "utf-8") }] : undefined }]);
166
166
  },
167
-
168
- groupRevokeInvite: async (jid) => {
169
- const result = await groupQuery(jid, "set", [{ tag: "invite", attrs: {} }]);
170
- const inviteNode = (0, WABinary_1.getBinaryNodeChild)(result, "invite");
171
- return inviteNode?.attrs?.code;
172
- },
173
-
174
- groupAcceptInvite: async (code) => {
175
- const results = await groupQuery("@g.us", "set", [{ tag: "invite", attrs: { code } }]);
176
- const result = (0, WABinary_1.getBinaryNodeChild)(results, "group");
177
- return result?.attrs?.jid;
178
- },
179
-
180
- groupRevokeInviteV4: async (groupJid, invitedJid) => {
181
- const result = await groupQuery(groupJid, "set", [{
182
- tag: "revoke",
183
- attrs: {},
184
- content: [{ tag: "participant", attrs: { jid: invitedJid } }],
185
- }]);
186
- return !!result;
187
- },
188
-
167
+ groupInviteCode: async (jid) => (0, WABinary_1.getBinaryNodeChild)(await groupQuery(jid, "get", [{ tag: "invite", attrs: {} }]), "invite")?.attrs?.code,
168
+ groupRevokeInvite: async (jid) => (0, WABinary_1.getBinaryNodeChild)(await groupQuery(jid, "set", [{ tag: "invite", attrs: {} }]), "invite")?.attrs?.code,
169
+ groupAcceptInvite: async (code) => (0, WABinary_1.getBinaryNodeChild)(await groupQuery("@g.us", "set", [{ tag: "invite", attrs: { code } }]), "group")?.attrs?.jid,
170
+ groupRevokeInviteV4: async (groupJid, invitedJid) => !!(await groupQuery(groupJid, "set", [{ tag: "revoke", attrs: {}, content: [{ tag: "participant", attrs: { jid: invitedJid } }] }])),
189
171
  groupAcceptInviteV4: ev.createBufferedFunction(async (key, inviteMessage) => {
190
172
  key = typeof key === "string" ? { remoteJid: key } : key;
191
- const results = await groupQuery(inviteMessage.groupJid, "set", [{
192
- tag: "accept",
193
- attrs: {
194
- code: inviteMessage.inviteCode,
195
- expiration: inviteMessage.inviteExpiration.toString(),
196
- admin: key.remoteJid,
197
- },
198
- }]);
199
- if (key.id) {
200
- inviteMessage = WAProto_1.proto.Message.GroupInviteMessage.fromObject(inviteMessage);
201
- inviteMessage.inviteExpiration = 0;
202
- inviteMessage.inviteCode = "";
203
- ev.emit("messages.update", [{
204
- key,
205
- update: { message: { groupInviteMessage: inviteMessage } },
206
- }]);
207
- }
208
- await upsertMessage({
209
- key: {
210
- remoteJid: inviteMessage.groupJid,
211
- id: (0, Utils_1.generateMessageIDV2)(sock.user?.id),
212
- fromMe: false,
213
- participant: key.remoteJid,
214
- },
215
- messageStubType: Types_1.WAMessageStubType.GROUP_PARTICIPANT_ADD,
216
- messageStubParameters: [authState.creds.me.id],
217
- participant: key.remoteJid,
218
- messageTimestamp: (0, Utils_1.unixTimestampSeconds)(),
219
- }, "notify");
173
+ const results = await groupQuery(inviteMessage.groupJid, "set", [{ tag: "accept", attrs: { code: inviteMessage.inviteCode, expiration: inviteMessage.inviteExpiration.toString(), admin: key.remoteJid } }]);
174
+ if (key.id) { inviteMessage = WAProto_1.proto.Message.GroupInviteMessage.fromObject(inviteMessage); inviteMessage.inviteExpiration = 0; inviteMessage.inviteCode = ""; ev.emit("messages.update", [{ key, update: { message: { groupInviteMessage: inviteMessage } } }]); }
175
+ await upsertMessage({ key: { remoteJid: inviteMessage.groupJid, id: (0, Utils_1.generateMessageIDV2)(sock.user?.id), fromMe: false, participant: key.remoteJid }, messageStubType: Types_1.WAMessageStubType.GROUP_PARTICIPANT_ADD, messageStubParameters: [authState.creds.me.id], participant: key.remoteJid, messageTimestamp: (0, Utils_1.unixTimestampSeconds)() }, "notify");
220
176
  return results.attrs.from;
221
177
  }),
222
-
223
- groupGetInviteInfo: async (code) => {
224
- const results = await groupQuery("@g.us", "get", [{ tag: "invite", attrs: { code } }]);
225
- return (0, exports.extractGroupMetadata)(results);
226
- },
227
-
228
- groupToggleEphemeral: async (jid, ephemeralExpiration) => {
229
- const content = ephemeralExpiration
230
- ? { tag: "ephemeral", attrs: { expiration: ephemeralExpiration.toString() } }
231
- : { tag: "not_ephemeral", attrs: {} };
232
- await groupQuery(jid, "set", [content]);
233
- },
234
-
235
- groupSettingUpdate: async (jid, setting) => {
236
- await groupQuery(jid, "set", [{ tag: setting, attrs: {} }]);
237
- },
238
-
239
- groupMemberAddMode: async (jid, mode) => {
240
- await groupQuery(jid, "set", [{
241
- tag: "member_add_mode", attrs: {}, content: mode,
242
- }]);
243
- },
244
-
245
- groupJoinApprovalMode: async (jid, mode) => {
246
- await groupQuery(jid, "set", [{
247
- tag: "membership_approval_mode",
248
- attrs: {},
249
- content: [{ tag: "group_join", attrs: { state: mode } }],
250
- }]);
251
- },
252
-
178
+ groupGetInviteInfo: async (code) => (0, exports.extractGroupMetadata)(await groupQuery("@g.us", "get", [{ tag: "invite", attrs: { code } }])),
179
+ groupToggleEphemeral: async (jid, exp) => { await groupQuery(jid, "set", [exp ? { tag: "ephemeral", attrs: { expiration: exp.toString() } } : { tag: "not_ephemeral", attrs: {} }]); },
180
+ groupSettingUpdate: async (jid, setting) => { await groupQuery(jid, "set", [{ tag: setting, attrs: {} }]); },
181
+ groupMemberAddMode: async (jid, mode) => { await groupQuery(jid, "set", [{ tag: "member_add_mode", attrs: {}, content: mode }]); },
182
+ groupJoinApprovalMode: async (jid, mode) => { await groupQuery(jid, "set", [{ tag: "membership_approval_mode", attrs: {}, content: [{ tag: "group_join", attrs: { state: mode } }] }]); },
253
183
  groupFetchAllParticipating,
254
184
  };
255
185
  };
256
-
257
186
  exports.makeGroupsSocket = makeGroupsSocket;
258
187
 
259
- // ─── extractGroupMetadata ─────────────────────────────────────────────────────
260
188
  const extractGroupMetadata = (result) => {
261
- const group = (0, WABinary_1.getBinaryNodeChild)(result, "group");
189
+ const group = (0, WABinary_1.getBinaryNodeChild)(result, "group");
262
190
  if (!group) return {};
263
-
264
191
  const descChild = (0, WABinary_1.getBinaryNodeChild)(group, "description");
265
192
  let desc, descId, descOwner, descOwnerLid, descTime;
266
-
267
193
  if (descChild) {
268
- desc = (0, WABinary_1.getBinaryNodeChildString)(descChild, "body");
269
- descOwner = (0, WABinary_1.jidNormalizedUser)(
270
- descChild.attrs.participant_pn || descChild.attrs.participant
271
- );
272
- if (group.attrs.addressing_mode === "lid") {
273
- descOwnerLid = (0, WABinary_1.jidNormalizedUser)(descChild.attrs.participant);
274
- }
275
- descId = descChild.attrs.id;
194
+ desc = (0, WABinary_1.getBinaryNodeChildString)(descChild, "body");
195
+ descOwner = (0, WABinary_1.jidNormalizedUser)(descChild.attrs.participant_pn || descChild.attrs.participant);
196
+ if (group.attrs.addressing_mode === "lid") descOwnerLid = (0, WABinary_1.jidNormalizedUser)(descChild.attrs.participant);
197
+ descId = descChild.attrs.id;
276
198
  descTime = descChild.attrs.t ? +descChild.attrs.t : undefined;
277
199
  }
278
-
279
- const groupSize = group.attrs.size ? Number(group.attrs.size) : undefined;
280
- const groupId = group.attrs.id?.includes("@")
281
- ? group.attrs.id
282
- : (0, WABinary_1.jidEncode)(group.attrs.id, "g.us");
283
-
284
- const eph = (0, WABinary_1.getBinaryNodeChild)(group, "ephemeral")?.attrs?.expiration;
285
- const memberAddMode = (0, WABinary_1.getBinaryNodeChildString)(group, "member_add_mode") === "all_member_add";
286
-
200
+ const groupId = group.attrs.id?.includes("@") ? group.attrs.id : (0, WABinary_1.jidEncode)(group.attrs.id, "g.us");
201
+ const eph = (0, WABinary_1.getBinaryNodeChild)(group, "ephemeral")?.attrs?.expiration;
287
202
  return {
288
- id: groupId,
289
- addressingMode: group.attrs.addressing_mode,
290
- subject: group.attrs.subject,
291
- subjectOwner: (0, WABinary_1.jidNormalizedUser)(group.attrs.s_o_pn || group.attrs.s_o),
292
- ...(group.attrs.addressing_mode === "lid"
293
- ? { subjectOwnerLid: (0, WABinary_1.jidNormalizedUser)(group.attrs.s_o) }
294
- : {}),
295
- subjectTime: group.attrs.s_t ? +group.attrs.s_t : undefined,
296
- size: groupSize || (0, WABinary_1.getBinaryNodeChildren)(group, "participant").length,
297
- creation: group.attrs.creation ? +group.attrs.creation : undefined,
298
- owner: (0, WABinary_1.jidNormalizedUser)(group.attrs.creator_pn || group.attrs.creator),
299
- ...(group.attrs.addressing_mode === "lid"
300
- ? { ownerLid: (0, WABinary_1.jidNormalizedUser)(group.attrs.creator) }
301
- : {}),
302
- desc,
303
- descId,
304
- descOwner,
305
- descOwnerLid,
306
- descTime,
307
- linkedParent: (0, WABinary_1.getBinaryNodeChild)(group, "linked_parent")?.attrs?.jid || undefined,
308
- restrict: !!(0, WABinary_1.getBinaryNodeChild)(group, "locked"),
309
- announce: !!(0, WABinary_1.getBinaryNodeChild)(group, "announcement"),
310
- isCommunity: !!(0, WABinary_1.getBinaryNodeChild)(group, "parent"),
203
+ id: groupId, addressingMode: group.attrs.addressing_mode,
204
+ subject: group.attrs.subject,
205
+ subjectOwner: (0, WABinary_1.jidNormalizedUser)(group.attrs.s_o_pn || group.attrs.s_o),
206
+ ...(group.attrs.addressing_mode === "lid" ? { subjectOwnerLid: (0, WABinary_1.jidNormalizedUser)(group.attrs.s_o) } : {}),
207
+ subjectTime: group.attrs.s_t ? +group.attrs.s_t : undefined,
208
+ size: group.attrs.size ? Number(group.attrs.size) : (0, WABinary_1.getBinaryNodeChildren)(group, "participant").length,
209
+ creation: group.attrs.creation ? +group.attrs.creation : undefined,
210
+ owner: (0, WABinary_1.jidNormalizedUser)(group.attrs.creator_pn || group.attrs.creator),
211
+ ...(group.attrs.addressing_mode === "lid" ? { ownerLid: (0, WABinary_1.jidNormalizedUser)(group.attrs.creator) } : {}),
212
+ desc, descId, descOwner, descOwnerLid, descTime,
213
+ linkedParent: (0, WABinary_1.getBinaryNodeChild)(group, "linked_parent")?.attrs?.jid || undefined,
214
+ restrict: !!(0, WABinary_1.getBinaryNodeChild)(group, "locked"),
215
+ announce: !!(0, WABinary_1.getBinaryNodeChild)(group, "announcement"),
216
+ isCommunity: !!(0, WABinary_1.getBinaryNodeChild)(group, "parent"),
311
217
  isCommunityAnnounce: !!(0, WABinary_1.getBinaryNodeChild)(group, "default_sub_group"),
312
218
  joinApprovalMode: !!(0, WABinary_1.getBinaryNodeChild)(group, "membership_approval_mode"),
313
- memberAddMode,
314
- participants: (0, WABinary_1.getBinaryNodeChildren)(group, "participant").map(({ attrs }) => ({
315
- id: attrs.jid,
316
- jid: attrs.phone_number || attrs.jid,
317
- lid: attrs.lid || attrs.jid,
318
- admin: attrs.type || null,
319
- })),
219
+ memberAddMode: (0, WABinary_1.getBinaryNodeChildString)(group, "member_add_mode") === "all_member_add",
220
+ participants: (0, WABinary_1.getBinaryNodeChildren)(group, "participant").map(({ attrs }) => ({ id: attrs.jid, jid: attrs.phone_number || attrs.jid, lid: attrs.lid || attrs.jid, admin: attrs.type || null })),
320
221
  ephemeralDuration: eph ? +eph : undefined,
321
222
  };
322
223
  };
323
-
324
224
  exports.extractGroupMetadata = extractGroupMetadata;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  // ─────────────────────────────────────────────────────────────────────────────
3
- // Socket/newsletter.js — Fixed
3
+ // Socket/newsletter.js — N4TZZ Fixed Edition
4
4
  // Fixes: parseFetchedUpdates robust, all newsletter methods stable
5
5
  // ─────────────────────────────────────────────────────────────────────────────
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n4lyx",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "N4lyx - WhatsApp Web API Library powered by N4tzzOfficial",
5
5
  "keywords": [
6
6
  "n4lyx",