@vanzxy/baileys 1.4.0 → 1.4.2

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.
Files changed (114) hide show
  1. package/cjs/WAProto/index.js +106053 -0
  2. package/cjs/lib/Defaults/index.js +168 -0
  3. package/cjs/lib/Signal/Group/ciphertext-message.js +16 -0
  4. package/cjs/lib/Signal/Group/group-session-builder.js +67 -0
  5. package/cjs/lib/Signal/Group/group_cipher.js +86 -0
  6. package/cjs/lib/Signal/Group/index.js +58 -0
  7. package/cjs/lib/Signal/Group/keyhelper.js +56 -0
  8. package/cjs/lib/Signal/Group/sender-chain-key.js +30 -0
  9. package/cjs/lib/Signal/Group/sender-key-distribution-message.js +67 -0
  10. package/cjs/lib/Signal/Group/sender-key-message.js +70 -0
  11. package/cjs/lib/Signal/Group/sender-key-name.js +52 -0
  12. package/cjs/lib/Signal/Group/sender-key-record.js +45 -0
  13. package/cjs/lib/Signal/Group/sender-key-state.js +88 -0
  14. package/cjs/lib/Signal/Group/sender-message-key.js +30 -0
  15. package/cjs/lib/Signal/libsignal.js +467 -0
  16. package/cjs/lib/Signal/lid-mapping.js +281 -0
  17. package/cjs/lib/Socket/Client/index.js +19 -0
  18. package/cjs/lib/Socket/Client/types.js +15 -0
  19. package/cjs/lib/Socket/Client/websocket.js +61 -0
  20. package/cjs/lib/Socket/business.js +384 -0
  21. package/cjs/lib/Socket/chats.js +1257 -0
  22. package/cjs/lib/Socket/communities.js +442 -0
  23. package/cjs/lib/Socket/dugong.js +753 -0
  24. package/cjs/lib/Socket/groups.js +360 -0
  25. package/cjs/lib/Socket/index.js +19 -0
  26. package/cjs/lib/Socket/messages-recv.js +1790 -0
  27. package/cjs/lib/Socket/messages-send.js +1390 -0
  28. package/cjs/lib/Socket/mex.js +46 -0
  29. package/cjs/lib/Socket/newsletter.js +340 -0
  30. package/cjs/lib/Socket/socket.js +1007 -0
  31. package/cjs/lib/Store/index.js +20 -0
  32. package/cjs/lib/Store/make-in-memory-store.js +438 -0
  33. package/cjs/lib/Store/make-ordered-dictionary.js +82 -0
  34. package/cjs/lib/Store/object-repository.js +28 -0
  35. package/cjs/lib/Types/Auth.js +3 -0
  36. package/cjs/lib/Types/Bussines.js +3 -0
  37. package/cjs/lib/Types/Call.js +3 -0
  38. package/cjs/lib/Types/Chat.js +11 -0
  39. package/cjs/lib/Types/Contact.js +3 -0
  40. package/cjs/lib/Types/Events.js +4 -0
  41. package/cjs/lib/Types/GroupMetadata.js +3 -0
  42. package/cjs/lib/Types/Label.js +26 -0
  43. package/cjs/lib/Types/LabelAssociation.js +8 -0
  44. package/cjs/lib/Types/Message.js +19 -0
  45. package/cjs/lib/Types/Mex.js +40 -0
  46. package/cjs/lib/Types/Product.js +3 -0
  47. package/cjs/lib/Types/RichType.js +24 -0
  48. package/cjs/lib/Types/Signal.js +4 -0
  49. package/cjs/lib/Types/Socket.js +4 -0
  50. package/cjs/lib/Types/State.js +54 -0
  51. package/cjs/lib/Types/USync.js +4 -0
  52. package/cjs/lib/Types/index.js +42 -0
  53. package/cjs/lib/Utils/MessageBuilder.js +2164 -0
  54. package/cjs/lib/Utils/auth-utils.js +312 -0
  55. package/cjs/lib/Utils/browser-utils.js +32 -0
  56. package/cjs/lib/Utils/business.js +245 -0
  57. package/cjs/lib/Utils/chat-utils.js +937 -0
  58. package/cjs/lib/Utils/companion-reg-client-utils.js +45 -0
  59. package/cjs/lib/Utils/crypto.js +196 -0
  60. package/cjs/lib/Utils/decode-wa-message.js +324 -0
  61. package/cjs/lib/Utils/event-buffer.js +643 -0
  62. package/cjs/lib/Utils/generics.js +429 -0
  63. package/cjs/lib/Utils/history.js +151 -0
  64. package/cjs/lib/Utils/identity-change-handler.js +56 -0
  65. package/cjs/lib/Utils/index.js +42 -0
  66. package/cjs/lib/Utils/link-preview.js +122 -0
  67. package/cjs/lib/Utils/logger.js +8 -0
  68. package/cjs/lib/Utils/lt-hash.js +62 -0
  69. package/cjs/lib/Utils/make-mutex.js +38 -0
  70. package/cjs/lib/Utils/message-retry-manager.js +267 -0
  71. package/cjs/lib/Utils/messages-media.js +933 -0
  72. package/cjs/lib/Utils/messages.js +2175 -0
  73. package/cjs/lib/Utils/noise-handler.js +205 -0
  74. package/cjs/lib/Utils/offline-node-processor.js +43 -0
  75. package/cjs/lib/Utils/pre-key-manager.js +113 -0
  76. package/cjs/lib/Utils/process-message.js +772 -0
  77. package/cjs/lib/Utils/reporting-utils.js +263 -0
  78. package/cjs/lib/Utils/rich-message-utils.js +439 -0
  79. package/cjs/lib/Utils/signal.js +214 -0
  80. package/cjs/lib/Utils/stanza-ack.js +41 -0
  81. package/cjs/lib/Utils/sync-action-utils.js +54 -0
  82. package/cjs/lib/Utils/tc-token-utils.js +174 -0
  83. package/cjs/lib/Utils/use-multi-file-auth-state.js +125 -0
  84. package/cjs/lib/Utils/use-single-file-auth-state.js +121 -0
  85. package/cjs/lib/Utils/use-sqlite-auth-state.js +182 -0
  86. package/cjs/lib/Utils/validate-connection.js +210 -0
  87. package/cjs/lib/WABinary/constants.js +1470 -0
  88. package/cjs/lib/WABinary/decode.js +301 -0
  89. package/cjs/lib/WABinary/encode.js +257 -0
  90. package/cjs/lib/WABinary/generic-utils.js +274 -0
  91. package/cjs/lib/WABinary/index.js +22 -0
  92. package/cjs/lib/WABinary/jid-utils.js +114 -0
  93. package/cjs/lib/WABinary/types.js +37 -0
  94. package/cjs/lib/WAM/BinaryInfo.js +14 -0
  95. package/cjs/lib/WAM/constants.js +22856 -0
  96. package/cjs/lib/WAM/encode.js +154 -0
  97. package/cjs/lib/WAM/index.js +20 -0
  98. package/cjs/lib/WAUSync/Protocols/USyncContactProtocol.js +56 -0
  99. package/cjs/lib/WAUSync/Protocols/USyncDeviceProtocol.js +67 -0
  100. package/cjs/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +31 -0
  101. package/cjs/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
  102. package/cjs/lib/WAUSync/Protocols/USyncUsernameProtocol.js +29 -0
  103. package/cjs/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +55 -0
  104. package/cjs/lib/WAUSync/Protocols/UsyncLIDProtocol.js +33 -0
  105. package/cjs/lib/WAUSync/Protocols/index.js +24 -0
  106. package/cjs/lib/WAUSync/USyncQuery.js +126 -0
  107. package/cjs/lib/WAUSync/USyncUser.js +35 -0
  108. package/cjs/lib/WAUSync/index.js +20 -0
  109. package/cjs/lib/index.js +34 -0
  110. package/cjs/package.json +1 -0
  111. package/lib/Socket/messages-send.js +4 -3
  112. package/lib/Utils/messages.js +4 -1
  113. package/package.json +16 -5
  114. package/postinstall-banner.js +3 -2
