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