@alannxd/baileys 6.0.5 → 6.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.
- package/WAProto/fix-import.js +29 -0
- package/WAProto/index.js +160 -201
- package/engine-requirements.js +1 -1
- package/lib/Defaults/baileys-version.json +3 -0
- package/lib/Defaults/index.d.ts +15 -37
- package/lib/Defaults/index.js +136 -119
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -1
- package/lib/Signal/Group/ciphertext-message.js +5 -2
- package/lib/Signal/Group/group-session-builder.d.ts +3 -4
- package/lib/Signal/Group/group-session-builder.js +41 -7
- package/lib/Signal/Group/group_cipher.d.ts +4 -4
- package/lib/Signal/Group/group_cipher.js +51 -37
- package/lib/Signal/Group/index.d.ts +11 -12
- package/lib/Signal/Group/index.js +57 -12
- package/lib/Signal/Group/keyhelper.d.ts +1 -2
- package/lib/Signal/Group/keyhelper.js +44 -7
- package/lib/Signal/Group/queue-job.d.ts +1 -0
- package/lib/Signal/Group/queue-job.js +57 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +2 -3
- package/lib/Signal/Group/sender-chain-key.js +15 -7
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +1 -2
- package/lib/Signal/Group/sender-key-distribution-message.js +11 -8
- package/lib/Signal/Group/sender-key-message.d.ts +1 -2
- package/lib/Signal/Group/sender-key-message.js +12 -9
- package/lib/Signal/Group/sender-key-name.d.ts +0 -1
- package/lib/Signal/Group/sender-key-name.js +5 -2
- package/lib/Signal/Group/sender-key-record.d.ts +2 -3
- package/lib/Signal/Group/sender-key-record.js +21 -9
- package/lib/Signal/Group/sender-key-state.d.ts +6 -7
- package/lib/Signal/Group/sender-key-state.js +42 -27
- package/lib/Signal/Group/sender-message-key.d.ts +0 -1
- package/lib/Signal/Group/sender-message-key.js +7 -4
- package/lib/Signal/libsignal.d.ts +3 -5
- package/lib/Signal/libsignal.js +90 -347
- package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +5 -4
- package/lib/Socket/Client/abstract-socket-client.js +13 -0
- package/lib/Socket/Client/index.d.ts +3 -3
- package/lib/Socket/Client/index.js +19 -3
- package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
- package/lib/Socket/Client/mobile-socket-client.js +65 -0
- package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +2 -3
- package/lib/Socket/Client/web-socket-client.js +62 -0
- package/lib/Socket/business.d.ts +108 -154
- package/lib/Socket/business.js +43 -162
- package/lib/Socket/chats.d.ts +239 -96
- package/lib/Socket/chats.js +427 -627
- package/lib/Socket/communities.d.ts +146 -239
- package/lib/Socket/communities.js +80 -90
- package/lib/Socket/groups.d.ts +57 -104
- package/lib/Socket/groups.js +161 -154
- package/lib/Socket/index.d.ts +115 -202
- package/lib/Socket/index.js +10 -11
- package/lib/Socket/luxu.d.ts +266 -22
- package/lib/Socket/luxu.js +465 -422
- package/lib/Socket/messages-recv.d.ts +84 -136
- package/lib/Socket/messages-recv.js +615 -1421
- package/lib/Socket/messages-send.d.ts +126 -142
- package/lib/Socket/messages-send.js +671 -878
- package/lib/Socket/newsletter.d.ts +85 -121
- package/lib/Socket/newsletter.js +272 -147
- package/lib/Socket/registration.d.ts +267 -0
- package/lib/Socket/registration.js +166 -0
- package/lib/Socket/socket.d.ts +19 -34
- package/lib/Socket/socket.js +313 -544
- package/lib/Socket/usync.d.ts +36 -0
- package/lib/Socket/usync.js +70 -0
- package/lib/Store/index.d.ts +3 -10
- package/lib/Store/index.js +10 -10
- package/lib/Store/make-cache-manager-store.d.ts +11 -17
- package/lib/Store/make-cache-manager-store.js +41 -43
- package/lib/Store/make-in-memory-store.d.ts +118 -39
- package/lib/Store/make-in-memory-store.js +341 -112
- package/lib/Store/make-ordered-dictionary.d.ts +10 -11
- package/lib/Store/make-ordered-dictionary.js +20 -14
- package/lib/Store/object-repository.d.ts +9 -10
- package/lib/Store/object-repository.js +6 -11
- package/lib/Types/Auth.d.ts +12 -19
- package/lib/Types/Auth.js +2 -2
- package/lib/Types/Call.d.ts +1 -3
- package/lib/Types/Call.js +2 -2
- package/lib/Types/Chat.d.ts +13 -35
- package/lib/Types/Chat.js +4 -8
- package/lib/Types/Contact.d.ts +1 -8
- package/lib/Types/Contact.js +2 -2
- package/lib/Types/Events.d.ts +17 -116
- package/lib/Types/Events.js +2 -2
- package/lib/Types/GroupMetadata.d.ts +5 -21
- package/lib/Types/GroupMetadata.js +2 -2
- package/lib/Types/Label.d.ts +0 -12
- package/lib/Types/Label.js +5 -3
- package/lib/Types/LabelAssociation.d.ts +0 -1
- package/lib/Types/LabelAssociation.js +5 -3
- package/lib/Types/Message.d.ts +58 -105
- package/lib/Types/Message.js +9 -11
- package/lib/Types/Newsletter.d.ts +103 -0
- package/lib/Types/Newsletter.js +38 -0
- package/lib/Types/Product.d.ts +1 -2
- package/lib/Types/Product.js +2 -2
- package/lib/Types/Signal.d.ts +2 -32
- package/lib/Types/Signal.js +2 -2
- package/lib/Types/Socket.d.ts +25 -50
- package/lib/Types/Socket.js +2 -3
- package/lib/Types/State.d.ts +2 -72
- package/lib/Types/State.js +2 -56
- package/lib/Types/USync.d.ts +2 -3
- package/lib/Types/USync.js +2 -2
- package/lib/Types/index.d.ts +14 -22
- package/lib/Types/index.js +31 -15
- package/lib/Utils/auth-utils.d.ts +6 -12
- package/lib/Utils/auth-utils.js +143 -239
- package/lib/Utils/baileys-event-stream.d.ts +16 -0
- package/lib/Utils/baileys-event-stream.js +63 -0
- package/lib/Utils/business.d.ts +2 -3
- package/lib/Utils/business.js +69 -66
- package/lib/Utils/chat-utils.d.ts +23 -52
- package/lib/Utils/chat-utils.js +253 -396
- package/lib/Utils/crypto.d.ts +22 -18
- package/lib/Utils/crypto.js +90 -57
- package/lib/Utils/decode-wa-message.d.ts +8 -55
- package/lib/Utils/decode-wa-message.js +84 -203
- package/lib/Utils/event-buffer.d.ts +8 -9
- package/lib/Utils/event-buffer.js +77 -185
- package/lib/Utils/generics.d.ts +29 -28
- package/lib/Utils/generics.js +210 -180
- package/lib/Utils/history.d.ts +9 -18
- package/lib/Utils/history.js +55 -93
- package/lib/Utils/index.d.ts +17 -22
- package/lib/Utils/index.js +33 -22
- package/lib/Utils/link-preview.d.ts +5 -5
- package/lib/Utils/link-preview.js +24 -16
- package/lib/Utils/logger.d.ts +3 -11
- package/lib/Utils/logger.js +7 -3
- package/lib/Utils/lt-hash.d.ts +12 -8
- package/lib/Utils/lt-hash.js +46 -3
- package/lib/Utils/make-mutex.d.ts +2 -4
- package/lib/Utils/make-mutex.js +34 -24
- package/lib/Utils/messages-media.d.ts +44 -61
- package/lib/Utils/messages-media.js +482 -451
- package/lib/Utils/messages.d.ts +18 -32
- package/lib/Utils/messages.js +369 -458
- package/lib/Utils/noise-handler.d.ts +14 -13
- package/lib/Utils/noise-handler.js +99 -145
- package/lib/Utils/process-message.d.ts +12 -31
- package/lib/Utils/process-message.js +150 -459
- package/lib/Utils/signal.d.ts +5 -20
- package/lib/Utils/signal.js +72 -120
- package/lib/Utils/use-multi-file-auth-state.d.ts +2 -2
- package/lib/Utils/use-multi-file-auth-state.js +27 -29
- package/lib/Utils/validate-connection.d.ts +7 -7
- package/lib/Utils/validate-connection.js +99 -73
- package/lib/WABinary/constants.d.ts +27 -25
- package/lib/WABinary/constants.js +20 -1281
- package/lib/WABinary/decode.d.ts +5 -5
- package/lib/WABinary/decode.js +42 -52
- package/lib/WABinary/encode.d.ts +3 -3
- package/lib/WABinary/encode.js +155 -110
- package/lib/WABinary/generic-utils.d.ts +7 -8
- package/lib/WABinary/generic-utils.js +49 -48
- package/lib/WABinary/index.d.ts +5 -6
- package/lib/WABinary/index.js +21 -6
- package/lib/WABinary/jid-utils.d.ts +8 -25
- package/lib/WABinary/jid-utils.js +40 -74
- package/lib/WABinary/types.d.ts +1 -2
- package/lib/WABinary/types.js +2 -2
- package/lib/WAM/BinaryInfo.d.ts +11 -3
- package/lib/WAM/BinaryInfo.js +5 -2
- package/lib/WAM/constants.d.ts +3 -5
- package/lib/WAM/constants.js +11958 -19461
- package/lib/WAM/encode.d.ts +3 -3
- package/lib/WAM/encode.js +22 -17
- package/lib/WAM/index.d.ts +3 -4
- package/lib/WAM/index.js +19 -4
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +3 -4
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +13 -33
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +14 -11
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +12 -9
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +13 -9
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +3 -4
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +22 -20
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +3 -5
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +8 -13
- package/lib/WAUSync/Protocols/index.d.ts +4 -6
- package/lib/WAUSync/Protocols/index.js +20 -6
- package/lib/WAUSync/USyncQuery.d.ts +4 -6
- package/lib/WAUSync/USyncQuery.js +35 -44
- package/lib/WAUSync/USyncUser.d.ts +5 -10
- package/lib/WAUSync/USyncUser.js +5 -10
- package/lib/WAUSync/index.js +19 -4
- package/lib/index.d.ts +9 -10
- package/lib/index.js +34 -12
- package/package.json +50 -83
- package/WAProto/GenerateStatics.sh +0 -3
- package/WAProto/WAProto.proto +0 -5479
- package/WAProto/fix-imports.js +0 -85
- package/WAProto/index.d.ts +0 -14017
- package/lib/Signal/lid-mapping.d.ts +0 -23
- package/lib/Signal/lid-mapping.js +0 -277
- package/lib/Socket/Client/types.js +0 -11
- package/lib/Socket/Client/websocket.js +0 -54
- package/lib/Socket/mex.d.ts +0 -3
- package/lib/Socket/mex.js +0 -42
- package/lib/Store/keyed-db.d.ts +0 -22
- package/lib/Store/keyed-db.js +0 -108
- package/lib/Types/Bussines.d.ts +0 -25
- package/lib/Types/Bussines.js +0 -2
- package/lib/Types/Mex.d.ts +0 -141
- package/lib/Types/Mex.js +0 -37
- package/lib/Utils/browser-utils.d.ts +0 -4
- package/lib/Utils/browser-utils.js +0 -28
- package/lib/Utils/companion-reg-client-utils.d.ts +0 -17
- package/lib/Utils/companion-reg-client-utils.js +0 -35
- package/lib/Utils/identity-change-handler.d.ts +0 -44
- package/lib/Utils/identity-change-handler.js +0 -50
- package/lib/Utils/message-retry-manager.d.ts +0 -115
- package/lib/Utils/message-retry-manager.js +0 -265
- package/lib/Utils/offline-node-processor.d.ts +0 -17
- package/lib/Utils/offline-node-processor.js +0 -40
- package/lib/Utils/pre-key-manager.d.ts +0 -28
- package/lib/Utils/pre-key-manager.js +0 -106
- package/lib/Utils/reporting-utils.d.ts +0 -11
- package/lib/Utils/reporting-utils.js +0 -258
- package/lib/Utils/stanza-ack.d.ts +0 -11
- package/lib/Utils/stanza-ack.js +0 -38
- package/lib/Utils/sync-action-utils.d.ts +0 -19
- package/lib/Utils/sync-action-utils.js +0 -49
- package/lib/Utils/tc-token-utils.d.ts +0 -37
- package/lib/Utils/tc-token-utils.js +0 -163
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +0 -10
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +0 -25
- package/lib/WAUSync/index.d.ts +0 -4
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const sock =
|
|
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
9
|
const { authState, ev, query, upsertMessage } = sock;
|
|
10
|
+
|
|
10
11
|
const communityQuery = async (jid, type, content) => query({
|
|
11
12
|
tag: 'iq',
|
|
12
13
|
attrs: {
|
|
@@ -16,10 +17,12 @@ export const makeCommunitiesSocket = (config) => {
|
|
|
16
17
|
},
|
|
17
18
|
content
|
|
18
19
|
});
|
|
20
|
+
|
|
19
21
|
const communityMetadata = async (jid) => {
|
|
20
22
|
const result = await communityQuery(jid, 'get', [{ tag: 'query', attrs: { request: 'interactive' } }]);
|
|
21
23
|
return extractCommunityMetadata(result);
|
|
22
24
|
};
|
|
25
|
+
|
|
23
26
|
const communityFetchAllParticipating = async () => {
|
|
24
27
|
const result = await query({
|
|
25
28
|
tag: 'iq',
|
|
@@ -40,9 +43,9 @@ export const makeCommunitiesSocket = (config) => {
|
|
|
40
43
|
]
|
|
41
44
|
});
|
|
42
45
|
const data = {};
|
|
43
|
-
const communitiesChild = getBinaryNodeChild(result, 'communities');
|
|
46
|
+
const communitiesChild = WABinary_1.getBinaryNodeChild(result, 'communities');
|
|
44
47
|
if (communitiesChild) {
|
|
45
|
-
const communities = getBinaryNodeChildren(communitiesChild, 'community');
|
|
48
|
+
const communities = WABinary_1.getBinaryNodeChildren(communitiesChild, 'community');
|
|
46
49
|
for (const communityNode of communities) {
|
|
47
50
|
const meta = extractCommunityMetadata({
|
|
48
51
|
tag: 'result',
|
|
@@ -55,14 +58,15 @@ export const makeCommunitiesSocket = (config) => {
|
|
|
55
58
|
sock.ev.emit('groups.update', Object.values(data));
|
|
56
59
|
return data;
|
|
57
60
|
};
|
|
61
|
+
|
|
58
62
|
async function parseGroupResult(node) {
|
|
59
|
-
logger.info({ node }, 'parseGroupResult');
|
|
60
|
-
const groupNode = getBinaryNodeChild(node, 'group');
|
|
63
|
+
Utils_1.logger.info({ node }, 'parseGroupResult');
|
|
64
|
+
const groupNode = WABinary_1.getBinaryNodeChild(node, 'group');
|
|
61
65
|
if (groupNode) {
|
|
62
66
|
try {
|
|
63
|
-
logger.info({ groupNode }, 'groupNode');
|
|
67
|
+
Utils_1.logger.info({ groupNode }, 'groupNode');
|
|
64
68
|
const metadata = await sock.groupMetadata(`${groupNode.attrs.id}@g.us`);
|
|
65
|
-
return metadata
|
|
69
|
+
return metadata? metadata : Optional.empty();
|
|
66
70
|
}
|
|
67
71
|
catch (error) {
|
|
68
72
|
console.error('Error parsing group metadata:', error);
|
|
@@ -71,23 +75,26 @@ export const makeCommunitiesSocket = (config) => {
|
|
|
71
75
|
}
|
|
72
76
|
return Optional.empty();
|
|
73
77
|
}
|
|
78
|
+
|
|
74
79
|
const Optional = {
|
|
75
80
|
empty: () => null,
|
|
76
|
-
of: (value) => (value
|
|
81
|
+
of: (value) => (value!== null? { value } : null)
|
|
77
82
|
};
|
|
83
|
+
|
|
78
84
|
sock.ws.on('CB:ib,,dirty', async (node) => {
|
|
79
|
-
const { attrs } = getBinaryNodeChild(node, 'dirty');
|
|
80
|
-
if (attrs.type
|
|
85
|
+
const { attrs } = WABinary_1.getBinaryNodeChild(node, 'dirty');
|
|
86
|
+
if (attrs.type!== 'communities') {
|
|
81
87
|
return;
|
|
82
88
|
}
|
|
83
89
|
await communityFetchAllParticipating();
|
|
84
90
|
await sock.cleanDirtyBits('groups');
|
|
85
91
|
});
|
|
92
|
+
|
|
86
93
|
return {
|
|
87
|
-
|
|
94
|
+
...sock,
|
|
88
95
|
communityMetadata,
|
|
89
96
|
communityCreate: async (subject, body) => {
|
|
90
|
-
const descriptionId = generateMessageID().substring(0, 12);
|
|
97
|
+
const descriptionId = Utils_1.generateMessageID().substring(0, 12);
|
|
91
98
|
const result = await communityQuery('@g.us', 'set', [
|
|
92
99
|
{
|
|
93
100
|
tag: 'create',
|
|
@@ -122,7 +129,7 @@ export const makeCommunitiesSocket = (config) => {
|
|
|
122
129
|
return await parseGroupResult(result);
|
|
123
130
|
},
|
|
124
131
|
communityCreateGroup: async (subject, participants, parentCommunityJid) => {
|
|
125
|
-
const key = generateMessageIDV2();
|
|
132
|
+
const key = Utils_1.generateMessageIDV2();
|
|
126
133
|
const result = await communityQuery('@g.us', 'set', [
|
|
127
134
|
{
|
|
128
135
|
tag: 'create',
|
|
@@ -131,7 +138,7 @@ export const makeCommunitiesSocket = (config) => {
|
|
|
131
138
|
key
|
|
132
139
|
},
|
|
133
140
|
content: [
|
|
134
|
-
|
|
141
|
+
...participants.map(jid => ({
|
|
135
142
|
tag: 'participant',
|
|
136
143
|
attrs: { jid }
|
|
137
144
|
})),
|
|
@@ -186,29 +193,25 @@ export const makeCommunitiesSocket = (config) => {
|
|
|
186
193
|
communityFetchLinkedGroups: async (jid) => {
|
|
187
194
|
let communityJid = jid;
|
|
188
195
|
let isCommunity = false;
|
|
189
|
-
// Try to determine if it is a subgroup or a community
|
|
190
196
|
const metadata = await sock.groupMetadata(jid);
|
|
191
197
|
if (metadata.linkedParent) {
|
|
192
|
-
// It is a subgroup, get the community jid
|
|
193
198
|
communityJid = metadata.linkedParent;
|
|
194
199
|
}
|
|
195
200
|
else {
|
|
196
|
-
// It is a community
|
|
197
201
|
isCommunity = true;
|
|
198
202
|
}
|
|
199
|
-
// Fetch all subgroups of the community
|
|
200
203
|
const result = await communityQuery(communityJid, 'get', [{ tag: 'sub_groups', attrs: {} }]);
|
|
201
204
|
const linkedGroupsData = [];
|
|
202
|
-
const subGroupsNode = getBinaryNodeChild(result, 'sub_groups');
|
|
205
|
+
const subGroupsNode = WABinary_1.getBinaryNodeChild(result, 'sub_groups');
|
|
203
206
|
if (subGroupsNode) {
|
|
204
|
-
const groupNodes = getBinaryNodeChildren(subGroupsNode, 'group');
|
|
207
|
+
const groupNodes = WABinary_1.getBinaryNodeChildren(subGroupsNode, 'group');
|
|
205
208
|
for (const groupNode of groupNodes) {
|
|
206
209
|
linkedGroupsData.push({
|
|
207
|
-
id: groupNode.attrs.id
|
|
210
|
+
id: groupNode.attrs.id? WABinary_1.jidEncode(groupNode.attrs.id, 'g.us') : undefined,
|
|
208
211
|
subject: groupNode.attrs.subject || '',
|
|
209
|
-
creation: groupNode.attrs.creation
|
|
210
|
-
owner: groupNode.attrs.creator
|
|
211
|
-
size: groupNode.attrs.size
|
|
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
|
|
212
215
|
});
|
|
213
216
|
}
|
|
214
217
|
}
|
|
@@ -225,8 +228,8 @@ export const makeCommunitiesSocket = (config) => {
|
|
|
225
228
|
attrs: {}
|
|
226
229
|
}
|
|
227
230
|
]);
|
|
228
|
-
const node = getBinaryNodeChild(result, 'membership_approval_requests');
|
|
229
|
-
const participants = getBinaryNodeChildren(node, 'membership_approval_request');
|
|
231
|
+
const node = WABinary_1.getBinaryNodeChild(result, 'membership_approval_requests');
|
|
232
|
+
const participants = WABinary_1.getBinaryNodeChildren(node, 'membership_approval_request');
|
|
230
233
|
return participants.map(v => v.attrs);
|
|
231
234
|
},
|
|
232
235
|
communityRequestParticipantsUpdate: async (jid, participants, action) => {
|
|
@@ -246,9 +249,9 @@ export const makeCommunitiesSocket = (config) => {
|
|
|
246
249
|
]
|
|
247
250
|
}
|
|
248
251
|
]);
|
|
249
|
-
const node = getBinaryNodeChild(result, 'membership_requests_action');
|
|
250
|
-
const nodeAction = getBinaryNodeChild(node, action);
|
|
251
|
-
const participantsAffected = getBinaryNodeChildren(nodeAction, 'participant');
|
|
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');
|
|
252
255
|
return participantsAffected.map(p => {
|
|
253
256
|
return { status: p.attrs.error || '200', jid: p.attrs.jid };
|
|
254
257
|
});
|
|
@@ -257,67 +260,56 @@ export const makeCommunitiesSocket = (config) => {
|
|
|
257
260
|
const result = await communityQuery(jid, 'set', [
|
|
258
261
|
{
|
|
259
262
|
tag: action,
|
|
260
|
-
attrs: action === 'remove'
|
|
263
|
+
attrs: action === 'remove'? { linked_groups: 'true' } : {},
|
|
261
264
|
content: participants.map(jid => ({
|
|
262
265
|
tag: 'participant',
|
|
263
266
|
attrs: { jid }
|
|
264
267
|
}))
|
|
265
268
|
}
|
|
266
269
|
]);
|
|
267
|
-
const node = getBinaryNodeChild(result, action);
|
|
268
|
-
const participantsAffected = getBinaryNodeChildren(node, 'participant');
|
|
270
|
+
const node = WABinary_1.getBinaryNodeChild(result, action);
|
|
271
|
+
const participantsAffected = WABinary_1.getBinaryNodeChildren(node, 'participant');
|
|
269
272
|
return participantsAffected.map(p => {
|
|
270
273
|
return { status: p.attrs.error || '200', jid: p.attrs.jid, content: p };
|
|
271
274
|
});
|
|
272
275
|
},
|
|
273
276
|
communityUpdateDescription: async (jid, description) => {
|
|
274
277
|
const metadata = await communityMetadata(jid);
|
|
275
|
-
const prev = metadata.descId
|
|
278
|
+
const prev = metadata.descId?? null;
|
|
276
279
|
await communityQuery(jid, 'set', [
|
|
277
280
|
{
|
|
278
281
|
tag: 'description',
|
|
279
282
|
attrs: {
|
|
280
|
-
|
|
281
|
-
|
|
283
|
+
...(description? { id: Utils_1.generateMessageID() } : { delete: 'true' }),
|
|
284
|
+
...(prev? { prev } : {})
|
|
282
285
|
},
|
|
283
|
-
content: description
|
|
286
|
+
content: description? [{ tag: 'body', attrs: {}, content: Buffer.from(description, 'utf-8') }] : undefined
|
|
284
287
|
}
|
|
285
288
|
]);
|
|
286
289
|
},
|
|
287
290
|
communityInviteCode: async (jid) => {
|
|
288
291
|
const result = await communityQuery(jid, 'get', [{ tag: 'invite', attrs: {} }]);
|
|
289
|
-
const inviteNode = getBinaryNodeChild(result, 'invite');
|
|
292
|
+
const inviteNode = WABinary_1.getBinaryNodeChild(result, 'invite');
|
|
290
293
|
return inviteNode?.attrs.code;
|
|
291
294
|
},
|
|
292
295
|
communityRevokeInvite: async (jid) => {
|
|
293
296
|
const result = await communityQuery(jid, 'set', [{ tag: 'invite', attrs: {} }]);
|
|
294
|
-
const inviteNode = getBinaryNodeChild(result, 'invite');
|
|
297
|
+
const inviteNode = WABinary_1.getBinaryNodeChild(result, 'invite');
|
|
295
298
|
return inviteNode?.attrs.code;
|
|
296
299
|
},
|
|
297
300
|
communityAcceptInvite: async (code) => {
|
|
298
301
|
const results = await communityQuery('@g.us', 'set', [{ tag: 'invite', attrs: { code } }]);
|
|
299
|
-
const result = getBinaryNodeChild(results, 'community');
|
|
302
|
+
const result = WABinary_1.getBinaryNodeChild(results, 'community');
|
|
300
303
|
return result?.attrs.jid;
|
|
301
304
|
},
|
|
302
|
-
/**
|
|
303
|
-
* revoke a v4 invite for someone
|
|
304
|
-
* @param communityJid community jid
|
|
305
|
-
* @param invitedJid jid of person you invited
|
|
306
|
-
* @returns true if successful
|
|
307
|
-
*/
|
|
308
305
|
communityRevokeInviteV4: async (communityJid, invitedJid) => {
|
|
309
306
|
const result = await communityQuery(communityJid, 'set', [
|
|
310
307
|
{ tag: 'revoke', attrs: {}, content: [{ tag: 'participant', attrs: { jid: invitedJid } }] }
|
|
311
308
|
]);
|
|
312
|
-
return
|
|
309
|
+
return!!result;
|
|
313
310
|
},
|
|
314
|
-
/**
|
|
315
|
-
* accept a CommunityInviteMessage
|
|
316
|
-
* @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
|
|
317
|
-
* @param inviteMessage the message to accept
|
|
318
|
-
*/
|
|
319
311
|
communityAcceptInviteV4: ev.createBufferedFunction(async (key, inviteMessage) => {
|
|
320
|
-
key = typeof key === 'string'
|
|
312
|
+
key = typeof key === 'string'? { remoteJid: key } : key;
|
|
321
313
|
const results = await communityQuery(inviteMessage.groupJid, 'set', [
|
|
322
314
|
{
|
|
323
315
|
tag: 'accept',
|
|
@@ -328,11 +320,8 @@ export const makeCommunitiesSocket = (config) => {
|
|
|
328
320
|
}
|
|
329
321
|
}
|
|
330
322
|
]);
|
|
331
|
-
// if we have the full message key
|
|
332
|
-
// update the invite message to be expired
|
|
333
323
|
if (key.id) {
|
|
334
|
-
|
|
335
|
-
inviteMessage = proto.Message.GroupInviteMessage.fromObject(inviteMessage);
|
|
324
|
+
inviteMessage = WAProto_1.proto.Message.GroupInviteMessage.fromObject(inviteMessage);
|
|
336
325
|
inviteMessage.inviteExpiration = 0;
|
|
337
326
|
inviteMessage.inviteCode = '';
|
|
338
327
|
ev.emit('messages.update', [
|
|
@@ -346,18 +335,17 @@ export const makeCommunitiesSocket = (config) => {
|
|
|
346
335
|
}
|
|
347
336
|
]);
|
|
348
337
|
}
|
|
349
|
-
// generate the community add message
|
|
350
338
|
await upsertMessage({
|
|
351
339
|
key: {
|
|
352
340
|
remoteJid: inviteMessage.groupJid,
|
|
353
|
-
id: generateMessageIDV2(sock.user?.id),
|
|
341
|
+
id: Utils_1.generateMessageIDV2(sock.user?.id),
|
|
354
342
|
fromMe: false,
|
|
355
|
-
participant: key.remoteJid
|
|
343
|
+
participant: key.remoteJid
|
|
356
344
|
},
|
|
357
|
-
messageStubType: WAMessageStubType.GROUP_PARTICIPANT_ADD,
|
|
345
|
+
messageStubType: Types_1.WAMessageStubType.GROUP_PARTICIPANT_ADD,
|
|
358
346
|
messageStubParameters: [JSON.stringify(authState.creds.me)],
|
|
359
347
|
participant: key.remoteJid,
|
|
360
|
-
messageTimestamp: unixTimestampSeconds()
|
|
348
|
+
messageTimestamp: Utils_1.unixTimestampSeconds()
|
|
361
349
|
}, 'notify');
|
|
362
350
|
return results.attrs.from;
|
|
363
351
|
}),
|
|
@@ -367,7 +355,7 @@ export const makeCommunitiesSocket = (config) => {
|
|
|
367
355
|
},
|
|
368
356
|
communityToggleEphemeral: async (jid, ephemeralExpiration) => {
|
|
369
357
|
const content = ephemeralExpiration
|
|
370
|
-
|
|
358
|
+
? { tag: 'ephemeral', attrs: { expiration: ephemeralExpiration.toString() } }
|
|
371
359
|
: { tag: 'not_ephemeral', attrs: {} };
|
|
372
360
|
await communityQuery(jid, 'set', [content]);
|
|
373
361
|
},
|
|
@@ -385,47 +373,49 @@ export const makeCommunitiesSocket = (config) => {
|
|
|
385
373
|
communityFetchAllParticipating
|
|
386
374
|
};
|
|
387
375
|
};
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
const
|
|
376
|
+
|
|
377
|
+
const extractCommunityMetadata = (result) => {
|
|
378
|
+
const community = WABinary_1.getBinaryNodeChild(result, 'community');
|
|
379
|
+
const descChild = WABinary_1.getBinaryNodeChild(community, 'description');
|
|
391
380
|
let desc;
|
|
392
381
|
let descId;
|
|
393
382
|
if (descChild) {
|
|
394
|
-
desc = getBinaryNodeChildString(descChild, 'body');
|
|
383
|
+
desc = WABinary_1.getBinaryNodeChildString(descChild, 'body');
|
|
395
384
|
descId = descChild.attrs.id;
|
|
396
385
|
}
|
|
397
386
|
const communityId = community.attrs.id?.includes('@')
|
|
398
|
-
|
|
399
|
-
: jidEncode(community.attrs.id || '', 'g.us');
|
|
400
|
-
const eph = getBinaryNodeChild(community, 'ephemeral')?.attrs.expiration;
|
|
401
|
-
const memberAddMode = getBinaryNodeChildString(community, 'member_add_mode') === 'all_member_add';
|
|
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';
|
|
402
391
|
const metadata = {
|
|
403
392
|
id: communityId,
|
|
404
393
|
subject: community.attrs.subject || '',
|
|
405
394
|
subjectOwner: community.attrs.s_o,
|
|
406
395
|
subjectTime: Number(community.attrs.s_t || 0),
|
|
407
|
-
size: getBinaryNodeChildren(community, 'participant').length,
|
|
396
|
+
size: WABinary_1.getBinaryNodeChildren(community, 'participant').length,
|
|
408
397
|
creation: Number(community.attrs.creation || 0),
|
|
409
|
-
owner: community.attrs.creator
|
|
398
|
+
owner: community.attrs.creator? WABinary_1.jidNormalizedUser(community.attrs.creator) : undefined,
|
|
410
399
|
desc,
|
|
411
400
|
descId,
|
|
412
|
-
linkedParent: getBinaryNodeChild(community, 'linked_parent')?.attrs.jid || undefined,
|
|
413
|
-
restrict
|
|
414
|
-
announce
|
|
415
|
-
isCommunity
|
|
416
|
-
isCommunityAnnounce
|
|
417
|
-
joinApprovalMode
|
|
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'),
|
|
418
407
|
memberAddMode,
|
|
419
|
-
participants: getBinaryNodeChildren(community, 'participant').map(({ attrs }) => {
|
|
408
|
+
participants: WABinary_1.getBinaryNodeChildren(community, 'participant').map(({ attrs }) => {
|
|
420
409
|
return {
|
|
421
|
-
// TODO: IMPLEMENT THE PN/LID FIELDS HERE!!
|
|
422
410
|
id: attrs.jid,
|
|
423
411
|
admin: (attrs.type || null)
|
|
424
412
|
};
|
|
425
413
|
}),
|
|
426
|
-
ephemeralDuration: eph
|
|
427
|
-
addressingMode: getBinaryNodeChildString(community, 'addressing_mode')
|
|
414
|
+
ephemeralDuration: eph? +eph : undefined,
|
|
415
|
+
addressingMode: WABinary_1.getBinaryNodeChildString(community, 'addressing_mode')
|
|
428
416
|
};
|
|
429
417
|
return metadata;
|
|
430
418
|
};
|
|
431
|
-
|
|
419
|
+
|
|
420
|
+
exports.makeCommunitiesSocket = makeCommunitiesSocket;
|
|
421
|
+
exports.extractCommunityMetadata = extractCommunityMetadata;
|
package/lib/Socket/groups.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import { proto } from '../../WAProto
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { proto } from '../../WAProto';
|
|
3
|
+
import { GroupMetadata, ParticipantAction, SocketConfig } from '../Types';
|
|
4
|
+
import { BinaryNode } from '../WABinary';
|
|
5
5
|
export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
6
6
|
groupMetadata: (jid: string) => Promise<GroupMetadata>;
|
|
7
7
|
groupCreate: (subject: string, participants: string[]) => Promise<GroupMetadata>;
|
|
@@ -10,153 +10,106 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
10
10
|
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
11
11
|
[key: string]: string;
|
|
12
12
|
}[]>;
|
|
13
|
-
groupRequestParticipantsUpdate: (jid: string, participants: string[], action:
|
|
13
|
+
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: 'approve' | 'reject') => Promise<{
|
|
14
14
|
status: string;
|
|
15
|
-
jid: string
|
|
15
|
+
jid: string;
|
|
16
16
|
}[]>;
|
|
17
17
|
groupParticipantsUpdate: (jid: string, participants: string[], action: ParticipantAction) => Promise<{
|
|
18
18
|
status: string;
|
|
19
|
-
jid: string
|
|
19
|
+
jid: string;
|
|
20
20
|
content: BinaryNode;
|
|
21
21
|
}[]>;
|
|
22
22
|
groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
23
23
|
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
24
24
|
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
25
25
|
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
26
|
-
/**
|
|
27
|
-
* revoke a v4 invite for someone
|
|
28
|
-
* @param groupJid group jid
|
|
29
|
-
* @param invitedJid jid of person you invited
|
|
30
|
-
* @returns true if successful
|
|
31
|
-
*/
|
|
32
|
-
groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
|
|
33
26
|
/**
|
|
34
27
|
* accept a GroupInviteMessage
|
|
35
28
|
* @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
|
|
36
29
|
* @param inviteMessage the message to accept
|
|
37
30
|
*/
|
|
38
|
-
groupAcceptInviteV4: (key: string |
|
|
31
|
+
groupAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
|
|
39
32
|
groupGetInviteInfo: (code: string) => Promise<GroupMetadata>;
|
|
40
33
|
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
41
|
-
groupSettingUpdate: (jid: string, setting:
|
|
42
|
-
groupMemberAddMode: (jid: string, mode:
|
|
43
|
-
groupJoinApprovalMode: (jid: string, mode:
|
|
44
|
-
groupToggleHistory: (jid: string, enable: boolean) => 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>;
|
|
45
37
|
groupFetchAllParticipating: () => Promise<{
|
|
46
38
|
[_: string]: GroupMetadata;
|
|
47
39
|
}>;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
profilePicPrivacyToken: boolean;
|
|
51
|
-
lidTrustedTokenIssueToLid: boolean;
|
|
52
|
-
};
|
|
53
|
-
createCallLink: (type: "audio" | "video", event?: {
|
|
54
|
-
startTime: number;
|
|
55
|
-
}, timeoutMs?: number) => Promise<string | undefined>;
|
|
56
|
-
getBotListV2: () => Promise<import("../Types/index.js").BotListInfo[]>;
|
|
57
|
-
messageMutex: {
|
|
58
|
-
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
59
|
-
};
|
|
60
|
-
receiptMutex: {
|
|
61
|
-
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
62
|
-
};
|
|
63
|
-
appStatePatchMutex: {
|
|
64
|
-
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
65
|
-
};
|
|
66
|
-
notificationMutex: {
|
|
67
|
-
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
40
|
+
processingMutex: {
|
|
41
|
+
mutex<T>(code: () => T | Promise<T>): Promise<T>;
|
|
68
42
|
};
|
|
69
43
|
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
70
44
|
[_: string]: string;
|
|
71
45
|
}>;
|
|
72
|
-
upsertMessage: (msg:
|
|
73
|
-
appPatch: (patchCreate: import("../Types
|
|
74
|
-
sendPresenceUpdate: (type: import("../Types
|
|
75
|
-
presenceSubscribe: (toJid: string) => Promise<void>;
|
|
76
|
-
profilePictureUrl: (jid: string, type?: "
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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>;
|
|
84
62
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
85
63
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
86
64
|
updateProfileName: (name: string) => Promise<void>;
|
|
87
65
|
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
updateStatusPrivacy: (value: import("../Types/index.js").WAPrivacyValue) => Promise<void>;
|
|
95
|
-
updateReadReceiptsPrivacy: (value: import("../Types/index.js").WAReadReceiptsValue) => Promise<void>;
|
|
96
|
-
updateGroupsAddPrivacy: (value: import("../Types/index.js").WAPrivacyGroupAddValue) => 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>;
|
|
97
72
|
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
98
|
-
getBusinessProfile: (jid: string) => Promise<import("../Types
|
|
99
|
-
resyncAppState: (collections: readonly ("
|
|
100
|
-
chatModify: (mod: import("../Types
|
|
101
|
-
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number |
|
|
102
|
-
addOrEditContact: (jid: string, contact: proto.SyncActionValue.IContactAction) => Promise<void>;
|
|
103
|
-
removeContact: (jid: string) => Promise<void>;
|
|
104
|
-
placeholderResendCache: import("../Types/index.js").CacheStore;
|
|
105
|
-
addLabel: (jid: string, labels: import("../Types/Label.js").LabelActionBody) => 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>;
|
|
106
77
|
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
107
78
|
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
108
79
|
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
109
80
|
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
110
81
|
star: (jid: string, messages: {
|
|
111
82
|
id: string;
|
|
112
|
-
fromMe?: boolean;
|
|
83
|
+
fromMe?: boolean | undefined;
|
|
113
84
|
}[], star: boolean) => Promise<void>;
|
|
114
|
-
addOrEditQuickReply: (quickReply: import("../Types/Bussines.js").QuickReplyAction) => Promise<void>;
|
|
115
|
-
removeQuickReply: (timestamp: string) => Promise<void>;
|
|
116
85
|
type: "md";
|
|
117
|
-
ws:
|
|
118
|
-
ev: import("../Types
|
|
119
|
-
process(handler: (events: Partial<import("../Types
|
|
86
|
+
ws: any;
|
|
87
|
+
ev: import("../Types").BaileysEventEmitter & {
|
|
88
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
120
89
|
buffer(): void;
|
|
121
|
-
createBufferedFunction<A extends any[],
|
|
122
|
-
flush(): boolean;
|
|
90
|
+
createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
|
|
91
|
+
flush(force?: boolean | undefined): boolean;
|
|
123
92
|
isBuffering(): boolean;
|
|
124
|
-
destroy(): void;
|
|
125
93
|
};
|
|
126
94
|
authState: {
|
|
127
|
-
creds: import("../Types
|
|
128
|
-
keys: import("../Types
|
|
95
|
+
creds: import("../Types").AuthenticationCreds;
|
|
96
|
+
keys: import("../Types").SignalKeyStoreWithTransaction;
|
|
129
97
|
};
|
|
130
|
-
signalRepository: import("../Types
|
|
131
|
-
user: import("../Types
|
|
98
|
+
signalRepository: import("../Types").SignalRepository;
|
|
99
|
+
user: import("../Types").Contact | undefined;
|
|
132
100
|
generateMessageTag: () => string;
|
|
133
|
-
query: (node: BinaryNode, timeoutMs?: number) => Promise<
|
|
134
|
-
waitForMessage: <
|
|
101
|
+
query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>;
|
|
102
|
+
waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
|
|
135
103
|
waitForSocketOpen: () => Promise<void>;
|
|
136
104
|
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
137
105
|
sendNode: (frame: BinaryNode) => Promise<void>;
|
|
138
|
-
logout: (msg?: string) => Promise<void>;
|
|
139
|
-
end: (error: Error | undefined) =>
|
|
140
|
-
|
|
141
|
-
onUnexpectedError: (err: Error | Boom, msg: string) => 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;
|
|
142
109
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
143
110
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
updateServerTimeOffset: ({ attrs }: BinaryNode) => void;
|
|
148
|
-
sendUnifiedSession: () => Promise<void>;
|
|
149
|
-
wamBuffer: import("../index.js").BinaryInfo;
|
|
150
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types/index.js").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
|
|
151
|
-
sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
|
|
152
|
-
executeUSyncQuery: (usyncQuery: import("../index.js").USyncQuery) => Promise<import("../index.js").USyncQueryResult | undefined>;
|
|
153
|
-
onWhatsApp: (...phoneNumber: string[]) => Promise<{
|
|
154
|
-
jid: string;
|
|
155
|
-
exists: boolean;
|
|
156
|
-
}[] | undefined>;
|
|
157
|
-
fetchAccountReachoutTimelock: () => Promise<import("../Types/index.js").ReachoutTimelockState>;
|
|
158
|
-
fetchNewChatMessageCap: () => Promise<import("../Types/index.js").NewChatMessageCapInfo>;
|
|
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>;
|
|
159
114
|
};
|
|
160
115
|
export declare const extractGroupMetadata: (result: BinaryNode) => GroupMetadata;
|
|
161
|
-
export type GroupsSocket = ReturnType<typeof makeGroupsSocket>;
|
|
162
|
-
//# sourceMappingURL=groups.d.ts.map
|