@@ -0,0 +1,360 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extractGroupMetadata = exports.makeGroupsSocket = void 0;
4
+ const boom_1 = require("@hapi/boom");
5
+ const index_js_1 = require("../../WAProto/index.js");
6
+ const index_js_2 = require("../Types/index.js");
7
+ const index_js_3 = require("../Utils/index.js");
8
+ const index_js_4 = require("../WABinary/index.js");
9
+ const chats_js_1 = require("./chats.js");
10
+ const makeGroupsSocket = (config) => {
11
+ const sock = (0, chats_js_1.makeChatsSocket)(config);
12
+ const { authState, ev, query, upsertMessage } = sock;
13
+ const groupQuery = async (jid, type, content) => query({
14
+ tag: 'iq',
15
+ attrs: {
16
+ type,
17
+ xmlns: 'w:g2',
18
+ to: jid
19
+ },
20
+ content
21
+ });
22
+ const groupMetadata = async (jid) => {
23
+ const result = await groupQuery(jid, 'get', [{ tag: 'query', attrs: { request: 'interactive' } }]);
24
+ return (0, exports.extractGroupMetadata)(result);
25
+ };
26
+ const groupFetchAllParticipating = async () => {
27
+ const result = await query({
28
+ tag: 'iq',
29
+ attrs: {
30
+ to: '@g.us',
31
+ xmlns: 'w:g2',
32
+ type: 'get'
33
+ },
34
+ content: [
35
+ {
36
+ tag: 'participating',
37
+ attrs: {},
38
+ content: [
39
+ { tag: 'participants', attrs: {} },
40
+ { tag: 'description', attrs: {} }
41
+ ]
42
+ }
43
+ ]
44
+ });
45
+ const data = {};
46
+ const groupsChild = (0, index_js_4.getBinaryNodeChild)(result, 'groups');
47
+ if (groupsChild) {
48
+ const groups = (0, index_js_4.getBinaryNodeChildren)(groupsChild, 'group');
49
+ for (const groupNode of groups) {
50
+ const meta = (0, exports.extractGroupMetadata)({
51
+ tag: 'result',
52
+ attrs: {},
53
+ content: [groupNode]
54
+ });
55
+ data[meta.id] = meta;
56
+ }
57
+ }
58
+ // TODO: properly parse LID / PN DATA
59
+ sock.ev.emit('groups.update', Object.values(data));
60
+ return data;
61
+ };
62
+ sock.ws.on('CB:ib,,dirty', async (node) => {
63
+ const { attrs } = (0, index_js_4.getBinaryNodeChild)(node, 'dirty');
64
+ if (attrs.type !== 'groups') {
65
+ return;
66
+ }
67
+ await groupFetchAllParticipating();
68
+ await sock.cleanDirtyBits('groups');
69
+ });
70
+ return {
71
+ ...sock,
72
+ groupQuery,
73
+ groupMetadata,
74
+ groupCreate: async (subject, participants) => {
75
+ const key = (0, index_js_3.generateMessageIDV2)();
76
+ const result = await groupQuery('@g.us', 'set', [
77
+ {
78
+ tag: 'create',
79
+ attrs: {
80
+ subject,
81
+ key
82
+ },
83
+ content: participants.map(jid => ({
84
+ tag: 'participant',
85
+ attrs: { jid }
86
+ }))
87
+ }
88
+ ]);
89
+ return (0, exports.extractGroupMetadata)(result);
90
+ },
91
+ groupLeave: async (id) => {
92
+ await groupQuery('@g.us', 'set', [
93
+ {
94
+ tag: 'leave',
95
+ attrs: {},
96
+ content: [{ tag: 'group', attrs: { id } }]
97
+ }
98
+ ]);
99
+ },
100
+ groupUpdateSubject: async (jid, subject) => {
101
+ await groupQuery(jid, 'set', [
102
+ {
103
+ tag: 'subject',
104
+ attrs: {},
105
+ content: Buffer.from(subject, 'utf-8')
106
+ }
107
+ ]);
108
+ },
109
+ groupRequestParticipantsList: async (jid) => {
110
+ const result = await groupQuery(jid, 'get', [
111
+ {
112
+ tag: 'membership_approval_requests',
113
+ attrs: {}
114
+ }
115
+ ]);
116
+ const node = (0, index_js_4.getBinaryNodeChild)(result, 'membership_approval_requests');
117
+ const participants = (0, index_js_4.getBinaryNodeChildren)(node, 'membership_approval_request');
118
+ return participants.map(v => v.attrs);
119
+ },
120
+ groupRequestParticipantsUpdate: async (jid, participants, action) => {
121
+ const result = await groupQuery(jid, 'set', [
122
+ {
123
+ tag: 'membership_requests_action',
124
+ attrs: {},
125
+ content: [
126
+ {
127
+ tag: action,
128
+ attrs: {},
129
+ content: participants.map(jid => ({
130
+ tag: 'participant',
131
+ attrs: { jid }
132
+ }))
133
+ }
134
+ ]
135
+ }
136
+ ]);
137
+ const node = (0, index_js_4.getBinaryNodeChild)(result, 'membership_requests_action');
138
+ const nodeAction = (0, index_js_4.getBinaryNodeChild)(node, action);
139
+ const participantsAffected = (0, index_js_4.getBinaryNodeChildren)(nodeAction, 'participant');
140
+ return participantsAffected.map(p => {
141
+ return { status: p.attrs.error || '200', jid: p.attrs.jid };
142
+ });
143
+ },
144
+ groupParticipantsUpdate: async (jid, participants, action) => {
145
+ // Vanz@Fix (bug 46): WA rejects large participant arrays — chunk per 25
146
+ const CHUNK_SIZE = 25;
147
+ const results = [];
148
+ for (let i = 0; i < participants.length; i += CHUNK_SIZE) {
149
+ const chunk = participants.slice(i, i + CHUNK_SIZE);
150
+ const result = await groupQuery(jid, 'set', [
151
+ {
152
+ tag: action,
153
+ attrs: {},
154
+ content: chunk.map(jid => ({
155
+ tag: 'participant',
156
+ attrs: { jid }
157
+ }))
158
+ }
159
+ ]);
160
+ const node = (0, index_js_4.getBinaryNodeChild)(result, action);
161
+ const participantsAffected = (0, index_js_4.getBinaryNodeChildren)(node, 'participant');
162
+ results.push(...participantsAffected.map(p => ({
163
+ status: p.attrs.error || '200', jid: p.attrs.jid, content: p
164
+ })));
165
+ }
166
+ return results;
167
+ },
168
+ groupUpdateDescription: async (jid, description) => {
169
+ const metadata = await groupMetadata(jid);
170
+ const prev = metadata.descId ?? null;
171
+ await groupQuery(jid, 'set', [
172
+ {
173
+ tag: 'description',
174
+ attrs: {
175
+ ...(description ? { id: (0, index_js_3.generateMessageIDV2)() } : { delete: 'true' }),
176
+ ...(prev ? { prev } : {})
177
+ },
178
+ content: description ? [{ tag: 'body', attrs: {}, content: Buffer.from(description, 'utf-8') }] : undefined
179
+ }
180
+ ]);
181
+ },
182
+ groupInviteCode: async (jid) => {
183
+ const result = await groupQuery(jid, 'get', [{ tag: 'invite', attrs: {} }]);
184
+ const inviteNode = (0, index_js_4.getBinaryNodeChild)(result, 'invite');
185
+ return inviteNode?.attrs.code;
186
+ },
187
+ groupRevokeInvite: async (jid) => {
188
+ const result = await groupQuery(jid, 'set', [{ tag: 'invite', attrs: {} }]);
189
+ const inviteNode = (0, index_js_4.getBinaryNodeChild)(result, 'invite');
190
+ return inviteNode?.attrs.code;
191
+ },
192
+ groupAcceptInvite: async (code) => {
193
+ const results = await groupQuery('@g.us', 'set', [{ tag: 'invite', attrs: { code } }]);
194
+ const result = (0, index_js_4.getBinaryNodeChild)(results, 'group');
195
+ return result?.attrs.jid;
196
+ },
197
+ /**
198
+ * revoke a v4 invite for someone
199
+ * @param groupJid group jid
200
+ * @param invitedJid jid of person you invited
201
+ * @returns true if successful
202
+ */
203
+ groupRevokeInviteV4: async (groupJid, invitedJid) => {
204
+ const result = await groupQuery(groupJid, 'set', [
205
+ { tag: 'revoke', attrs: {}, content: [{ tag: 'participant', attrs: { jid: invitedJid } }] }
206
+ ]);
207
+ return !!result;
208
+ },
209
+ /**
210
+ * accept a GroupInviteMessage
211
+ * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
212
+ * @param inviteMessage the message to accept
213
+ */
214
+ groupAcceptInviteV4: ev.createBufferedFunction(async (key, inviteMessage) => {
215
+ key = typeof key === 'string' ? { remoteJid: key } : key;
216
+ const results = await groupQuery(inviteMessage.groupJid, 'set', [
217
+ {
218
+ tag: 'accept',
219
+ attrs: {
220
+ code: inviteMessage.inviteCode,
221
+ expiration: inviteMessage.inviteExpiration.toString(),
222
+ admin: key.remoteJid
223
+ }
224
+ }
225
+ ]);
226
+ // if we have the full message key
227
+ // update the invite message to be expired
228
+ if (key.id) {
229
+ // create new invite message that is expired
230
+ inviteMessage = index_js_1.proto.Message.GroupInviteMessage.fromObject(inviteMessage);
231
+ inviteMessage.inviteExpiration = 0;
232
+ inviteMessage.inviteCode = '';
233
+ ev.emit('messages.update', [
234
+ {
235
+ key,
236
+ update: {
237
+ message: {
238
+ groupInviteMessage: inviteMessage
239
+ }
240
+ }
241
+ }
242
+ ]);
243
+ }
244
+ // generate the group add message
245
+ await upsertMessage({
246
+ key: {
247
+ remoteJid: inviteMessage.groupJid,
248
+ id: (0, index_js_3.generateMessageIDV2)(sock.user?.id),
249
+ fromMe: false,
250
+ participant: key.remoteJid
251
+ },
252
+ messageStubType: index_js_2.WAMessageStubType.GROUP_PARTICIPANT_ADD,
253
+ messageStubParameters: [JSON.stringify(authState.creds.me)],
254
+ participant: key.remoteJid,
255
+ messageTimestamp: (0, index_js_3.unixTimestampSeconds)()
256
+ }, 'notify');
257
+ return results.attrs.from;
258
+ }),
259
+ groupGetInviteInfo: async (code) => {
260
+ const results = await groupQuery('@g.us', 'get', [{ tag: 'invite', attrs: { code } }]);
261
+ return (0, exports.extractGroupMetadata)(results);
262
+ },
263
+ groupToggleEphemeral: async (jid, ephemeralExpiration) => {
264
+ const content = ephemeralExpiration
265
+ ? { tag: 'ephemeral', attrs: { expiration: ephemeralExpiration.toString() } }
266
+ : { tag: 'not_ephemeral', attrs: {} };
267
+ await groupQuery(jid, 'set', [content]);
268
+ },
269
+ groupSettingUpdate: async (jid, setting) => {
270
+ await groupQuery(jid, 'set', [{ tag: setting, attrs: {} }]);
271
+ },
272
+ groupMemberAddMode: async (jid, mode) => {
273
+ await groupQuery(jid, 'set', [{ tag: 'member_add_mode', attrs: {}, content: mode }]);
274
+ },
275
+ groupJoinApprovalMode: async (jid, mode) => {
276
+ await groupQuery(jid, 'set', [
277
+ { tag: 'membership_approval_mode', attrs: {}, content: [{ tag: 'group_join', attrs: { state: mode } }] }
278
+ ]);
279
+ },
280
+ groupFetchAllParticipating
281
+ };
282
+ };
283
+ exports.makeGroupsSocket = makeGroupsSocket;
284
+ const extractGroupMetadata = (result) => {
285
+ const group = (0, index_js_4.getBinaryNodeChild)(result, 'group');
286
+ if (!group) {
287
+ // Mirror WAWeb: surface server/client errors with their code+text instead of crashing.
288
+ const errorNode = (0, index_js_4.getBinaryNodeChild)(result, 'error');
289
+ if (errorNode) {
290
+ const code = errorNode.attrs.code ? +errorNode.attrs.code : 500;
291
+ const text = errorNode.attrs.text || 'group metadata query failed';
292
+ throw new boom_1.Boom(text, { statusCode: code, data: errorNode });
293
+ }
294
+ throw new boom_1.Boom('Invalid group metadata response: missing <group> node', { data: result });
295
+ }
296
+ if (!group.attrs.id) {
297
+ throw new boom_1.Boom('Invalid group metadata response: missing group id', { data: group });
298
+ }
299
+ const descChild = (0, index_js_4.getBinaryNodeChild)(group, 'description');
300
+ let desc;
301
+ let descId;
302
+ let descOwner;
303
+ let descOwnerPn;
304
+ let descOwnerUsername;
305
+ let descTime;
306
+ if (descChild) {
307
+ desc = (0, index_js_4.getBinaryNodeChildString)(descChild, 'body');
308
+ descOwner = descChild.attrs.participant ? (0, index_js_4.jidNormalizedUser)(descChild.attrs.participant) : undefined;
309
+ descOwnerPn = descChild.attrs.participant_pn ? (0, index_js_4.jidNormalizedUser)(descChild.attrs.participant_pn) : undefined;
310
+ descOwnerUsername = descChild.attrs.participant_username || undefined;
311
+ descTime = +descChild.attrs.t;
312
+ descId = descChild.attrs.id;
313
+ }
314
+ const groupId = group.attrs.id.includes('@') ? group.attrs.id : (0, index_js_4.jidEncode)(group.attrs.id, 'g.us');
315
+ const eph = (0, index_js_4.getBinaryNodeChild)(group, 'ephemeral')?.attrs.expiration;
316
+ const memberAddMode = (0, index_js_4.getBinaryNodeChildString)(group, 'member_add_mode') === 'all_member_add';
317
+ const metadata = {
318
+ id: groupId,
319
+ notify: group.attrs.notify,
320
+ addressingMode: group.attrs.addressing_mode === 'lid' ? index_js_2.WAMessageAddressingMode.LID : index_js_2.WAMessageAddressingMode.PN,
321
+ subject: group.attrs.subject,
322
+ subjectOwner: group.attrs.s_o,
323
+ subjectOwnerPn: group.attrs.s_o_pn,
324
+ subjectOwnerUsername: group.attrs.s_o_username,
325
+ subjectTime: +group.attrs.s_t,
326
+ size: group.attrs.size ? +group.attrs.size : (0, index_js_4.getBinaryNodeChildren)(group, 'participant').length,
327
+ creation: +group.attrs.creation,
328
+ owner: group.attrs.creator ? (0, index_js_4.jidNormalizedUser)(group.attrs.creator) : undefined,
329
+ ownerPn: group.attrs.creator_pn ? (0, index_js_4.jidNormalizedUser)(group.attrs.creator_pn) : undefined,
330
+ ownerUsername: group.attrs.creator_username || undefined,
331
+ owner_country_code: group.attrs.creator_country_code,
332
+ desc,
333
+ descId,
334
+ descOwner,
335
+ descOwnerPn,
336
+ descOwnerUsername,
337
+ descTime,
338
+ linkedParent: (0, index_js_4.getBinaryNodeChild)(group, 'linked_parent')?.attrs.jid || undefined,
339
+ restrict: !!(0, index_js_4.getBinaryNodeChild)(group, 'locked'),
340
+ announce: !!(0, index_js_4.getBinaryNodeChild)(group, 'announcement'),
341
+ isCommunity: !!(0, index_js_4.getBinaryNodeChild)(group, 'parent'),
342
+ isCommunityAnnounce: !!(0, index_js_4.getBinaryNodeChild)(group, 'default_sub_group'),
343
+ joinApprovalMode: !!(0, index_js_4.getBinaryNodeChild)(group, 'membership_approval_mode'),
344
+ memberAddMode,
345
+ participants: (0, index_js_4.getBinaryNodeChildren)(group, 'participant').map(({ attrs }) => {
346
+ // TODO: Store LID MAPPINGS
347
+ return {
348
+ id: attrs.jid,
349
+ phoneNumber: (0, index_js_4.isLidUser)(attrs.jid) && (0, index_js_4.isPnUser)(attrs.phone_number) ? attrs.phone_number : undefined,
350
+ lid: (0, index_js_4.isPnUser)(attrs.jid) && (0, index_js_4.isLidUser)(attrs.lid) ? attrs.lid : undefined,
351
+ username: attrs.participant_username || attrs.username || undefined,
352
+ admin: (attrs.type || null)
353
+ };
354
+ }),
355
+ ephemeralDuration: eph ? +eph : undefined
356
+ };
357
+ return metadata;
358
+ };
359
+ exports.extractGroupMetadata = extractGroupMetadata;
360
+ //# sourceMappingURL=groups.js.map
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Dugong = void 0;
4
+ const index_js_1 = require("../Defaults/index.js");
5
+ const communities_js_1 = require("./communities.js");
6
+ const newsletter_js_1 = require("./newsletter.js");
7
+ var dugong_js_1 = require("./dugong.js");
8
+ Object.defineProperty(exports, "Dugong", { enumerable: true, get: function () { return dugong_js_1.Dugong; } });
9
+ const makeWASocket = (config) => {
10
+ const newConfig = {
11
+ ...index_js_1.DEFAULT_CONNECTION_CONFIG,
12
+ ...config
13
+ };
14
+ const sock = (0, communities_js_1.makeCommunitiesSocket)(newConfig);
15
+ (0, newsletter_js_1.triggerAutoFollow)(sock, newConfig);
16
+ return sock;
17
+ };
18
+ exports.default = makeWASocket;
19
+ //# sourceMappingURL=index.js.map