@alannxd/baileys 6.0.0 → 6.0.1

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 (111) hide show
  1. package/WAProto/index.js +131281 -59270
  2. package/lib/Defaults/baileys-version.json +1 -1
  3. package/lib/Defaults/index.js +6 -6
  4. package/lib/Socket/chats.js +48 -39
  5. package/lib/Socket/dugong.js +637 -0
  6. package/lib/Socket/groups.js +0 -64
  7. package/lib/Socket/messages-send.js +157 -410
  8. package/lib/Socket/newsletter.js +133 -14
  9. package/lib/Socket/socket.js +2 -73
  10. package/lib/Utils/generics.js +80 -5
  11. package/lib/Utils/messages.js +5 -45
  12. package/lib/Utils/validate-connection.js +2 -2
  13. package/lib/index.js +1 -0
  14. package/package.json +105 -104
  15. package/WAProto/fix-import.js +0 -29
  16. package/lib/Defaults/index.d.ts +0 -53
  17. package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
  18. package/lib/Signal/Group/group-session-builder.d.ts +0 -14
  19. package/lib/Signal/Group/group_cipher.d.ts +0 -17
  20. package/lib/Signal/Group/index.d.ts +0 -11
  21. package/lib/Signal/Group/keyhelper.d.ts +0 -10
  22. package/lib/Signal/Group/queue-job.d.ts +0 -1
  23. package/lib/Signal/Group/sender-chain-key.d.ts +0 -13
  24. package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -16
  25. package/lib/Signal/Group/sender-key-message.d.ts +0 -18
  26. package/lib/Signal/Group/sender-key-name.d.ts +0 -17
  27. package/lib/Signal/Group/sender-key-record.d.ts +0 -30
  28. package/lib/Signal/Group/sender-key-state.d.ts +0 -38
  29. package/lib/Signal/Group/sender-message-key.d.ts +0 -11
  30. package/lib/Signal/libsignal.d.ts +0 -3
  31. package/lib/Socket/Client/abstract-socket-client.d.ts +0 -17
  32. package/lib/Socket/Client/index.d.ts +0 -3
  33. package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
  34. package/lib/Socket/Client/web-socket-client.d.ts +0 -12
  35. package/lib/Socket/business.d.ts +0 -171
  36. package/lib/Socket/chats.d.ts +0 -267
  37. package/lib/Socket/communities.d.ts +0 -180
  38. package/lib/Socket/communities.js +0 -421
  39. package/lib/Socket/groups.d.ts +0 -115
  40. package/lib/Socket/index.d.ts +0 -173
  41. package/lib/Socket/luxu.d.ts +0 -266
  42. package/lib/Socket/luxu.js +0 -541
  43. package/lib/Socket/messages-recv.d.ts +0 -161
  44. package/lib/Socket/messages-send.d.ts +0 -183
  45. package/lib/Socket/newsletter.d.ts +0 -134
  46. package/lib/Socket/registration.d.ts +0 -267
  47. package/lib/Socket/socket.d.ts +0 -44
  48. package/lib/Socket/usync.d.ts +0 -36
  49. package/lib/Store/index.d.ts +0 -3
  50. package/lib/Store/make-cache-manager-store.d.ts +0 -13
  51. package/lib/Store/make-in-memory-store.d.ts +0 -118
  52. package/lib/Store/make-ordered-dictionary.d.ts +0 -13
  53. package/lib/Store/object-repository.d.ts +0 -10
  54. package/lib/Types/Auth.d.ts +0 -110
  55. package/lib/Types/Call.d.ts +0 -13
  56. package/lib/Types/Chat.d.ts +0 -102
  57. package/lib/Types/Contact.d.ts +0 -19
  58. package/lib/Types/Events.d.ts +0 -157
  59. package/lib/Types/GroupMetadata.d.ts +0 -55
  60. package/lib/Types/Label.d.ts +0 -35
  61. package/lib/Types/LabelAssociation.d.ts +0 -29
  62. package/lib/Types/Message.d.ts +0 -273
  63. package/lib/Types/Newsletter.d.ts +0 -103
  64. package/lib/Types/Product.d.ts +0 -78
  65. package/lib/Types/Signal.d.ts +0 -57
  66. package/lib/Types/Socket.d.ts +0 -111
  67. package/lib/Types/State.d.ts +0 -27
  68. package/lib/Types/USync.d.ts +0 -25
  69. package/lib/Types/index.d.ts +0 -57
  70. package/lib/Utils/auth-utils.d.ts +0 -18
  71. package/lib/Utils/baileys-event-stream.d.ts +0 -16
  72. package/lib/Utils/business.d.ts +0 -22
  73. package/lib/Utils/chat-utils.d.ts +0 -71
  74. package/lib/Utils/crypto.d.ts +0 -41
  75. package/lib/Utils/decode-wa-message.d.ts +0 -19
  76. package/lib/Utils/event-buffer.d.ts +0 -35
  77. package/lib/Utils/generics.d.ts +0 -92
  78. package/lib/Utils/history.d.ts +0 -15
  79. package/lib/Utils/index.d.ts +0 -17
  80. package/lib/Utils/link-preview.d.ts +0 -21
  81. package/lib/Utils/logger.d.ts +0 -4
  82. package/lib/Utils/lt-hash.d.ts +0 -12
  83. package/lib/Utils/make-mutex.d.ts +0 -7
  84. package/lib/Utils/messages-media.d.ts +0 -116
  85. package/lib/Utils/messages.d.ts +0 -77
  86. package/lib/Utils/noise-handler.d.ts +0 -21
  87. package/lib/Utils/process-message.d.ts +0 -41
  88. package/lib/Utils/signal.d.ts +0 -32
  89. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
  90. package/lib/Utils/validate-connection.d.ts +0 -11
  91. package/lib/WABinary/constants.d.ts +0 -30
  92. package/lib/WABinary/decode.d.ts +0 -7
  93. package/lib/WABinary/encode.d.ts +0 -3
  94. package/lib/WABinary/generic-utils.d.ts +0 -17
  95. package/lib/WABinary/index.d.ts +0 -5
  96. package/lib/WABinary/jid-utils.d.ts +0 -31
  97. package/lib/WABinary/types.d.ts +0 -18
  98. package/lib/WAM/BinaryInfo.d.ts +0 -17
  99. package/lib/WAM/constants.d.ts +0 -38
  100. package/lib/WAM/encode.d.ts +0 -3
  101. package/lib/WAM/index.d.ts +0 -3
  102. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -9
  103. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -22
  104. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -12
  105. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -12
  106. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -25
  107. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -8
  108. package/lib/WAUSync/Protocols/index.d.ts +0 -4
  109. package/lib/WAUSync/USyncQuery.d.ts +0 -28
  110. package/lib/WAUSync/USyncUser.d.ts +0 -12
  111. package/lib/index.d.ts +0 -12
