gifted-baileys 1.5.0 → 1.5.4
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 +1 -1
- package/README.md +1429 -684
- package/WAProto/WAProto.proto +969 -88
- package/WAProto/index.d.ts +13199 -1260
- package/WAProto/index.js +124901 -74525
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.d.ts +2 -2
- package/lib/Defaults/index.js +6 -5
- package/lib/Defaults/phonenumber-mcc.json +221 -221
- package/lib/Signal/libsignal.js +18 -9
- package/lib/Socket/Client/abstract-socket-client.d.ts +0 -2
- package/lib/Socket/Client/index.d.ts +2 -3
- package/lib/Socket/Client/index.js +2 -3
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -1
- package/lib/Socket/Client/types.d.ts +17 -0
- package/lib/Socket/Client/types.js +13 -0
- package/lib/Socket/Client/{web-socket-client.d.ts → websocket.d.ts} +1 -1
- package/lib/Socket/Client/{web-socket-client.js → websocket.js} +2 -2
- package/lib/Socket/business.d.ts +64 -29
- package/lib/Socket/business.js +1 -0
- package/lib/Socket/chats.d.ts +10 -8
- package/lib/Socket/chats.js +114 -97
- package/lib/Socket/groups.d.ts +10 -8
- package/lib/Socket/groups.js +4 -2
- package/lib/Socket/index.d.ts +70 -35
- package/lib/Socket/messages-recv.d.ts +63 -29
- package/lib/Socket/messages-recv.js +374 -155
- package/lib/Socket/messages-send.d.ts +48 -12
- package/lib/Socket/messages-send.js +445 -87
- package/lib/Socket/newsletter.d.ts +132 -0
- package/lib/Socket/newsletter.js +236 -0
- package/lib/Socket/registration.d.ts +73 -41
- package/lib/Socket/registration.js +7 -7
- package/lib/Socket/socket.d.ts +2 -0
- package/lib/Socket/socket.js +56 -15
- package/lib/Socket/usync.d.ts +37 -0
- package/lib/Socket/usync.js +70 -0
- package/lib/Store/make-cache-manager-store.d.ts +2 -1
- package/lib/Store/make-in-memory-store.d.ts +2 -1
- package/lib/Store/make-in-memory-store.js +40 -46
- package/lib/Store/make-ordered-dictionary.d.ts +1 -1
- package/lib/Types/Auth.d.ts +2 -1
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Chat.d.ts +12 -7
- package/lib/Types/Events.d.ts +17 -2
- package/lib/Types/GroupMetadata.d.ts +6 -2
- package/lib/Types/Label.d.ts +11 -0
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Message.d.ts +184 -12
- package/lib/Types/Newsletter.d.ts +92 -0
- package/lib/Types/Newsletter.js +32 -0
- package/lib/Types/Socket.d.ts +7 -2
- package/lib/Types/USync.d.ts +25 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.d.ts +10 -0
- package/lib/Types/index.js +2 -1
- package/lib/Utils/auth-utils.js +5 -3
- package/lib/Utils/business.d.ts +1 -1
- package/lib/Utils/business.js +2 -2
- package/lib/Utils/chat-utils.d.ts +11 -12
- package/lib/Utils/chat-utils.js +41 -20
- package/lib/Utils/crypto.d.ts +15 -16
- package/lib/Utils/crypto.js +35 -23
- package/lib/Utils/decode-wa-message.d.ts +17 -0
- package/lib/Utils/decode-wa-message.js +65 -13
- package/lib/Utils/generics.d.ts +11 -17
- package/lib/Utils/generics.js +47 -13
- package/lib/Utils/history.d.ts +6 -2
- package/lib/Utils/history.js +3 -0
- package/lib/Utils/link-preview.js +1 -1
- package/lib/Utils/logger.d.ts +1 -3
- package/lib/Utils/make-mutex.d.ts +2 -2
- package/lib/Utils/messages-media.d.ts +31 -25
- package/lib/Utils/messages-media.js +95 -53
- package/lib/Utils/messages.d.ts +2 -1
- package/lib/Utils/messages.js +515 -34
- package/lib/Utils/noise-handler.d.ts +6 -6
- package/lib/Utils/noise-handler.js +16 -3
- package/lib/Utils/process-message.js +4 -3
- package/lib/Utils/signal.d.ts +2 -1
- package/lib/Utils/signal.js +11 -19
- package/lib/Utils/use-multi-file-auth-state.js +11 -3
- package/lib/Utils/validate-connection.js +16 -2
- package/lib/WABinary/decode.d.ts +1 -2
- package/lib/WABinary/decode.js +17 -7
- package/lib/WABinary/encode.d.ts +1 -2
- package/lib/WABinary/encode.js +33 -17
- package/lib/WABinary/generic-utils.d.ts +2 -3
- package/lib/WABinary/generic-utils.js +2 -2
- package/lib/WABinary/jid-utils.d.ts +4 -2
- package/lib/WABinary/jid-utils.js +4 -1
- package/lib/WAM/BinaryInfo.d.ts +8 -0
- package/lib/WAM/BinaryInfo.js +13 -0
- package/lib/WAM/constants.d.ts +38 -0
- package/lib/WAM/constants.js +15350 -0
- package/lib/WAM/encode.d.ts +2 -0
- package/lib/WAM/encode.js +155 -0
- package/lib/WAM/index.d.ts +3 -0
- package/lib/WAM/index.js +19 -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 +57 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -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 +4 -0
- package/lib/WAUSync/Protocols/index.js +20 -0
- package/lib/WAUSync/USyncQuery.d.ts +26 -0
- package/lib/WAUSync/USyncQuery.js +79 -0
- package/lib/WAUSync/USyncUser.d.ts +10 -0
- package/lib/WAUSync/USyncUser.js +22 -0
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/WAUSync/index.js +19 -0
- package/lib/gifted +1 -0
- package/lib/index.js +2 -0
- package/package.json +10 -7
- package/lib/index.d.ts +0 -10
package/lib/Socket/groups.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { proto } from '../../WAProto';
|
|
|
3
3
|
import { GroupMetadata, ParticipantAction, SocketConfig } from '../Types';
|
|
4
4
|
import { BinaryNode } from '../WABinary';
|
|
5
5
|
export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
6
|
+
groupQuery: (jid: string, type: 'get' | 'set', content: BinaryNode[]) => Promise<BinaryNode>;
|
|
6
7
|
groupMetadata: (jid: string) => Promise<GroupMetadata>;
|
|
7
8
|
groupCreate: (subject: string, participants: string[]) => Promise<GroupMetadata>;
|
|
8
9
|
groupLeave: (id: string) => Promise<void>;
|
|
@@ -37,6 +38,7 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
37
38
|
groupFetchAllParticipating: () => Promise<{
|
|
38
39
|
[_: string]: GroupMetadata;
|
|
39
40
|
}>;
|
|
41
|
+
interactiveQuery: (userNodes: BinaryNode[], queryNode: BinaryNode) => Promise<BinaryNode[]>;
|
|
40
42
|
processingMutex: {
|
|
41
43
|
mutex<T>(code: () => T | Promise<T>): Promise<T>;
|
|
42
44
|
};
|
|
@@ -45,18 +47,16 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
45
47
|
}>;
|
|
46
48
|
upsertMessage: (msg: proto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
47
49
|
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
50
|
+
fetchUserLid: (jid: string) => Promise<string | undefined>;
|
|
48
51
|
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
|
|
49
52
|
presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
|
|
50
|
-
profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
|
|
51
53
|
onWhatsApp: (...jids: string[]) => Promise<{
|
|
52
|
-
exists: boolean;
|
|
53
54
|
jid: string;
|
|
54
|
-
|
|
55
|
+
exists: unknown;
|
|
56
|
+
}[] | undefined>;
|
|
55
57
|
fetchBlocklist: () => Promise<string[]>;
|
|
56
|
-
fetchStatus: (
|
|
57
|
-
|
|
58
|
-
setAt: Date;
|
|
59
|
-
} | undefined>;
|
|
58
|
+
fetchStatus: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>;
|
|
59
|
+
fetchDisappearingDuration: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>;
|
|
60
60
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
61
61
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
62
62
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
@@ -81,6 +81,7 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
81
81
|
id: string;
|
|
82
82
|
fromMe?: boolean | undefined;
|
|
83
83
|
}[], star: boolean) => Promise<void>;
|
|
84
|
+
executeUSyncQuery: (usyncQuery: import("../index").USyncQuery) => Promise<import("../index").USyncQueryResult | undefined>;
|
|
84
85
|
type: "md";
|
|
85
86
|
ws: any;
|
|
86
87
|
ev: import("../Types").BaileysEventEmitter & {
|
|
@@ -107,7 +108,8 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
107
108
|
onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
|
|
108
109
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
109
110
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
110
|
-
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
111
|
+
requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
|
|
111
112
|
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
|
113
|
+
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
|
|
112
114
|
};
|
|
113
115
|
export declare const extractGroupMetadata: (result: BinaryNode) => GroupMetadata;
|
package/lib/Socket/groups.js
CHANGED
|
@@ -67,6 +67,7 @@ const makeGroupsSocket = (config) => {
|
|
|
67
67
|
});
|
|
68
68
|
return {
|
|
69
69
|
...sock,
|
|
70
|
+
groupQuery,
|
|
70
71
|
groupMetadata,
|
|
71
72
|
groupCreate: async (subject, participants) => {
|
|
72
73
|
const key = (0, Utils_1.generateMessageID)();
|
|
@@ -261,7 +262,7 @@ const makeGroupsSocket = (config) => {
|
|
|
261
262
|
};
|
|
262
263
|
exports.makeGroupsSocket = makeGroupsSocket;
|
|
263
264
|
const extractGroupMetadata = (result) => {
|
|
264
|
-
var _a;
|
|
265
|
+
var _a, _b;
|
|
265
266
|
const group = (0, WABinary_1.getBinaryNodeChild)(result, 'group');
|
|
266
267
|
const descChild = (0, WABinary_1.getBinaryNodeChild)(group, 'description');
|
|
267
268
|
let desc;
|
|
@@ -283,6 +284,7 @@ const extractGroupMetadata = (result) => {
|
|
|
283
284
|
owner: group.attrs.creator ? (0, WABinary_1.jidNormalizedUser)(group.attrs.creator) : undefined,
|
|
284
285
|
desc,
|
|
285
286
|
descId,
|
|
287
|
+
linkedParent: ((_b = (0, WABinary_1.getBinaryNodeChild)(group, 'linked_parent')) === null || _b === void 0 ? void 0 : _b.attrs.jid) || undefined,
|
|
286
288
|
restrict: !!(0, WABinary_1.getBinaryNodeChild)(group, 'locked'),
|
|
287
289
|
announce: !!(0, WABinary_1.getBinaryNodeChild)(group, 'announcement'),
|
|
288
290
|
isCommunity: !!(0, WABinary_1.getBinaryNodeChild)(group, 'parent'),
|
|
@@ -295,7 +297,7 @@ const extractGroupMetadata = (result) => {
|
|
|
295
297
|
admin: (attrs.type || null),
|
|
296
298
|
};
|
|
297
299
|
}),
|
|
298
|
-
ephemeralDuration: eph ? +eph :
|
|
300
|
+
ephemeralDuration: eph ? +eph : 0
|
|
299
301
|
};
|
|
300
302
|
return metadata;
|
|
301
303
|
};
|
package/lib/Socket/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { UserFacingSocketConfig } from '../Types';
|
|
3
2
|
declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
4
3
|
register: (code: string) => Promise<import("./registration").ExistsResponse>;
|
|
5
|
-
requestRegistrationCode: (registrationOptions?: import("./registration").RegistrationOptions
|
|
4
|
+
requestRegistrationCode: (registrationOptions?: import("./registration").RegistrationOptions) => Promise<import("./registration").ExistsResponse>;
|
|
5
|
+
logger: Logger;
|
|
6
6
|
getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
|
|
7
7
|
getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
|
|
8
8
|
products: import("../Types").Product[];
|
|
9
|
-
nextPageCursor:
|
|
9
|
+
nextPageCursor: any;
|
|
10
10
|
}>;
|
|
11
|
-
getCollections: (jid?: string
|
|
11
|
+
getCollections: (jid?: string, limit?: number) => Promise<{
|
|
12
12
|
collections: import("../Types").CatalogCollection[];
|
|
13
13
|
}>;
|
|
14
14
|
productCreate: (create: import("../Types").ProductCreate) => Promise<import("../Types").Product>;
|
|
@@ -16,25 +16,59 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
|
16
16
|
deleted: number;
|
|
17
17
|
}>;
|
|
18
18
|
productUpdate: (productId: string, update: import("../Types").ProductUpdate) => Promise<import("../Types").Product>;
|
|
19
|
-
sendMessageAck: ({ tag, attrs }: import("
|
|
20
|
-
sendRetryRequest: (node: import("
|
|
19
|
+
sendMessageAck: ({ tag, attrs, content }: import("..").BinaryNode, errorCode?: number) => Promise<void>;
|
|
20
|
+
sendRetryRequest: (node: import("..").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
|
|
21
|
+
offerCall: (toJid: string, isVideo?: boolean) => Promise<{
|
|
22
|
+
id: any;
|
|
23
|
+
to: string;
|
|
24
|
+
}>;
|
|
21
25
|
rejectCall: (callId: string, callFrom: string) => Promise<void>;
|
|
22
|
-
|
|
26
|
+
fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number) => Promise<string>;
|
|
27
|
+
requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<string | undefined>;
|
|
28
|
+
getPrivacyTokens: (jids: string[]) => Promise<import("..").BinaryNode>;
|
|
23
29
|
assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
|
|
24
|
-
relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
|
|
30
|
+
relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
|
|
25
31
|
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
26
|
-
sendReceipts: (keys: import("../Types").
|
|
27
|
-
getButtonArgs: (message: import("../Types").WAProto.IMessage) =>
|
|
28
|
-
|
|
29
|
-
};
|
|
30
|
-
readMessages: (keys: import("../Types").WAProto.IMessageKey[]) => Promise<void>;
|
|
32
|
+
sendReceipts: (keys: import("../Types").WAMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
33
|
+
getButtonArgs: (message: import("../Types").WAProto.IMessage) => import("..").BinaryNode["attrs"];
|
|
34
|
+
readMessages: (keys: import("../Types").WAMessageKey[]) => Promise<void>;
|
|
31
35
|
refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
|
|
36
|
+
getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("..").JidWithDevice[]>;
|
|
37
|
+
sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
|
|
38
|
+
createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: import("..").BinaryNode["attrs"]) => Promise<{
|
|
39
|
+
nodes: import("..").BinaryNode[];
|
|
40
|
+
shouldIncludeDeviceIdentity: boolean;
|
|
41
|
+
}>;
|
|
32
42
|
waUploadToServer: import("../Types").WAMediaUploadFunction;
|
|
33
43
|
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
34
44
|
[_: string]: string;
|
|
35
45
|
}>;
|
|
36
46
|
updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
|
|
47
|
+
sendStatusMentions: (content: import("../Types").AnyMessageContent, jids?: string[]) => Promise<import("../Types").WAProto.WebMessageInfo>;
|
|
48
|
+
sendAlbumMessage: (jid: string, medias: import("../Types").Media[], options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo>;
|
|
37
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) => 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
|
+
newsletterAction: (jid: string, type: "follow" | "unfollow" | "mute" | "unmute") => Promise<void>;
|
|
63
|
+
newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
|
|
64
|
+
newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole) => Promise<import("../Types").NewsletterMetadata>;
|
|
65
|
+
newsletterAdminCount: (jid: string) => Promise<number>;
|
|
66
|
+
newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
|
|
67
|
+
newsletterDemote: (jid: string, user: string) => Promise<void>;
|
|
68
|
+
newsletterDelete: (jid: string) => Promise<void>;
|
|
69
|
+
newsletterReactMessage: (jid: string, serverId: string, code?: string) => Promise<void>;
|
|
70
|
+
newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
71
|
+
newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
38
72
|
groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
|
|
39
73
|
groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
|
|
40
74
|
groupLeave: (id: string) => Promise<void>;
|
|
@@ -42,36 +76,36 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
|
42
76
|
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
43
77
|
[key: string]: string;
|
|
44
78
|
}[]>;
|
|
45
|
-
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "
|
|
79
|
+
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
|
|
46
80
|
status: string;
|
|
47
81
|
jid: string;
|
|
48
82
|
}[]>;
|
|
49
83
|
groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
|
|
50
84
|
status: string;
|
|
51
85
|
jid: string;
|
|
52
|
-
content: import("
|
|
86
|
+
content: import("..").BinaryNode;
|
|
53
87
|
}[]>;
|
|
54
|
-
groupUpdateDescription: (jid: string, description?: string
|
|
88
|
+
groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
55
89
|
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
56
90
|
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
57
91
|
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
58
92
|
groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
|
|
59
93
|
groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
|
|
60
94
|
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
61
|
-
groupSettingUpdate: (jid: string, setting: "announcement" | "
|
|
62
|
-
groupMemberAddMode: (jid: string, mode: "
|
|
95
|
+
groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
|
|
96
|
+
groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
|
|
63
97
|
groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
|
|
64
98
|
groupFetchAllParticipating: () => Promise<{
|
|
65
99
|
[_: string]: import("../Types").GroupMetadata;
|
|
66
100
|
}>;
|
|
67
101
|
processingMutex: {
|
|
68
|
-
mutex<T>(code: () => T |
|
|
102
|
+
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
69
103
|
};
|
|
70
104
|
upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
71
105
|
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
72
|
-
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string
|
|
73
|
-
presenceSubscribe: (toJid: string, tcToken?: Buffer
|
|
74
|
-
profilePictureUrl: (jid: string, type?: "
|
|
106
|
+
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
107
|
+
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
|
108
|
+
profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
|
|
75
109
|
onWhatsApp: (...jids: string[]) => Promise<{
|
|
76
110
|
exists: boolean;
|
|
77
111
|
jid: string;
|
|
@@ -93,25 +127,25 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
|
93
127
|
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
|
94
128
|
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
95
129
|
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
96
|
-
getBusinessProfile: (jid: string) => Promise<
|
|
130
|
+
getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
|
|
97
131
|
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
98
132
|
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
|
99
|
-
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?:
|
|
133
|
+
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
|
|
100
134
|
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
101
135
|
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
102
136
|
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
103
137
|
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
104
138
|
star: (jid: string, messages: {
|
|
105
139
|
id: string;
|
|
106
|
-
fromMe?: boolean
|
|
140
|
+
fromMe?: boolean;
|
|
107
141
|
}[], star: boolean) => Promise<void>;
|
|
108
142
|
type: "md";
|
|
109
143
|
ws: any;
|
|
110
144
|
ev: import("../Types").BaileysEventEmitter & {
|
|
111
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
145
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
|
|
112
146
|
buffer(): void;
|
|
113
|
-
createBufferedFunction<A extends any[],
|
|
114
|
-
flush(force?: boolean
|
|
147
|
+
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
|
|
148
|
+
flush(force?: boolean): boolean;
|
|
115
149
|
isBuffering(): boolean;
|
|
116
150
|
};
|
|
117
151
|
authState: {
|
|
@@ -121,17 +155,18 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
|
121
155
|
signalRepository: import("../Types").SignalRepository;
|
|
122
156
|
user: import("../Types").Contact | undefined;
|
|
123
157
|
generateMessageTag: () => string;
|
|
124
|
-
query: (node: import("
|
|
125
|
-
waitForMessage: <
|
|
158
|
+
query: (node: import("..").BinaryNode, timeoutMs?: number) => Promise<import("..").BinaryNode>;
|
|
159
|
+
waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T>;
|
|
126
160
|
waitForSocketOpen: () => Promise<void>;
|
|
127
161
|
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
128
|
-
sendNode: (frame: import("
|
|
129
|
-
logout: (msg?: string
|
|
162
|
+
sendNode: (frame: import("..").BinaryNode) => Promise<void>;
|
|
163
|
+
logout: (msg?: string) => Promise<void>;
|
|
130
164
|
end: (error: Error | undefined) => void;
|
|
131
|
-
onUnexpectedError: (err: Error |
|
|
165
|
+
onUnexpectedError: (err: Error | Boom, msg: string) => void;
|
|
132
166
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
133
167
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
134
|
-
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
135
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number
|
|
168
|
+
requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
|
|
169
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
|
|
170
|
+
sendWAMBuffer: (wamBuffer: Buffer) => Promise<import("..").BinaryNode>;
|
|
136
171
|
};
|
|
137
172
|
export default makeWASocket;
|
|
@@ -1,28 +1,61 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { Boom } from '@hapi/boom';
|
|
3
2
|
import { proto } from '../../WAProto';
|
|
4
|
-
import { MessageReceiptType, MessageRelayOptions, SocketConfig } from '../Types';
|
|
3
|
+
import { MessageReceiptType, MessageRelayOptions, SocketConfig, WAMessageKey } from '../Types';
|
|
5
4
|
import { BinaryNode } from '../WABinary';
|
|
6
5
|
export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
|
|
7
|
-
sendMessageAck: ({ tag, attrs }: BinaryNode) => Promise<void>;
|
|
6
|
+
sendMessageAck: ({ tag, attrs, content }: BinaryNode, errorCode?: number) => Promise<void>;
|
|
8
7
|
sendRetryRequest: (node: BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
|
|
8
|
+
offerCall: (toJid: string, isVideo?: boolean) => Promise<{
|
|
9
|
+
id: any;
|
|
10
|
+
to: string;
|
|
11
|
+
}>;
|
|
9
12
|
rejectCall: (callId: string, callFrom: string) => Promise<void>;
|
|
13
|
+
fetchMessageHistory: (count: number, oldestMsgKey: WAMessageKey, oldestMsgTimestamp: number) => Promise<string>;
|
|
14
|
+
requestPlaceholderResend: (messageKey: WAMessageKey) => Promise<string | undefined>;
|
|
10
15
|
getPrivacyTokens: (jids: string[]) => Promise<BinaryNode>;
|
|
11
16
|
assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
|
|
12
|
-
relayMessage: (jid: string, message: proto.IMessage, { messageId: msgId, participant, additionalAttributes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: MessageRelayOptions) => Promise<string>;
|
|
17
|
+
relayMessage: (jid: string, message: proto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: MessageRelayOptions) => Promise<string>;
|
|
13
18
|
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: MessageReceiptType) => Promise<void>;
|
|
14
|
-
sendReceipts: (keys:
|
|
15
|
-
getButtonArgs: (message: proto.IMessage) =>
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
readMessages: (keys: proto.IMessageKey[]) => Promise<void>;
|
|
19
|
+
sendReceipts: (keys: WAMessageKey[], type: MessageReceiptType) => Promise<void>;
|
|
20
|
+
getButtonArgs: (message: proto.IMessage) => BinaryNode["attrs"];
|
|
21
|
+
readMessages: (keys: WAMessageKey[]) => Promise<void>;
|
|
19
22
|
refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
|
|
23
|
+
getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../WABinary").JidWithDevice[]>;
|
|
24
|
+
sendPeerDataOperationMessage: (pdoMessage: proto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
|
|
25
|
+
createParticipantNodes: (jids: string[], message: proto.IMessage, extraAttrs?: BinaryNode["attrs"]) => Promise<{
|
|
26
|
+
nodes: BinaryNode[];
|
|
27
|
+
shouldIncludeDeviceIdentity: boolean;
|
|
28
|
+
}>;
|
|
20
29
|
waUploadToServer: import("../Types").WAMediaUploadFunction;
|
|
21
30
|
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
22
31
|
[_: string]: string;
|
|
23
32
|
}>;
|
|
24
33
|
updateMediaMessage: (message: proto.IWebMessageInfo) => Promise<proto.IWebMessageInfo>;
|
|
34
|
+
sendStatusMentions: (content: import("../Types").AnyMessageContent, jids?: string[]) => Promise<proto.WebMessageInfo>;
|
|
35
|
+
sendAlbumMessage: (jid: string, medias: import("../Types").Media[], options?: import("../Types").MiscMessageGenerationOptions) => Promise<proto.WebMessageInfo>;
|
|
25
36
|
sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<proto.WebMessageInfo | undefined>;
|
|
37
|
+
subscribeNewsletterUpdates: (jid: string) => Promise<{
|
|
38
|
+
duration: string;
|
|
39
|
+
}>;
|
|
40
|
+
newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
|
|
41
|
+
newsletterUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
42
|
+
newsletterUpdateName: (jid: string, name: string) => Promise<void>;
|
|
43
|
+
newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
44
|
+
newsletterRemovePicture: (jid: string) => Promise<void>;
|
|
45
|
+
newsletterUnfollow: (jid: string) => Promise<void>;
|
|
46
|
+
newsletterFollow: (jid: string) => Promise<void>;
|
|
47
|
+
newsletterUnmute: (jid: string) => Promise<void>;
|
|
48
|
+
newsletterMute: (jid: string) => Promise<void>;
|
|
49
|
+
newsletterAction: (jid: string, type: "follow" | "unfollow" | "mute" | "unmute") => Promise<void>;
|
|
50
|
+
newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
|
|
51
|
+
newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole) => Promise<import("../Types").NewsletterMetadata>;
|
|
52
|
+
newsletterAdminCount: (jid: string) => Promise<number>;
|
|
53
|
+
newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
|
|
54
|
+
newsletterDemote: (jid: string, user: string) => Promise<void>;
|
|
55
|
+
newsletterDelete: (jid: string) => Promise<void>;
|
|
56
|
+
newsletterReactMessage: (jid: string, serverId: string, code?: string) => Promise<void>;
|
|
57
|
+
newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
58
|
+
newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
26
59
|
groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
|
|
27
60
|
groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
|
|
28
61
|
groupLeave: (id: string) => Promise<void>;
|
|
@@ -30,7 +63,7 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
|
|
|
30
63
|
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
31
64
|
[key: string]: string;
|
|
32
65
|
}[]>;
|
|
33
|
-
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "
|
|
66
|
+
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
|
|
34
67
|
status: string;
|
|
35
68
|
jid: string;
|
|
36
69
|
}[]>;
|
|
@@ -39,27 +72,27 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
|
|
|
39
72
|
jid: string;
|
|
40
73
|
content: BinaryNode;
|
|
41
74
|
}[]>;
|
|
42
|
-
groupUpdateDescription: (jid: string, description?: string
|
|
75
|
+
groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
43
76
|
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
44
77
|
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
45
78
|
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
46
79
|
groupAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
|
|
47
80
|
groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
|
|
48
81
|
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
49
|
-
groupSettingUpdate: (jid: string, setting: "announcement" | "
|
|
50
|
-
groupMemberAddMode: (jid: string, mode: "
|
|
82
|
+
groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
|
|
83
|
+
groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
|
|
51
84
|
groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
|
|
52
85
|
groupFetchAllParticipating: () => Promise<{
|
|
53
86
|
[_: string]: import("../Types").GroupMetadata;
|
|
54
87
|
}>;
|
|
55
88
|
processingMutex: {
|
|
56
|
-
mutex<T>(code: () => T |
|
|
89
|
+
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
57
90
|
};
|
|
58
91
|
upsertMessage: (msg: proto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
59
92
|
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
60
|
-
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string
|
|
61
|
-
presenceSubscribe: (toJid: string, tcToken?: Buffer
|
|
62
|
-
profilePictureUrl: (jid: string, type?: "
|
|
93
|
+
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
94
|
+
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
|
95
|
+
profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
|
|
63
96
|
onWhatsApp: (...jids: string[]) => Promise<{
|
|
64
97
|
exists: boolean;
|
|
65
98
|
jid: string;
|
|
@@ -81,25 +114,25 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
|
|
|
81
114
|
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
|
82
115
|
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
83
116
|
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
84
|
-
getBusinessProfile: (jid: string) => Promise<
|
|
117
|
+
getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
|
|
85
118
|
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
86
119
|
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
|
87
|
-
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?:
|
|
120
|
+
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
|
|
88
121
|
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
89
122
|
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
90
123
|
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
91
124
|
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
92
125
|
star: (jid: string, messages: {
|
|
93
126
|
id: string;
|
|
94
|
-
fromMe?: boolean
|
|
127
|
+
fromMe?: boolean;
|
|
95
128
|
}[], star: boolean) => Promise<void>;
|
|
96
129
|
type: "md";
|
|
97
130
|
ws: any;
|
|
98
131
|
ev: import("../Types").BaileysEventEmitter & {
|
|
99
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
132
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
|
|
100
133
|
buffer(): void;
|
|
101
|
-
createBufferedFunction<A extends any[],
|
|
102
|
-
flush(force?: boolean
|
|
134
|
+
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
|
|
135
|
+
flush(force?: boolean): boolean;
|
|
103
136
|
isBuffering(): boolean;
|
|
104
137
|
};
|
|
105
138
|
authState: {
|
|
@@ -109,16 +142,17 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
|
|
|
109
142
|
signalRepository: import("../Types").SignalRepository;
|
|
110
143
|
user: import("../Types").Contact | undefined;
|
|
111
144
|
generateMessageTag: () => string;
|
|
112
|
-
query: (node: BinaryNode, timeoutMs?: number
|
|
113
|
-
waitForMessage: <
|
|
145
|
+
query: (node: BinaryNode, timeoutMs?: number) => Promise<BinaryNode>;
|
|
146
|
+
waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T>;
|
|
114
147
|
waitForSocketOpen: () => Promise<void>;
|
|
115
148
|
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
116
149
|
sendNode: (frame: BinaryNode) => Promise<void>;
|
|
117
|
-
logout: (msg?: string
|
|
150
|
+
logout: (msg?: string) => Promise<void>;
|
|
118
151
|
end: (error: Error | undefined) => void;
|
|
119
|
-
onUnexpectedError: (err: Error | Boom
|
|
152
|
+
onUnexpectedError: (err: Error | Boom, msg: string) => void;
|
|
120
153
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
121
154
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
122
|
-
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
123
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number
|
|
155
|
+
requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
|
|
156
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
|
|
157
|
+
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
|
|
124
158
|
};
|