dcodeindra-baileyspro 2.3.9
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/LICENSE +21 -0
- package/README.md +2534 -0
- package/WAProto/Adv/Adv.d.ts +518 -0
- package/WAProto/Adv/Adv.js +1734 -0
- package/WAProto/Adv/Adv.proto +36 -0
- package/WAProto/BotMetadata/BotMetadata.d.ts +5745 -0
- package/WAProto/BotMetadata/BotMetadata.js +16291 -0
- package/WAProto/BotMetadata/BotMetadata.proto +463 -0
- package/WAProto/Cert/Cert.d.ts +497 -0
- package/WAProto/Cert/Cert.js +1503 -0
- package/WAProto/Cert/Cert.proto +28 -0
- package/WAProto/ChatLockSettings/ChatLockSettings.d.ts +391 -0
- package/WAProto/ChatLockSettings/ChatLockSettings.js +1155 -0
- package/WAProto/ChatLockSettings/ChatLockSettings.proto +7 -0
- package/WAProto/CompanionReg/CompanionReg.d.ts +1055 -0
- package/WAProto/CompanionReg/CompanionReg.js +3532 -0
- package/WAProto/CompanionReg/CompanionReg.proto +89 -0
- package/WAProto/DeviceCapabilities/DeviceCapabilities.d.ts +187 -0
- package/WAProto/DeviceCapabilities/DeviceCapabilities.js +520 -0
- package/WAProto/DeviceCapabilities/DeviceCapabilities.proto +14 -0
- package/WAProto/E2E/E2E.d.ts +28417 -0
- package/WAProto/E2E/E2E.js +98438 -0
- package/WAProto/E2E/E2E.proto +2289 -0
- package/WAProto/Ephemeral/Ephemeral.d.ts +95 -0
- package/WAProto/Ephemeral/Ephemeral.js +269 -0
- package/WAProto/Ephemeral/Ephemeral.proto +6 -0
- package/WAProto/HistorySync/HistorySync.d.ts +40728 -0
- package/WAProto/HistorySync/HistorySync.js +142980 -0
- package/WAProto/HistorySync/HistorySync.proto +207 -0
- package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.d.ts +189 -0
- package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.js +585 -0
- package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.proto +11 -0
- package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.d.ts +461 -0
- package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.js +1559 -0
- package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.proto +37 -0
- package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.d.ts +29294 -0
- package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.js +101732 -0
- package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.proto +76 -0
- package/WAProto/MmsRetry/MmsRetry.d.ts +200 -0
- package/WAProto/MmsRetry/MmsRetry.js +586 -0
- package/WAProto/MmsRetry/MmsRetry.proto +17 -0
- package/WAProto/Protocol/Protocol.d.ts +218 -0
- package/WAProto/Protocol/Protocol.js +701 -0
- package/WAProto/Protocol/Protocol.proto +20 -0
- package/WAProto/Reporting/Reporting.d.ts +301 -0
- package/WAProto/Reporting/Reporting.js +989 -0
- package/WAProto/Reporting/Reporting.proto +19 -0
- package/WAProto/ServerSync/ServerSync.d.ts +1050 -0
- package/WAProto/ServerSync/ServerSync.js +3176 -0
- package/WAProto/ServerSync/ServerSync.proto +59 -0
- package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.d.ts +1507 -0
- package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.js +4756 -0
- package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.proto +88 -0
- package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.d.ts +617 -0
- package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.js +1940 -0
- package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.proto +38 -0
- package/WAProto/StatusAttributions/StatusAttributions.d.ts +636 -0
- package/WAProto/StatusAttributions/StatusAttributions.js +2037 -0
- package/WAProto/StatusAttributions/StatusAttributions.proto +61 -0
- package/WAProto/SyncAction/SyncAction.d.ts +7227 -0
- package/WAProto/SyncAction/SyncAction.js +22271 -0
- package/WAProto/SyncAction/SyncAction.proto +423 -0
- package/WAProto/UserPassword/UserPassword.d.ts +298 -0
- package/WAProto/UserPassword/UserPassword.js +898 -0
- package/WAProto/UserPassword/UserPassword.proto +27 -0
- package/WAProto/VnameCert/VnameCert.d.ts +658 -0
- package/WAProto/VnameCert/VnameCert.js +2225 -0
- package/WAProto/VnameCert/VnameCert.proto +60 -0
- package/WAProto/Wa6/Wa6.d.ts +1613 -0
- package/WAProto/Wa6/Wa6.js +6299 -0
- package/WAProto/Wa6/Wa6.proto +229 -0
- package/WAProto/Web/Web.d.ts +31718 -0
- package/WAProto/Web/Web.js +113402 -0
- package/WAProto/Web/Web.proto +545 -0
- package/WAProto/index.d.ts +49 -0
- package/WAProto/index.js +28 -0
- package/WASignalGroup/GroupProtocol.js +1771 -0
- package/WASignalGroup/ciphertext_message.js +10 -0
- package/WASignalGroup/group_cipher.js +103 -0
- package/WASignalGroup/group_session_builder.js +39 -0
- package/WASignalGroup/index.js +5 -0
- package/WASignalGroup/keyhelper.js +17 -0
- package/WASignalGroup/protobufs.js +2 -0
- package/WASignalGroup/queue_job.js +64 -0
- package/WASignalGroup/sender_chain_key.js +38 -0
- package/WASignalGroup/sender_key_distribution_message.js +68 -0
- package/WASignalGroup/sender_key_message.js +79 -0
- package/WASignalGroup/sender_key_name.js +59 -0
- package/WASignalGroup/sender_key_record.js +47 -0
- package/WASignalGroup/sender_key_state.js +110 -0
- package/WASignalGroup/sender_message_key.js +30 -0
- package/check-node-version.js +10 -0
- package/lib/Defaults/baileys-version.json +3 -0
- package/lib/Defaults/index.d.ts +51 -0
- package/lib/Defaults/index.js +108 -0
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
- package/lib/Signal/Group/ciphertext-message.js +19 -0
- package/lib/Signal/Group/group-session-builder.d.ts +17 -0
- package/lib/Signal/Group/group-session-builder.js +72 -0
- package/lib/Signal/Group/group_cipher.d.ts +19 -0
- package/lib/Signal/Group/group_cipher.js +99 -0
- package/lib/Signal/Group/index.d.ts +11 -0
- package/lib/Signal/Group/index.js +61 -0
- package/lib/Signal/Group/keyhelper.d.ts +16 -0
- package/lib/Signal/Group/keyhelper.js +66 -0
- package/lib/Signal/Group/queue-job.d.ts +1 -0
- package/lib/Signal/Group/queue-job.js +64 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
- package/lib/Signal/Group/sender-chain-key.js +39 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +71 -0
- package/lib/Signal/Group/sender-key-message.d.ts +19 -0
- package/lib/Signal/Group/sender-key-message.js +73 -0
- package/lib/Signal/Group/sender-key-name.d.ts +19 -0
- package/lib/Signal/Group/sender-key-name.js +59 -0
- package/lib/Signal/Group/sender-key-record.d.ts +32 -0
- package/lib/Signal/Group/sender-key-record.js +53 -0
- package/lib/Signal/Group/sender-key-record.ts +77 -0
- package/lib/Signal/Group/sender-key-state.d.ts +44 -0
- package/lib/Signal/Group/sender-key-state.js +104 -0
- package/lib/Signal/Group/sender-message-key.d.ts +11 -0
- package/lib/Signal/Group/sender-message-key.js +33 -0
- package/lib/Signal/libsignal.d.ts +3 -0
- package/lib/Signal/libsignal.js +153 -0
- package/lib/Socket/Client/index.d.ts +2 -0
- package/lib/Socket/Client/index.js +18 -0
- package/lib/Socket/Client/types.d.ts +15 -0
- package/lib/Socket/Client/types.js +14 -0
- package/lib/Socket/Client/websocket.d.ts +12 -0
- package/lib/Socket/Client/websocket.js +57 -0
- package/lib/Socket/business.d.ts +181 -0
- package/lib/Socket/business.js +259 -0
- package/lib/Socket/chats.d.ts +95 -0
- package/lib/Socket/chats.js +906 -0
- package/lib/Socket/community.d.ts +131 -0
- package/lib/Socket/community.js +369 -0
- package/lib/Socket/groups.d.ts +122 -0
- package/lib/Socket/groups.js +360 -0
- package/lib/Socket/index.d.ts +183 -0
- package/lib/Socket/index.js +10 -0
- package/lib/Socket/messages-recv.d.ts +170 -0
- package/lib/Socket/messages-recv.js +1074 -0
- package/lib/Socket/messages-send.d.ts +161 -0
- package/lib/Socket/messages-send.js +982 -0
- package/lib/Socket/newsletter.d.ts +140 -0
- package/lib/Socket/newsletter.js +242 -0
- package/lib/Socket/socket.d.ts +43 -0
- package/lib/Socket/socket.js +749 -0
- package/lib/Socket/usync.d.ts +36 -0
- package/lib/Socket/usync.js +71 -0
- package/lib/Store/index.d.ts +4 -0
- package/lib/Store/index.js +20 -0
- package/lib/Store/make-cache-manager-store.d.ts +13 -0
- package/lib/Store/make-cache-manager-store.js +77 -0
- package/lib/Store/make-in-memory-store.d.ts +117 -0
- package/lib/Store/make-in-memory-store.js +420 -0
- package/lib/Store/make-ordered-dictionary.d.ts +12 -0
- package/lib/Store/make-ordered-dictionary.js +83 -0
- package/lib/Store/object-repository.d.ts +10 -0
- package/lib/Store/object-repository.js +28 -0
- package/lib/Types/Auth.d.ts +103 -0
- package/lib/Types/Auth.js +2 -0
- package/lib/Types/Call.d.ts +13 -0
- package/lib/Types/Call.js +2 -0
- package/lib/Types/Chat.d.ts +115 -0
- package/lib/Types/Chat.js +6 -0
- package/lib/Types/Contact.d.ts +35 -0
- package/lib/Types/Contact.js +2 -0
- package/lib/Types/Events.d.ts +208 -0
- package/lib/Types/Events.js +2 -0
- package/lib/Types/GroupMetadata.d.ts +81 -0
- package/lib/Types/GroupMetadata.js +2 -0
- package/lib/Types/Label.d.ts +46 -0
- package/lib/Types/Label.js +28 -0
- package/lib/Types/LabelAssociation.d.ts +29 -0
- package/lib/Types/LabelAssociation.js +10 -0
- package/lib/Types/Message.d.ts +480 -0
- package/lib/Types/Message.js +9 -0
- package/lib/Types/MexUpdates.d.ts +9 -0
- package/lib/Types/MexUpdates.js +18 -0
- package/lib/Types/Newsletter.d.ts +92 -0
- package/lib/Types/Newsletter.js +33 -0
- package/lib/Types/Product.d.ts +78 -0
- package/lib/Types/Product.js +2 -0
- package/lib/Types/Signal.d.ts +57 -0
- package/lib/Types/Signal.js +2 -0
- package/lib/Types/Socket.d.ts +116 -0
- package/lib/Types/Socket.js +2 -0
- package/lib/Types/State.d.ts +27 -0
- package/lib/Types/State.js +2 -0
- package/lib/Types/USync.d.ts +25 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.d.ts +70 -0
- package/lib/Types/index.js +42 -0
- package/lib/Utils/auth-utils.d.ts +18 -0
- package/lib/Utils/auth-utils.js +198 -0
- package/lib/Utils/baileys-event-stream.d.ts +16 -0
- package/lib/Utils/baileys-event-stream.js +64 -0
- package/lib/Utils/business.d.ts +22 -0
- package/lib/Utils/business.js +243 -0
- package/lib/Utils/chat-utils.d.ts +72 -0
- package/lib/Utils/chat-utils.js +762 -0
- package/lib/Utils/crypto.d.ts +40 -0
- package/lib/Utils/crypto.js +150 -0
- package/lib/Utils/decode-wa-message.d.ts +252 -0
- package/lib/Utils/decode-wa-message.js +232 -0
- package/lib/Utils/event-buffer.d.ts +35 -0
- package/lib/Utils/event-buffer.js +539 -0
- package/lib/Utils/generics.d.ts +96 -0
- package/lib/Utils/generics.js +553 -0
- package/lib/Utils/history.d.ts +29 -0
- package/lib/Utils/history.js +109 -0
- package/lib/Utils/index.d.ts +19 -0
- package/lib/Utils/index.js +35 -0
- package/lib/Utils/link-preview.d.ts +21 -0
- package/lib/Utils/link-preview.js +112 -0
- package/lib/Utils/logger.d.ts +11 -0
- package/lib/Utils/logger.js +7 -0
- package/lib/Utils/lt-hash.d.ts +12 -0
- package/lib/Utils/lt-hash.js +53 -0
- package/lib/Utils/make-mutex.d.ts +7 -0
- package/lib/Utils/make-mutex.js +45 -0
- package/lib/Utils/messages-media.d.ts +104 -0
- package/lib/Utils/messages-media.js +751 -0
- package/lib/Utils/messages.d.ts +80 -0
- package/lib/Utils/messages.js +1741 -0
- package/lib/Utils/noise-handler.d.ts +19 -0
- package/lib/Utils/noise-handler.js +150 -0
- package/lib/Utils/process-message.d.ts +41 -0
- package/lib/Utils/process-message.js +391 -0
- package/lib/Utils/signal.d.ts +33 -0
- package/lib/Utils/signal.js +154 -0
- package/lib/Utils/use-mongo-file-auth-state.d.ts +5 -0
- package/lib/Utils/use-mongo-file-auth-state.js +75 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +12 -0
- package/lib/Utils/use-multi-file-auth-state.js +123 -0
- package/lib/Utils/use-single-file-auth-state.d.ts +12 -0
- package/lib/Utils/use-single-file-auth-state.js +75 -0
- package/lib/Utils/validate-connection.d.ts +10 -0
- package/lib/Utils/validate-connection.js +174 -0
- package/lib/WABinary/constants.d.ts +27 -0
- package/lib/WABinary/constants.js +45 -0
- package/lib/WABinary/decode.d.ts +6 -0
- package/lib/WABinary/decode.js +255 -0
- package/lib/WABinary/encode.d.ts +2 -0
- package/lib/WABinary/encode.js +243 -0
- package/lib/WABinary/generic-utils.d.ts +16 -0
- package/lib/WABinary/generic-utils.js +125 -0
- package/lib/WABinary/index.d.ts +5 -0
- package/lib/WABinary/index.js +21 -0
- package/lib/WABinary/jid-utils.d.ts +34 -0
- package/lib/WABinary/jid-utils.js +73 -0
- package/lib/WABinary/types.d.ts +18 -0
- package/lib/WABinary/types.js +2 -0
- package/lib/WAM/BinaryInfo.d.ts +16 -0
- package/lib/WAM/BinaryInfo.js +14 -0
- package/lib/WAM/constants.d.ts +39 -0
- package/lib/WAM/constants.js +15362 -0
- package/lib/WAM/encode.d.ts +2 -0
- package/lib/WAM/encode.js +156 -0
- package/lib/WAM/index.d.ts +3 -0
- package/lib/WAM/index.js +19 -0
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +25 -0
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +60 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +58 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +31 -0
- package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +8 -0
- package/lib/WAUSync/Protocols/USyncLIDProtocol.js +26 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
- package/lib/WAUSync/Protocols/index.d.ts +6 -0
- package/lib/WAUSync/Protocols/index.js +22 -0
- package/lib/WAUSync/USyncQuery.d.ts +28 -0
- package/lib/WAUSync/USyncQuery.js +88 -0
- package/lib/WAUSync/USyncUser.d.ts +12 -0
- package/lib/WAUSync/USyncUser.js +27 -0
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/WAUSync/index.js +19 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +45 -0
- package/package.json +63 -0
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
|
|
4
|
+
const WAProto_1 = require("../../WAProto");
|
|
5
|
+
const Types_1 = require("../Types");
|
|
6
|
+
const Utils_1 = require("../Utils");
|
|
7
|
+
const WABinary_1 = require("../WABinary");
|
|
8
|
+
const chats_1 = require("./chats");
|
|
9
|
+
|
|
10
|
+
const makeGroupsSocket = (config) => {
|
|
11
|
+
const sock = chats_1.makeChatsSocket(config);
|
|
12
|
+
const { authState, ev, query, upsertMessage } = sock;
|
|
13
|
+
|
|
14
|
+
const groupQuery = async (jid, type, content) => query({
|
|
15
|
+
tag: 'iq',
|
|
16
|
+
attrs: {
|
|
17
|
+
type,
|
|
18
|
+
xmlns: 'w:g2',
|
|
19
|
+
to: jid,
|
|
20
|
+
},
|
|
21
|
+
content
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const groupMetadata = async (jid) => {
|
|
25
|
+
const result = await groupQuery(jid, 'get', [{ tag: 'query', attrs: { request: 'interactive' } }]);
|
|
26
|
+
return extractGroupMetadata(result);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const groupFetchAllParticipating = async () => {
|
|
30
|
+
const result = await query({
|
|
31
|
+
tag: 'iq',
|
|
32
|
+
attrs: {
|
|
33
|
+
to: '@g.us',
|
|
34
|
+
xmlns: 'w:g2',
|
|
35
|
+
type: 'get',
|
|
36
|
+
},
|
|
37
|
+
content: [
|
|
38
|
+
{
|
|
39
|
+
tag: 'participating',
|
|
40
|
+
attrs: {},
|
|
41
|
+
content: [
|
|
42
|
+
{ tag: 'participants', attrs: {} },
|
|
43
|
+
{ tag: 'description', attrs: {} }
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const data = {};
|
|
50
|
+
const groupsChild = WABinary_1.getBinaryNodeChild(result, 'groups');
|
|
51
|
+
|
|
52
|
+
if (groupsChild) {
|
|
53
|
+
const groups = WABinary_1.getBinaryNodeChildren(groupsChild, 'group');
|
|
54
|
+
for (const groupNode of groups) {
|
|
55
|
+
const meta = extractGroupMetadata({
|
|
56
|
+
tag: 'result',
|
|
57
|
+
attrs: {},
|
|
58
|
+
content: [groupNode]
|
|
59
|
+
});
|
|
60
|
+
data[meta.id] = meta;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
sock.ev.emit('groups.update', Object.values(data));
|
|
65
|
+
return data;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
sock.ws.on('CB:ib,,dirty', async (node) => {
|
|
69
|
+
const { attrs } = WABinary_1.getBinaryNodeChild(node, 'dirty') || {};
|
|
70
|
+
if (!attrs || attrs.type !== 'groups') {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
await groupFetchAllParticipating();
|
|
75
|
+
await sock.cleanDirtyBits('groups');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
...sock,
|
|
80
|
+
groupQuery,
|
|
81
|
+
groupMetadata,
|
|
82
|
+
groupCreate: async (subject, participants) => {
|
|
83
|
+
const key = Utils_1.generateMessageID();
|
|
84
|
+
|
|
85
|
+
const result = await groupQuery('@g.us', 'set', [
|
|
86
|
+
{
|
|
87
|
+
tag: 'create',
|
|
88
|
+
attrs: {
|
|
89
|
+
subject,
|
|
90
|
+
key
|
|
91
|
+
},
|
|
92
|
+
content: participants.map(jid => ({
|
|
93
|
+
tag: 'participant',
|
|
94
|
+
attrs: { jid }
|
|
95
|
+
}))
|
|
96
|
+
}
|
|
97
|
+
]);
|
|
98
|
+
|
|
99
|
+
return extractGroupMetadata(result);
|
|
100
|
+
},
|
|
101
|
+
groupLeave: async (id) => {
|
|
102
|
+
await groupQuery('@g.us', 'set', [
|
|
103
|
+
{
|
|
104
|
+
tag: 'leave',
|
|
105
|
+
attrs: {},
|
|
106
|
+
content: [
|
|
107
|
+
{ tag: 'group', attrs: { id } }
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
]);
|
|
111
|
+
},
|
|
112
|
+
groupUpdateSubject: async (jid, subject) => {
|
|
113
|
+
await groupQuery(jid, 'set', [
|
|
114
|
+
{
|
|
115
|
+
tag: 'subject',
|
|
116
|
+
attrs: {},
|
|
117
|
+
content: Buffer.from(subject, 'utf-8')
|
|
118
|
+
}
|
|
119
|
+
]);
|
|
120
|
+
},
|
|
121
|
+
groupRequestParticipantsList: async (jid) => {
|
|
122
|
+
const result = await groupQuery(jid, 'get', [
|
|
123
|
+
{
|
|
124
|
+
tag: 'membership_approval_requests',
|
|
125
|
+
attrs: {}
|
|
126
|
+
}
|
|
127
|
+
]);
|
|
128
|
+
|
|
129
|
+
const node = WABinary_1.getBinaryNodeChild(result, 'membership_approval_requests');
|
|
130
|
+
const participants = WABinary_1.getBinaryNodeChildren(node, 'membership_approval_request');
|
|
131
|
+
|
|
132
|
+
return participants.map(v => v.attrs);
|
|
133
|
+
},
|
|
134
|
+
groupRequestParticipantsUpdate: async (jid, participants, action) => {
|
|
135
|
+
const result = await groupQuery(jid, 'set', [{
|
|
136
|
+
tag: 'membership_requests_action',
|
|
137
|
+
attrs: {},
|
|
138
|
+
content: [
|
|
139
|
+
{
|
|
140
|
+
tag: action,
|
|
141
|
+
attrs: {},
|
|
142
|
+
content: participants.map(jid => ({
|
|
143
|
+
tag: 'participant',
|
|
144
|
+
attrs: { jid }
|
|
145
|
+
}))
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}]);
|
|
149
|
+
|
|
150
|
+
const node = WABinary_1.getBinaryNodeChild(result, 'membership_requests_action');
|
|
151
|
+
const nodeAction = WABinary_1.getBinaryNodeChild(node, action);
|
|
152
|
+
const participantsAffected = WABinary_1.getBinaryNodeChildren(nodeAction, 'participant');
|
|
153
|
+
|
|
154
|
+
return participantsAffected.map(p => {
|
|
155
|
+
return { status: p.attrs.error || '200', jid: p.attrs.jid };
|
|
156
|
+
});
|
|
157
|
+
},
|
|
158
|
+
groupParticipantsUpdate: async (jid, participants, action) => {
|
|
159
|
+
const result = await groupQuery(jid, 'set', [
|
|
160
|
+
{
|
|
161
|
+
tag: action,
|
|
162
|
+
attrs: {},
|
|
163
|
+
content: participants.map(jid => ({
|
|
164
|
+
tag: 'participant',
|
|
165
|
+
attrs: { jid }
|
|
166
|
+
}))
|
|
167
|
+
}
|
|
168
|
+
]);
|
|
169
|
+
const node = WABinary_1.getBinaryNodeChild(result, action);
|
|
170
|
+
const participantsAffected = WABinary_1.getBinaryNodeChildren(node, 'participant');
|
|
171
|
+
|
|
172
|
+
return participantsAffected.map(p => {
|
|
173
|
+
return { status: p.attrs.error || '200', jid: p.attrs.jid, content: p };
|
|
174
|
+
});
|
|
175
|
+
},
|
|
176
|
+
groupUpdateDescription: async (jid, description) => {
|
|
177
|
+
const metadata = await groupMetadata(jid);
|
|
178
|
+
const prev = metadata.descId ? metadata.descId : null;
|
|
179
|
+
|
|
180
|
+
await groupQuery(jid, 'set', [
|
|
181
|
+
{
|
|
182
|
+
tag: 'description',
|
|
183
|
+
attrs: {
|
|
184
|
+
...(description ? { id: Utils_1.generateMessageID() } : { delete: 'true' }),
|
|
185
|
+
...(prev ? { prev } : {})
|
|
186
|
+
},
|
|
187
|
+
content: description ? [
|
|
188
|
+
{ tag: 'body', attrs: {}, content: Buffer.from(description, 'utf-8') }
|
|
189
|
+
] : undefined
|
|
190
|
+
}
|
|
191
|
+
]);
|
|
192
|
+
},
|
|
193
|
+
groupInviteCode: async (jid) => {
|
|
194
|
+
const result = await groupQuery(jid, 'get', [{ tag: 'invite', attrs: {} }]);
|
|
195
|
+
const inviteNode = WABinary_1.getBinaryNodeChild(result, 'invite');
|
|
196
|
+
|
|
197
|
+
return inviteNode?.attrs?.code;
|
|
198
|
+
},
|
|
199
|
+
groupRevokeInvite: async (jid) => {
|
|
200
|
+
const result = await groupQuery(jid, 'set', [{ tag: 'invite', attrs: {} }]);
|
|
201
|
+
const inviteNode = WABinary_1.getBinaryNodeChild(result, 'invite');
|
|
202
|
+
|
|
203
|
+
return inviteNode?.attrs?.code;
|
|
204
|
+
},
|
|
205
|
+
groupAcceptInvite: async (code) => {
|
|
206
|
+
const results = await groupQuery('@g.us', 'set', [{ tag: 'invite', attrs: { code } }]);
|
|
207
|
+
const result = WABinary_1.getBinaryNodeChild(results, 'group');
|
|
208
|
+
|
|
209
|
+
return result?.attrs?.jid;
|
|
210
|
+
},
|
|
211
|
+
groupRevokeInviteV4: async (groupJid, invitedJid) => {
|
|
212
|
+
const result = await groupQuery(groupJid, 'set', [
|
|
213
|
+
{
|
|
214
|
+
tag: 'revoke',
|
|
215
|
+
attrs: {},
|
|
216
|
+
content: [{ tag: 'participant', attrs: { jid: invitedJid } }]
|
|
217
|
+
}
|
|
218
|
+
]);
|
|
219
|
+
|
|
220
|
+
return !!result;
|
|
221
|
+
},
|
|
222
|
+
groupAcceptInviteV4: ev.createBufferedFunction(async (key, inviteMessage) => {
|
|
223
|
+
key = typeof key === 'string' ? { remoteJid: key } : key;
|
|
224
|
+
const results = await groupQuery(inviteMessage.groupJid, 'set', [{
|
|
225
|
+
tag: 'accept',
|
|
226
|
+
attrs: {
|
|
227
|
+
code: inviteMessage.inviteCode,
|
|
228
|
+
expiration: inviteMessage.inviteExpiration.toString(),
|
|
229
|
+
admin: key.remoteJid
|
|
230
|
+
}
|
|
231
|
+
}]);
|
|
232
|
+
|
|
233
|
+
if (key.id) {
|
|
234
|
+
inviteMessage = WAProto_1.proto.Message.GroupInviteMessage.fromObject(inviteMessage);
|
|
235
|
+
inviteMessage.inviteExpiration = 0;
|
|
236
|
+
inviteMessage.inviteCode = '';
|
|
237
|
+
ev.emit('messages.update', [
|
|
238
|
+
{
|
|
239
|
+
key,
|
|
240
|
+
update: {
|
|
241
|
+
message: {
|
|
242
|
+
groupInviteMessage: inviteMessage
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
]);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
await upsertMessage({
|
|
250
|
+
key: {
|
|
251
|
+
remoteJid: inviteMessage.groupJid,
|
|
252
|
+
id: Utils_1.generateMessageID(authState.creds.me?.id),
|
|
253
|
+
fromMe: false,
|
|
254
|
+
participant: key.remoteJid,
|
|
255
|
+
},
|
|
256
|
+
messageStubType: Types_1.WAMessageStubType.GROUP_PARTICIPANT_ADD,
|
|
257
|
+
messageStubParameters: [
|
|
258
|
+
authState.creds.me.id
|
|
259
|
+
],
|
|
260
|
+
participant: key.remoteJid,
|
|
261
|
+
messageTimestamp: Utils_1.unixTimestampSeconds()
|
|
262
|
+
}, 'notify');
|
|
263
|
+
|
|
264
|
+
return results.attrs.from;
|
|
265
|
+
}),
|
|
266
|
+
groupGetInviteInfo: async (code) => {
|
|
267
|
+
const results = await groupQuery('@g.us', 'get', [{ tag: 'invite', attrs: { code } }]);
|
|
268
|
+
|
|
269
|
+
return extractGroupMetadata(results);
|
|
270
|
+
},
|
|
271
|
+
groupToggleEphemeral: async (jid, ephemeralExpiration) => {
|
|
272
|
+
const content = ephemeralExpiration ?
|
|
273
|
+
{ tag: 'ephemeral', attrs: { expiration: ephemeralExpiration.toString() } } :
|
|
274
|
+
{ tag: 'not_ephemeral', attrs: {} };
|
|
275
|
+
await groupQuery(jid, 'set', [content]);
|
|
276
|
+
},
|
|
277
|
+
groupSettingUpdate: async (jid, setting) => {
|
|
278
|
+
await groupQuery(jid, 'set', [{ tag: setting, attrs: {} }]);
|
|
279
|
+
},
|
|
280
|
+
groupMemberAddMode: async (jid, mode) => {
|
|
281
|
+
await groupQuery(jid, 'set', [{ tag: 'member_add_mode', attrs: {}, content: mode }]);
|
|
282
|
+
},
|
|
283
|
+
groupJoinApprovalMode: async (jid, mode) => {
|
|
284
|
+
await groupQuery(jid, 'set', [
|
|
285
|
+
{ tag: 'membership_approval_mode', attrs: {}, content: [{ tag: 'group_join', attrs: { state: mode } }] }
|
|
286
|
+
]);
|
|
287
|
+
},
|
|
288
|
+
groupFetchAllParticipating
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
const extractGroupMetadata = (result) => {
|
|
293
|
+
const group = WABinary_1.getBinaryNodeChild(result, 'group');
|
|
294
|
+
if (!group) return null;
|
|
295
|
+
|
|
296
|
+
const descChild = WABinary_1.getBinaryNodeChild(group, 'description');
|
|
297
|
+
|
|
298
|
+
let desc;
|
|
299
|
+
let descId;
|
|
300
|
+
let descOwner;
|
|
301
|
+
let descOwnerJid;
|
|
302
|
+
let descTime;
|
|
303
|
+
|
|
304
|
+
if (descChild) {
|
|
305
|
+
desc = WABinary_1.getBinaryNodeChildString(descChild, 'body');
|
|
306
|
+
descOwner = descChild.attrs.participant ? WABinary_1.jidNormalizedUser(descChild.attrs.participant) : undefined;
|
|
307
|
+
descOwnerJid = descChild.attrs.participant_pn ? WABinary_1.jidNormalizedUser(descChild.attrs.participant_pn) : undefined;
|
|
308
|
+
descTime = +descChild.attrs.t;
|
|
309
|
+
descId = descChild.attrs.id;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const groupId = group.attrs.id.includes('@') ? group.attrs.id : WABinary_1.jidEncode(group.attrs.id, 'g.us');
|
|
313
|
+
const eph = WABinary_1.getBinaryNodeChild(group, 'ephemeral')?.attrs?.expiration;
|
|
314
|
+
const memberAddMode = WABinary_1.getBinaryNodeChildString(group, 'member_add_mode') === 'all_member_add';
|
|
315
|
+
|
|
316
|
+
const participants = WABinary_1.getBinaryNodeChildren(group, 'participant').map(({ attrs }) => {
|
|
317
|
+
const isUserJid = WABinary_1.isJidUser(attrs.jid);
|
|
318
|
+
const isLidJid = WABinary_1.isLidUser && WABinary_1.isLidUser(attrs.jid); // Soporte condicional para LID
|
|
319
|
+
|
|
320
|
+
return {
|
|
321
|
+
id: attrs.jid,
|
|
322
|
+
jid: isUserJid ? attrs.jid : (attrs.phone_number ? WABinary_1.jidNormalizedUser(attrs.phone_number) : undefined),
|
|
323
|
+
lid: isLidJid ? attrs.jid : attrs.lid,
|
|
324
|
+
admin: (attrs.type || null),
|
|
325
|
+
};
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
const metadata = {
|
|
330
|
+
id: groupId,
|
|
331
|
+
addressingMode: group.attrs.addressing_mode,
|
|
332
|
+
subject: group.attrs.subject,
|
|
333
|
+
subjectOwner: group.attrs.s_o,
|
|
334
|
+
subjectOwnerJid: group.attrs.s_o_pn,
|
|
335
|
+
subjectTime: +group.attrs.s_t,
|
|
336
|
+
size: participants.length,
|
|
337
|
+
creation: +group.attrs.creation,
|
|
338
|
+
owner: group.attrs.creator ? WABinary_1.jidNormalizedUser(group.attrs.creator) : undefined,
|
|
339
|
+
ownerJid: group.attrs.creator_pn ? WABinary_1.jidNormalizedUser(group.attrs.creator_pn) : undefined,
|
|
340
|
+
desc,
|
|
341
|
+
descId,
|
|
342
|
+
descOwner,
|
|
343
|
+
descOwnerJid,
|
|
344
|
+
descTime,
|
|
345
|
+
linkedParent: WABinary_1.getBinaryNodeChild(group, 'linked_parent')?.attrs?.jid || undefined,
|
|
346
|
+
restrict: !!WABinary_1.getBinaryNodeChild(group, 'locked'),
|
|
347
|
+
announce: !!WABinary_1.getBinaryNodeChild(group, 'announcement'),
|
|
348
|
+
isCommunity: !!WABinary_1.getBinaryNodeChild(group, 'parent'),
|
|
349
|
+
isCommunityAnnounce: !!WABinary_1.getBinaryNodeChild(group, 'default_sub_group'),
|
|
350
|
+
joinApprovalMode: !!WABinary_1.getBinaryNodeChild(group, 'membership_approval_mode'),
|
|
351
|
+
memberAddMode,
|
|
352
|
+
participants,
|
|
353
|
+
ephemeralDuration: eph ? +eph : undefined
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
return metadata;
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
exports.makeGroupsSocket = makeGroupsSocket;
|
|
360
|
+
exports.extractGroupMetadata = extractGroupMetadata;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { UserFacingSocketConfig, ContactAction } from '../Types'
|
|
2
|
+
declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
3
|
+
logger: import("../Utils/logger").ILogger
|
|
4
|
+
getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>
|
|
5
|
+
getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
|
|
6
|
+
products: import("../Types").Product[]
|
|
7
|
+
nextPageCursor: string | undefined
|
|
8
|
+
}>
|
|
9
|
+
getCollections: (jid?: string | undefined, limit?: number) => Promise<{
|
|
10
|
+
collections: import("../Types").CatalogCollection[]
|
|
11
|
+
}>
|
|
12
|
+
productCreate: (create: import("../Types").ProductCreate) => Promise<import("../Types").Product>
|
|
13
|
+
productDelete: (productIds: string[]) => Promise<{
|
|
14
|
+
deleted: number
|
|
15
|
+
}>
|
|
16
|
+
productUpdate: (productId: string, update: import("../Types").ProductUpdate) => Promise<import("../Types").Product>
|
|
17
|
+
sendMessageAck: ({ tag, attrs, content }: import("..").BinaryNode, errorCode?: number | undefined) => Promise<void>
|
|
18
|
+
sendRetryRequest: (node: import("..").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>
|
|
19
|
+
offerCall: (toJid: string, isVideo?: boolean) => Promise<{
|
|
20
|
+
id: any
|
|
21
|
+
to: string
|
|
22
|
+
}>
|
|
23
|
+
rejectCall: (callId: string, callFrom: string) => Promise<void>
|
|
24
|
+
fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAProto.IMessageKey, oldestMsgTimestamp: number | import("long").Long) => Promise<string>
|
|
25
|
+
requestPlaceholderResend: (messageKey: import("../Types").WAProto.IMessageKey) => Promise<string | undefined>
|
|
26
|
+
getPrivacyTokens: (jids: string[]) => Promise<import("..").BinaryNode>
|
|
27
|
+
assertSessions: (jids: string[], force: boolean) => Promise<boolean>
|
|
28
|
+
relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>
|
|
29
|
+
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>
|
|
30
|
+
sendReceipts: (keys: import("../Types").WAProto.IMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>
|
|
31
|
+
readMessages: (keys: import("../Types").WAProto.IMessageKey[]) => Promise<void>
|
|
32
|
+
refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>
|
|
33
|
+
waUploadToServer: import("../Types").WAMediaUploadFunction
|
|
34
|
+
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
35
|
+
[_: string]: string
|
|
36
|
+
}>
|
|
37
|
+
sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>
|
|
38
|
+
createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: {
|
|
39
|
+
[key: string]: string
|
|
40
|
+
} | undefined) => Promise<{
|
|
41
|
+
nodes: import("..").BinaryNode[]
|
|
42
|
+
shouldIncludeDeviceIdentity: boolean
|
|
43
|
+
}>
|
|
44
|
+
profilePictureUrl: (jids: string) => Promise<string>
|
|
45
|
+
getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("..").JidWithDevice[]>
|
|
46
|
+
updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>
|
|
47
|
+
sendStatusMentions: (content: import("../Types").WAProto.IMessage, jid: string, Private?: boolean) => Promise<string>
|
|
48
|
+
sendAlbumMessage: (jid: string, medias: import("../Types").WAProto.IMessage, options?: import("../Types").MiscMessageGenerationOptions) => Promise<string>
|
|
49
|
+
sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo | undefined>
|
|
50
|
+
subscribeNewsletterUpdates: (jid: string) => Promise<{
|
|
51
|
+
duration: string
|
|
52
|
+
}>
|
|
53
|
+
newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>
|
|
54
|
+
newsletterUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>
|
|
55
|
+
newsletterUpdateName: (jid: string, name: string) => Promise<void>
|
|
56
|
+
newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>
|
|
57
|
+
newsletterRemovePicture: (jid: string) => Promise<void>
|
|
58
|
+
newsletterUnfollow: (jid: string) => Promise<void>
|
|
59
|
+
newsletterFollow: (jid: string) => Promise<void>
|
|
60
|
+
newsletterUnmute: (jid: string) => Promise<void>
|
|
61
|
+
newsletterMute: (jid: string) => Promise<void>
|
|
62
|
+
newsletterCreate: (name: string, description?: string, picture?: import("../Types").WAMediaUpload) => Promise<import("../Types").NewsletterMetadata>
|
|
63
|
+
newsletterQuery: (jid: string, type: string, content: BinaryNode) => Promise<BinaryNode>
|
|
64
|
+
newsletterWMexQuery: (jid?: string | undefined, query_id: number, content: BinaryNode) => Promise<BinaryNode>
|
|
65
|
+
newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole | undefined) => Promise<import("../Types").NewsletterMetadata>
|
|
66
|
+
newsletterAdminCount: (jid: string) => Promise<number>
|
|
67
|
+
newsletterChangeOwner: (jid: string, userLid: string) => Promise<void>
|
|
68
|
+
newsletterDemote: (jid: string, userLid: string) => Promise<void>
|
|
69
|
+
newsletterDelete: (jid: string) => Promise<void>
|
|
70
|
+
newsletterReactMessage: (jid: string, server_id: string, code?: string | undefined) => Promise<void>
|
|
71
|
+
newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>
|
|
72
|
+
newsletterFetchUpdates: (jid: string, count: number, after?: number | undefined, since?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>
|
|
73
|
+
groupQuery: (jid: string, type: string, content: BinaryNode) => Promise<BinaryNode>
|
|
74
|
+
groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>
|
|
75
|
+
groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>
|
|
76
|
+
groupLeave: (id: string) => Promise<void>
|
|
77
|
+
groupUpdateSubject: (jid: string, subject: string) => Promise<void>
|
|
78
|
+
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
79
|
+
[key: string]: string
|
|
80
|
+
}[]>
|
|
81
|
+
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
|
|
82
|
+
status: string
|
|
83
|
+
jid: string
|
|
84
|
+
}[]>
|
|
85
|
+
groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
|
|
86
|
+
status: string
|
|
87
|
+
jid: string
|
|
88
|
+
content: import("..").BinaryNode
|
|
89
|
+
}[]>
|
|
90
|
+
groupUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>
|
|
91
|
+
groupInviteCode: (jid: string) => Promise<string | undefined>
|
|
92
|
+
groupRevokeInvite: (jid: string) => Promise<string | undefined>
|
|
93
|
+
groupAcceptInvite: (code: string) => Promise<string | undefined>
|
|
94
|
+
groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>
|
|
95
|
+
groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>
|
|
96
|
+
groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>
|
|
97
|
+
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>
|
|
98
|
+
groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>
|
|
99
|
+
groupMemberAddMode: (jid: string, mode: "all_member_add" | "admin_add") => Promise<void>
|
|
100
|
+
groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>
|
|
101
|
+
groupFetchAllParticipating: () => Promise<{
|
|
102
|
+
[_: string]: import("../Types").GroupMetadata
|
|
103
|
+
}>
|
|
104
|
+
processingMutex: {
|
|
105
|
+
mutex<T>(code: () => T | Promise<T>): Promise<T>
|
|
106
|
+
}
|
|
107
|
+
upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>
|
|
108
|
+
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>
|
|
109
|
+
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>
|
|
110
|
+
presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>
|
|
111
|
+
getBotListV2: () => Promise<BotListInfo[]>
|
|
112
|
+
getLidUser: (jid: string) => Promise<{
|
|
113
|
+
lid: string
|
|
114
|
+
id: string
|
|
115
|
+
}[] | undefined>
|
|
116
|
+
onWhatsApp: (...jids: string[]) => Promise<{
|
|
117
|
+
jid: string
|
|
118
|
+
exists: unknown
|
|
119
|
+
}[] | undefined>
|
|
120
|
+
fetchBlocklist: () => Promise<string[]>
|
|
121
|
+
fetchStatus: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>
|
|
122
|
+
fetchDisappearingDuration: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>
|
|
123
|
+
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>
|
|
124
|
+
removeProfilePicture: (jid: string) => Promise<void>
|
|
125
|
+
updateProfileStatus: (status: string) => Promise<void>
|
|
126
|
+
updateProfileName: (name: string) => Promise<void>
|
|
127
|
+
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>
|
|
128
|
+
updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>
|
|
129
|
+
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
|
|
130
|
+
updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>
|
|
131
|
+
updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
|
|
132
|
+
updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
|
|
133
|
+
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>
|
|
134
|
+
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>
|
|
135
|
+
updateDefaultDisappearingMode: (duration: number) => Promise<void>
|
|
136
|
+
getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>
|
|
137
|
+
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>
|
|
138
|
+
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>
|
|
139
|
+
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>
|
|
140
|
+
addLabel: (jid: string, labels: import("../Types/Label").LabelActionBody) => Promise<void>
|
|
141
|
+
addChatLabel: (jid: string, labelId: string) => Promise<void>
|
|
142
|
+
removeChatLabel: (jid: string, labelId: string) => Promise<void>
|
|
143
|
+
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
|
|
144
|
+
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
|
|
145
|
+
clearMessage: (jid: string, key: import("../Types").WAProto.IMessageKey, timeStamp: number | import("long").Long) => Promise<void>
|
|
146
|
+
star: (jid: string, messages: {
|
|
147
|
+
id: string
|
|
148
|
+
fromMe?: boolean | undefined
|
|
149
|
+
}[], star: boolean) => Promise<void>
|
|
150
|
+
addOrEditContact: (jid: string, contact: ContactAction) => Promise<void>
|
|
151
|
+
removeContact: (jid: string) => Promise<void>
|
|
152
|
+
executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>
|
|
153
|
+
type: "md"
|
|
154
|
+
ws: import("./Client").WebSocketClient
|
|
155
|
+
ev: import("../Types").BaileysEventEmitter & {
|
|
156
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void
|
|
157
|
+
buffer(): void
|
|
158
|
+
createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>
|
|
159
|
+
flush(force?: boolean | undefined): boolean
|
|
160
|
+
isBuffering(): boolean
|
|
161
|
+
}
|
|
162
|
+
authState: {
|
|
163
|
+
creds: import("../Types").AuthenticationCreds
|
|
164
|
+
keys: import("../Types").SignalKeyStoreWithTransaction
|
|
165
|
+
}
|
|
166
|
+
signalRepository: import("../Types").SignalRepository
|
|
167
|
+
user: import("../Types").Contact | undefined
|
|
168
|
+
generateMessageTag: () => string
|
|
169
|
+
query: (node: import("..").BinaryNode, timeoutMs?: number | undefined) => Promise<import("..").BinaryNode>
|
|
170
|
+
waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>
|
|
171
|
+
waitForSocketOpen: () => Promise<void>
|
|
172
|
+
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>
|
|
173
|
+
sendNode: (frame: import("..").BinaryNode) => Promise<void>
|
|
174
|
+
logout: (msg?: string | undefined) => Promise<void>
|
|
175
|
+
end: (error: Error | undefined) => void
|
|
176
|
+
onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void
|
|
177
|
+
uploadPreKeys: (count?: number) => Promise<void>
|
|
178
|
+
uploadPreKeysToServerIfRequired: () => Promise<void>
|
|
179
|
+
requestPairingCode: (phoneNumber: string, code?: string) => Promise<string>
|
|
180
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>
|
|
181
|
+
sendWAMBuffer: (wamBuffer: Buffer) => Promise<import("..").BinaryNode>
|
|
182
|
+
}
|
|
183
|
+
export default makeWASocket
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict"
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true })
|
|
3
|
+
const Defaults_1 = require("../Defaults")
|
|
4
|
+
const business_1 = require("./business")
|
|
5
|
+
// export the last socket layer
|
|
6
|
+
const makeWASocket = (config) => (business_1.makeBusinessSocket({
|
|
7
|
+
...Defaults_1.DEFAULT_CONNECTION_CONFIG,
|
|
8
|
+
...config
|
|
9
|
+
}))
|
|
10
|
+
exports.default = makeWASocket
|