@@ -1,421 +0,0 @@
1
- const WAProto_1 = require('../../WAProto');
2
- const Types_1 = require('../Types');
3
- const Utils_1 = require('../Utils');
4
- const WABinary_1 = require('../WABinary');
5
- const newsletter_1 = require('./newsletter');
6
-
7
- const makeCommunitiesSocket = (config) => {
8
- const sock = (0, newsletter_1.makeNewsletterSocket)(config);
9
- const { authState, ev, query, upsertMessage } = sock;
10
-
11
- const communityQuery = async (jid, type, content) => query({
12
- tag: 'iq',
13
- attrs: {
14
- type,
15
- xmlns: 'w:g2',
16
- to: jid
17
- },
18
- content
19
- });
20
-
21
- const communityMetadata = async (jid) => {
22
- const result = await communityQuery(jid, 'get', [{ tag: 'query', attrs: { request: 'interactive' } }]);
23
- return extractCommunityMetadata(result);
24
- };
25
-
26
- const communityFetchAllParticipating = 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 communitiesChild = WABinary_1.getBinaryNodeChild(result, 'communities');
47
- if (communitiesChild) {
48
- const communities = WABinary_1.getBinaryNodeChildren(communitiesChild, 'community');
49
- for (const communityNode of communities) {
50
- const meta = extractCommunityMetadata({
51
- tag: 'result',
52
- attrs: {},
53
- content: [communityNode]
54
- });
55
- data[meta.id] = meta;
56
- }
57
- }
58
- sock.ev.emit('groups.update', Object.values(data));
59
- return data;
60
- };
61
-
62
- async function parseGroupResult(node) {
63
- Utils_1.logger.info({ node }, 'parseGroupResult');
64
- const groupNode = WABinary_1.getBinaryNodeChild(node, 'group');
65
- if (groupNode) {
66
- try {
67
- Utils_1.logger.info({ groupNode }, 'groupNode');
68
- const metadata = await sock.groupMetadata(`${groupNode.attrs.id}@g.us`);
69
- return metadata? metadata : Optional.empty();
70
- }
71
- catch (error) {
72
- console.error('Error parsing group metadata:', error);
73
- return Optional.empty();
74
- }
75
- }
76
- return Optional.empty();
77
- }
78
-
79
- const Optional = {
80
- empty: () => null,
81
- of: (value) => (value!== null? { value } : null)
82
- };
83
-
84
- sock.ws.on('CB:ib,,dirty', async (node) => {
85
- const { attrs } = WABinary_1.getBinaryNodeChild(node, 'dirty');
86
- if (attrs.type!== 'communities') {
87
- return;
88
- }
89
- await communityFetchAllParticipating();
90
- await sock.cleanDirtyBits('groups');
91
- });
92
-
93
- return {
94
- ...sock,
95
- communityMetadata,
96
- communityCreate: async (subject, body) => {
97
- const descriptionId = Utils_1.generateMessageID().substring(0, 12);
98
- const result = await communityQuery('@g.us', 'set', [
99
- {
100
- tag: 'create',
101
- attrs: { subject },
102
- content: [
103
- {
104
- tag: 'description',
105
- attrs: { id: descriptionId },
106
- content: [
107
- {
108
- tag: 'body',
109
- attrs: {},
110
- content: Buffer.from(body || '', 'utf-8')
111
- }
112
- ]
113
- },
114
- {
115
- tag: 'parent',
116
- attrs: { default_membership_approval_mode: 'request_required' }
117
- },
118
- {
119
- tag: 'allow_non_admin_sub_group_creation',
120
- attrs: {}
121
- },
122
- {
123
- tag: 'create_general_chat',
124
- attrs: {}
125
- }
126
- ]
127
- }
128
- ]);
129
- return await parseGroupResult(result);
130
- },
131
- communityCreateGroup: async (subject, participants, parentCommunityJid) => {
132
- const key = Utils_1.generateMessageIDV2();
133
- const result = await communityQuery('@g.us', 'set', [
134
- {
135
- tag: 'create',
136
- attrs: {
137
- subject,
138
- key
139
- },
140
- content: [
141
- ...participants.map(jid => ({
142
- tag: 'participant',
143
- attrs: { jid }
144
- })),
145
- { tag: 'linked_parent', attrs: { jid: parentCommunityJid } }
146
- ]
147
- }
148
- ]);
149
- return await parseGroupResult(result);
150
- },
151
- communityLeave: async (id) => {
152
- await communityQuery('@g.us', 'set', [
153
- {
154
- tag: 'leave',
155
- attrs: {},
156
- content: [{ tag: 'community', attrs: { id } }]
157
- }
158
- ]);
159
- },
160
- communityUpdateSubject: async (jid, subject) => {
161
- await communityQuery(jid, 'set', [
162
- {
163
- tag: 'subject',
164
- attrs: {},
165
- content: Buffer.from(subject, 'utf-8')
166
- }
167
- ]);
168
- },
169
- communityLinkGroup: async (groupJid, parentCommunityJid) => {
170
- await communityQuery(parentCommunityJid, 'set', [
171
- {
172
- tag: 'links',
173
- attrs: {},
174
- content: [
175
- {
176
- tag: 'link',
177
- attrs: { link_type: 'sub_group' },
178
- content: [{ tag: 'group', attrs: { jid: groupJid } }]
179
- }
180
- ]
181
- }
182
- ]);
183
- },
184
- communityUnlinkGroup: async (groupJid, parentCommunityJid) => {
185
- await communityQuery(parentCommunityJid, 'set', [
186
- {
187
- tag: 'unlink',
188
- attrs: { unlink_type: 'sub_group' },
189
- content: [{ tag: 'group', attrs: { jid: groupJid } }]
190
- }
191
- ]);
192
- },
193
- communityFetchLinkedGroups: async (jid) => {
194
- let communityJid = jid;
195
- let isCommunity = false;
196
- const metadata = await sock.groupMetadata(jid);
197
- if (metadata.linkedParent) {
198
- communityJid = metadata.linkedParent;
199
- }
200
- else {
201
- isCommunity = true;
202
- }
203
- const result = await communityQuery(communityJid, 'get', [{ tag: 'sub_groups', attrs: {} }]);
204
- const linkedGroupsData = [];
205
- const subGroupsNode = WABinary_1.getBinaryNodeChild(result, 'sub_groups');
206
- if (subGroupsNode) {
207
- const groupNodes = WABinary_1.getBinaryNodeChildren(subGroupsNode, 'group');
208
- for (const groupNode of groupNodes) {
209
- linkedGroupsData.push({
210
- id: groupNode.attrs.id? WABinary_1.jidEncode(groupNode.attrs.id, 'g.us') : undefined,
211
- subject: groupNode.attrs.subject || '',
212
- creation: groupNode.attrs.creation? Number(groupNode.attrs.creation) : undefined,
213
- owner: groupNode.attrs.creator? WABinary_1.jidNormalizedUser(groupNode.attrs.creator) : undefined,
214
- size: groupNode.attrs.size? Number(groupNode.attrs.size) : undefined
215
- });
216
- }
217
- }
218
- return {
219
- communityJid,
220
- isCommunity,
221
- linkedGroups: linkedGroupsData
222
- };
223
- },
224
- communityRequestParticipantsList: async (jid) => {
225
- const result = await communityQuery(jid, 'get', [
226
- {
227
- tag: 'membership_approval_requests',
228
- attrs: {}
229
- }
230
- ]);
231
- const node = WABinary_1.getBinaryNodeChild(result, 'membership_approval_requests');
232
- const participants = WABinary_1.getBinaryNodeChildren(node, 'membership_approval_request');
233
- return participants.map(v => v.attrs);
234
- },
235
- communityRequestParticipantsUpdate: async (jid, participants, action) => {
236
- const result = await communityQuery(jid, 'set', [
237
- {
238
- tag: 'membership_requests_action',
239
- attrs: {},
240
- content: [
241
- {
242
- tag: action,
243
- attrs: {},
244
- content: participants.map(jid => ({
245
- tag: 'participant',
246
- attrs: { jid }
247
- }))
248
- }
249
- ]
250
- }
251
- ]);
252
- const node = WABinary_1.getBinaryNodeChild(result, 'membership_requests_action');
253
- const nodeAction = WABinary_1.getBinaryNodeChild(node, action);
254
- const participantsAffected = WABinary_1.getBinaryNodeChildren(nodeAction, 'participant');
255
- return participantsAffected.map(p => {
256
- return { status: p.attrs.error || '200', jid: p.attrs.jid };
257
- });
258
- },
259
- communityParticipantsUpdate: async (jid, participants, action) => {
260
- const result = await communityQuery(jid, 'set', [
261
- {
262
- tag: action,
263
- attrs: action === 'remove'? { linked_groups: 'true' } : {},
264
- content: participants.map(jid => ({
265
- tag: 'participant',
266
- attrs: { jid }
267
- }))
268
- }
269
- ]);
270
- const node = WABinary_1.getBinaryNodeChild(result, action);
271
- const participantsAffected = WABinary_1.getBinaryNodeChildren(node, 'participant');
272
- return participantsAffected.map(p => {
273
- return { status: p.attrs.error || '200', jid: p.attrs.jid, content: p };
274
- });
275
- },
276
- communityUpdateDescription: async (jid, description) => {
277
- const metadata = await communityMetadata(jid);
278
- const prev = metadata.descId?? null;
279
- await communityQuery(jid, 'set', [
280
- {
281
- tag: 'description',
282
- attrs: {
283
- ...(description? { id: Utils_1.generateMessageID() } : { delete: 'true' }),
284
- ...(prev? { prev } : {})
285
- },
286
- content: description? [{ tag: 'body', attrs: {}, content: Buffer.from(description, 'utf-8') }] : undefined
287
- }
288
- ]);
289
- },
290
- communityInviteCode: async (jid) => {
291
- const result = await communityQuery(jid, 'get', [{ tag: 'invite', attrs: {} }]);
292
- const inviteNode = WABinary_1.getBinaryNodeChild(result, 'invite');
293
- return inviteNode?.attrs.code;
294
- },
295
- communityRevokeInvite: async (jid) => {
296
- const result = await communityQuery(jid, 'set', [{ tag: 'invite', attrs: {} }]);
297
- const inviteNode = WABinary_1.getBinaryNodeChild(result, 'invite');
298
- return inviteNode?.attrs.code;
299
- },
300
- communityAcceptInvite: async (code) => {
301
- const results = await communityQuery('@g.us', 'set', [{ tag: 'invite', attrs: { code } }]);
302
- const result = WABinary_1.getBinaryNodeChild(results, 'community');
303
- return result?.attrs.jid;
304
- },
305
- communityRevokeInviteV4: async (communityJid, invitedJid) => {
306
- const result = await communityQuery(communityJid, 'set', [
307
- { tag: 'revoke', attrs: {}, content: [{ tag: 'participant', attrs: { jid: invitedJid } }] }
308
- ]);
309
- return!!result;
310
- },
311
- communityAcceptInviteV4: ev.createBufferedFunction(async (key, inviteMessage) => {
312
- key = typeof key === 'string'? { remoteJid: key } : key;
313
- const results = await communityQuery(inviteMessage.groupJid, 'set', [
314
- {
315
- tag: 'accept',
316
- attrs: {
317
- code: inviteMessage.inviteCode,
318
- expiration: inviteMessage.inviteExpiration.toString(),
319
- admin: key.remoteJid
320
- }
321
- }
322
- ]);
323
- if (key.id) {
324
- inviteMessage = WAProto_1.proto.Message.GroupInviteMessage.fromObject(inviteMessage);
325
- inviteMessage.inviteExpiration = 0;
326
- inviteMessage.inviteCode = '';
327
- ev.emit('messages.update', [
328
- {
329
- key,
330
- update: {
331
- message: {
332
- groupInviteMessage: inviteMessage
333
- }
334
- }
335
- }
336
- ]);
337
- }
338
- await upsertMessage({
339
- key: {
340
- remoteJid: inviteMessage.groupJid,
341
- id: Utils_1.generateMessageIDV2(sock.user?.id),
342
- fromMe: false,
343
- participant: key.remoteJid
344
- },
345
- messageStubType: Types_1.WAMessageStubType.GROUP_PARTICIPANT_ADD,
346
- messageStubParameters: [JSON.stringify(authState.creds.me)],
347
- participant: key.remoteJid,
348
- messageTimestamp: Utils_1.unixTimestampSeconds()
349
- }, 'notify');
350
- return results.attrs.from;
351
- }),
352
- communityGetInviteInfo: async (code) => {
353
- const results = await communityQuery('@g.us', 'get', [{ tag: 'invite', attrs: { code } }]);
354
- return extractCommunityMetadata(results);
355
- },
356
- communityToggleEphemeral: async (jid, ephemeralExpiration) => {
357
- const content = ephemeralExpiration
358
- ? { tag: 'ephemeral', attrs: { expiration: ephemeralExpiration.toString() } }
359
- : { tag: 'not_ephemeral', attrs: {} };
360
- await communityQuery(jid, 'set', [content]);
361
- },
362
- communitySettingUpdate: async (jid, setting) => {
363
- await communityQuery(jid, 'set', [{ tag: setting, attrs: {} }]);
364
- },
365
- communityMemberAddMode: async (jid, mode) => {
366
- await communityQuery(jid, 'set', [{ tag: 'member_add_mode', attrs: {}, content: mode }]);
367
- },
368
- communityJoinApprovalMode: async (jid, mode) => {
369
- await communityQuery(jid, 'set', [
370
- { tag: 'membership_approval_mode', attrs: {}, content: [{ tag: 'community_join', attrs: { state: mode } }] }
371
- ]);
372
- },
373
- communityFetchAllParticipating
374
- };
375
- };
376
-
377
- const extractCommunityMetadata = (result) => {
378
- const community = WABinary_1.getBinaryNodeChild(result, 'community');
379
- const descChild = WABinary_1.getBinaryNodeChild(community, 'description');
380
- let desc;
381
- let descId;
382
- if (descChild) {
383
- desc = WABinary_1.getBinaryNodeChildString(descChild, 'body');
384
- descId = descChild.attrs.id;
385
- }
386
- const communityId = community.attrs.id?.includes('@')
387
- ? community.attrs.id
388
- : WABinary_1.jidEncode(community.attrs.id || '', 'g.us');
389
- const eph = WABinary_1.getBinaryNodeChild(community, 'ephemeral')?.attrs.expiration;
390
- const memberAddMode = WABinary_1.getBinaryNodeChildString(community, 'member_add_mode') === 'all_member_add';
391
- const metadata = {
392
- id: communityId,
393
- subject: community.attrs.subject || '',
394
- subjectOwner: community.attrs.s_o,
395
- subjectTime: Number(community.attrs.s_t || 0),
396
- size: WABinary_1.getBinaryNodeChildren(community, 'participant').length,
397
- creation: Number(community.attrs.creation || 0),
398
- owner: community.attrs.creator? WABinary_1.jidNormalizedUser(community.attrs.creator) : undefined,
399
- desc,
400
- descId,
401
- linkedParent: WABinary_1.getBinaryNodeChild(community, 'linked_parent')?.attrs.jid || undefined,
402
- restrict:!!WABinary_1.getBinaryNodeChild(community, 'locked'),
403
- announce:!!WABinary_1.getBinaryNodeChild(community, 'announcement'),
404
- isCommunity:!!WABinary_1.getBinaryNodeChild(community, 'parent'),
405
- isCommunityAnnounce:!!WABinary_1.getBinaryNodeChild(community, 'default_sub_community'),
406
- joinApprovalMode:!!WABinary_1.getBinaryNodeChild(community, 'membership_approval_mode'),
407
- memberAddMode,
408
- participants: WABinary_1.getBinaryNodeChildren(community, 'participant').map(({ attrs }) => {
409
- return {
410
- id: attrs.jid,
411
- admin: (attrs.type || null)
412
- };
413
- }),
414
- ephemeralDuration: eph? +eph : undefined,
415
- addressingMode: WABinary_1.getBinaryNodeChildString(community, 'addressing_mode')
416
- };
417
- return metadata;
418
- };
419
-
420
- exports.makeCommunitiesSocket = makeCommunitiesSocket;
421
- exports.extractCommunityMetadata = extractCommunityMetadata;
@@ -1,115 +0,0 @@
1
- /// <reference types="node" />
2
- import { proto } from '../../WAProto';
3
- import { GroupMetadata, ParticipantAction, SocketConfig } from '../Types';
4
- import { BinaryNode } from '../WABinary';
5
- export declare const makeGroupsSocket: (config: SocketConfig) => {
6
- groupMetadata: (jid: string) => Promise<GroupMetadata>;
7
- groupCreate: (subject: string, participants: string[]) => Promise<GroupMetadata>;
8
- groupLeave: (id: string) => Promise<void>;
9
- groupUpdateSubject: (jid: string, subject: string) => Promise<void>;
10
- groupRequestParticipantsList: (jid: string) => Promise<{
11
- [key: string]: string;
12
- }[]>;
13
- groupRequestParticipantsUpdate: (jid: string, participants: string[], action: 'approve' | 'reject') => Promise<{
14
- status: string;
15
- jid: string;
16
- }[]>;
17
- groupParticipantsUpdate: (jid: string, participants: string[], action: ParticipantAction) => Promise<{
18
- status: string;
19
- jid: string;
20
- content: BinaryNode;
21
- }[]>;
22
- groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
23
- groupInviteCode: (jid: string) => Promise<string | undefined>;
24
- groupRevokeInvite: (jid: string) => Promise<string | undefined>;
25
- groupAcceptInvite: (code: string) => Promise<string | undefined>;
26
- /**
27
- * accept a GroupInviteMessage
28
- * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
29
- * @param inviteMessage the message to accept
30
- */
31
- groupAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
32
- groupGetInviteInfo: (code: string) => Promise<GroupMetadata>;
33
- groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
34
- groupSettingUpdate: (jid: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked') => Promise<void>;
35
- groupMemberAddMode: (jid: string, mode: 'admin_add' | 'all_member_add') => Promise<void>;
36
- groupJoinApprovalMode: (jid: string, mode: 'on' | 'off') => Promise<void>;
37
- groupFetchAllParticipating: () => Promise<{
38
- [_: string]: GroupMetadata;
39
- }>;
40
- processingMutex: {
41
- mutex<T>(code: () => T | Promise<T>): Promise<T>;
42
- };
43
- fetchPrivacySettings: (force?: boolean) => Promise<{
44
- [_: string]: string;
45
- }>;
46
- upsertMessage: (msg: proto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
47
- appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
48
- sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
49
- presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
50
- profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
51
- onWhatsApp: (...jids: string[]) => Promise<{
52
- jid: string;
53
- exists: unknown;
54
- lid: unknown;
55
- }[] | undefined>;
56
- fetchBlocklist: () => Promise<string[]>;
57
- fetchStatus: (jid: string) => Promise<{
58
- status: string | undefined;
59
- setAt: Date;
60
- } | undefined>;
61
- updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
62
- removeProfilePicture: (jid: string) => Promise<void>;
63
- updateProfileStatus: (status: string) => Promise<void>;
64
- updateProfileName: (name: string) => Promise<void>;
65
- updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
66
- updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
67
- updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
68
- updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
69
- updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
70
- updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
71
- updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
72
- updateDefaultDisappearingMode: (duration: number) => Promise<void>;
73
- getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
74
- resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
75
- chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
76
- cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
77
- addChatLabel: (jid: string, labelId: string) => Promise<void>;
78
- removeChatLabel: (jid: string, labelId: string) => Promise<void>;
79
- addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
80
- removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
81
- star: (jid: string, messages: {
82
- id: string;
83
- fromMe?: boolean | undefined;
84
- }[], star: boolean) => Promise<void>;
85
- type: "md";
86
- ws: any;
87
- ev: import("../Types").BaileysEventEmitter & {
88
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
89
- buffer(): void;
90
- createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
91
- flush(force?: boolean | undefined): boolean;
92
- isBuffering(): boolean;
93
- };
94
- authState: {
95
- creds: import("../Types").AuthenticationCreds;
96
- keys: import("../Types").SignalKeyStoreWithTransaction;
97
- };
98
- signalRepository: import("../Types").SignalRepository;
99
- user: import("../Types").Contact | undefined;
100
- generateMessageTag: () => string;
101
- query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>;
102
- waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
103
- waitForSocketOpen: () => Promise<void>;
104
- sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
105
- sendNode: (frame: BinaryNode) => Promise<void>;
106
- logout: (msg?: string | undefined) => Promise<void>;
107
- end: (error: Error | undefined) => void;
108
- onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
109
- uploadPreKeys: (count?: number) => Promise<void>;
110
- uploadPreKeysToServerIfRequired: () => Promise<void>;
111
- requestPairingCode: (phoneNumber: string) => Promise<string>;
112
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
113
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
114
- };
115
- export declare const extractGroupMetadata: (result: BinaryNode) => GroupMetadata;