@kyyinfinite/baileys 1.0.0 → 2.0.0
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/README.md +408 -64
- package/WAProto/WAProto.proto +360 -916
- package/WAProto/fix-imports.js +22 -18
- package/WAProto/index.d.ts +14015 -0
- package/WAProto/index.js +47122 -81757
- package/engine-requirements.js +10 -0
- package/lib/Defaults/index.d.ts +15 -14
- package/lib/Defaults/index.d.ts.map +1 -1
- package/lib/Defaults/index.js +99 -107
- package/lib/Defaults/index.js.map +1 -1
- package/lib/Kyyinfinite/AIRich.js +2041 -0
- package/lib/Kyyinfinite/BaseBuilder.js +64 -0
- package/lib/Kyyinfinite/Button.js +341 -0
- package/lib/Kyyinfinite/ButtonV2.js +175 -0
- package/lib/Kyyinfinite/Carousel.js +125 -0
- package/lib/Kyyinfinite/Foad.js +542 -0
- package/lib/Kyyinfinite/Foad2.js +466 -0
- package/lib/Kyyinfinite/Simple/AIBuilder.js +18 -0
- package/lib/Kyyinfinite/Simple/BuilderFactories.js +17 -0
- package/lib/Kyyinfinite/Simple/ButtonBuilder.js +107 -0
- package/lib/Kyyinfinite/Simple/CardBuilder.js +179 -0
- package/lib/Kyyinfinite/Simple/CarouselBuilder.js +97 -0
- package/lib/Kyyinfinite/Simple/FoadBuilder.js +18 -0
- package/lib/Kyyinfinite/Simple/MediaBuilder.js +35 -0
- package/lib/Kyyinfinite/Simple/MessageBuilder.js +41 -0
- package/lib/Kyyinfinite/Simple/MessageTypesBuilder.js +3 -0
- package/lib/Kyyinfinite/Simple/SimpleBuilder.js +28 -0
- package/lib/Kyyinfinite/Simple/SimpleClient.js +83 -0
- package/lib/Kyyinfinite/Simple/TextBuilder.js +22 -0
- package/lib/Kyyinfinite/Simple/index.d.ts +141 -0
- package/lib/Kyyinfinite/Simple/index.js +31 -0
- package/lib/Kyyinfinite/Toolkit.js +453 -0
- package/lib/Kyyinfinite/constants.js +1 -0
- package/lib/Kyyinfinite/errors.js +39 -0
- package/lib/Kyyinfinite/index.d.ts +2 -0
- package/lib/Kyyinfinite/index.js +2 -0
- package/lib/Kyyinfinite/wrapper.d.ts +2 -0
- package/lib/Kyyinfinite/wrapper.js +10 -0
- package/lib/Signal/Group/group_cipher.js.map +1 -1
- package/lib/Signal/Group/keyhelper.d.ts.map +1 -1
- package/lib/Signal/Group/keyhelper.js.map +1 -1
- package/lib/Signal/Group/sender-chain-key.js.map +1 -1
- package/lib/Signal/Group/sender-key-message.js.map +1 -1
- package/lib/Signal/Group/sender-message-key.js.map +1 -1
- package/lib/Signal/libsignal.d.ts.map +1 -1
- package/lib/Signal/libsignal.js +45 -17
- package/lib/Signal/libsignal.js.map +1 -1
- package/lib/Signal/lid-mapping.d.ts +4 -0
- package/lib/Signal/lid-mapping.d.ts.map +1 -1
- package/lib/Signal/lid-mapping.js +6 -0
- package/lib/Signal/lid-mapping.js.map +1 -1
- package/lib/Socket/business.d.ts +213 -532
- package/lib/Socket/business.d.ts.map +1 -1
- package/lib/Socket/business.js +358 -401
- package/lib/Socket/chats.d.ts +16 -2
- package/lib/Socket/chats.d.ts.map +1 -1
- package/lib/Socket/chats.js +247 -40
- package/lib/Socket/chats.js.map +1 -1
- package/lib/Socket/communities.d.ts +269 -641
- package/lib/Socket/communities.d.ts.map +1 -1
- package/lib/Socket/groups.d.ts +13 -2
- package/lib/Socket/groups.d.ts.map +1 -1
- package/lib/Socket/groups.js +21 -1
- package/lib/Socket/groups.js.map +1 -1
- package/lib/Socket/index.d.ts +255 -631
- package/lib/Socket/index.d.ts.map +1 -1
- package/lib/Socket/index.js +9 -10
- package/lib/Socket/index.js.map +1 -1
- package/lib/Socket/messages-recv.d.ts +23 -58
- package/lib/Socket/messages-recv.d.ts.map +1 -1
- package/lib/Socket/messages-recv.js +645 -181
- package/lib/Socket/messages-recv.js.map +1 -1
- package/lib/Socket/messages-send.d.ts +195 -575
- package/lib/Socket/messages-send.d.ts.map +1 -1
- package/lib/Socket/messages-send.js +1099 -1549
- package/lib/Socket/messages-send.js.map +1 -1
- package/lib/Socket/mex.d.ts.map +1 -1
- package/lib/Socket/mex.js +2 -8
- package/lib/Socket/mex.js.map +1 -1
- package/lib/Socket/newsletter.d.ts +11 -18
- package/lib/Socket/newsletter.d.ts.map +1 -1
- package/lib/Socket/newsletter.js +167 -302
- package/lib/Socket/newsletter.js.map +1 -1
- package/lib/Socket/socket.d.ts +6 -2
- package/lib/Socket/socket.d.ts.map +1 -1
- package/lib/Socket/socket.js +59 -25
- package/lib/Socket/socket.js.map +1 -1
- package/lib/Types/Auth.d.ts +1 -0
- package/lib/Types/Auth.d.ts.map +1 -1
- package/lib/Types/Bussines.d.ts +22 -34
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Call.d.ts.map +1 -1
- package/lib/Types/Chat.d.ts +1 -0
- package/lib/Types/Chat.d.ts.map +1 -1
- package/lib/Types/Contact.d.ts +2 -0
- package/lib/Types/Contact.d.ts.map +1 -1
- package/lib/Types/Events.d.ts +20 -1
- package/lib/Types/Events.d.ts.map +1 -1
- package/lib/Types/GroupMetadata.d.ts +4 -1
- package/lib/Types/GroupMetadata.d.ts.map +1 -1
- package/lib/Types/Message.d.ts +239 -341
- package/lib/Types/Message.d.ts.map +1 -1
- package/lib/Types/Message.js.map +1 -1
- package/lib/Types/{Newsletter.d.ts → Mex.d.ts} +11 -5
- package/lib/Types/Mex.d.ts.map +1 -0
- package/lib/Types/{Newsletter.js → Mex.js} +9 -3
- package/lib/Types/Mex.js.map +1 -0
- package/lib/Types/Signal.d.ts +12 -1
- package/lib/Types/Signal.d.ts.map +1 -1
- package/lib/Types/Socket.d.ts +126 -148
- package/lib/Types/Socket.d.ts.map +1 -1
- package/lib/Types/State.d.ts +58 -0
- package/lib/Types/State.d.ts.map +1 -1
- package/lib/Types/State.js +43 -0
- package/lib/Types/State.js.map +1 -1
- package/lib/Types/index.d.ts +52 -52
- package/lib/Types/index.d.ts.map +1 -1
- package/lib/Types/index.js +23 -30
- package/lib/Types/index.js.map +1 -1
- package/lib/Utils/auth-utils.d.ts +5 -0
- package/lib/Utils/auth-utils.d.ts.map +1 -1
- package/lib/Utils/auth-utils.js +12 -0
- package/lib/Utils/auth-utils.js.map +1 -1
- package/lib/Utils/browser-utils.d.ts.map +1 -1
- package/lib/Utils/browser-utils.js +1 -0
- package/lib/Utils/browser-utils.js.map +1 -1
- package/lib/Utils/chat-utils.d.ts +34 -4
- package/lib/Utils/chat-utils.d.ts.map +1 -1
- package/lib/Utils/chat-utils.js +80 -20
- package/lib/Utils/chat-utils.js.map +1 -1
- package/lib/Utils/companion-reg-client-utils.d.ts +17 -0
- package/lib/Utils/companion-reg-client-utils.d.ts.map +1 -0
- package/lib/Utils/companion-reg-client-utils.js +35 -0
- package/lib/Utils/companion-reg-client-utils.js.map +1 -0
- package/lib/Utils/crypto.d.ts +12 -12
- package/lib/Utils/crypto.d.ts.map +1 -1
- package/lib/Utils/crypto.js.map +1 -1
- package/lib/Utils/decode-wa-message.d.ts +18 -0
- package/lib/Utils/decode-wa-message.d.ts.map +1 -1
- package/lib/Utils/decode-wa-message.js +34 -0
- package/lib/Utils/decode-wa-message.js.map +1 -1
- package/lib/Utils/event-buffer.d.ts +2 -0
- package/lib/Utils/event-buffer.d.ts.map +1 -1
- package/lib/Utils/event-buffer.js +49 -1
- package/lib/Utils/event-buffer.js.map +1 -1
- package/lib/Utils/generics.d.ts +3 -2
- package/lib/Utils/generics.d.ts.map +1 -1
- package/lib/Utils/generics.js +10 -1
- package/lib/Utils/generics.js.map +1 -1
- package/lib/Utils/history.d.ts +2 -0
- package/lib/Utils/history.d.ts.map +1 -1
- package/lib/Utils/history.js +12 -9
- package/lib/Utils/history.js.map +1 -1
- package/lib/Utils/identity-change-handler.d.ts +7 -0
- package/lib/Utils/identity-change-handler.d.ts.map +1 -1
- package/lib/Utils/identity-change-handler.js +1 -0
- package/lib/Utils/identity-change-handler.js.map +1 -1
- package/lib/Utils/index.d.ts +22 -25
- package/lib/Utils/index.d.ts.map +1 -1
- package/lib/Utils/index.js +2 -4
- package/lib/Utils/index.js.map +1 -1
- package/lib/Utils/link-preview.js +2 -2
- package/lib/Utils/link-preview.js.map +1 -1
- package/lib/Utils/logger.d.ts +1 -2
- package/lib/Utils/logger.d.ts.map +1 -1
- package/lib/Utils/message-retry-manager.d.ts +5 -0
- package/lib/Utils/message-retry-manager.d.ts.map +1 -1
- package/lib/Utils/message-retry-manager.js +40 -0
- package/lib/Utils/message-retry-manager.js.map +1 -1
- package/lib/Utils/messages-media.d.ts +16 -13
- package/lib/Utils/messages-media.d.ts.map +1 -1
- package/lib/Utils/messages-media.js +85 -79
- package/lib/Utils/messages-media.js.map +1 -1
- package/lib/Utils/messages.d.ts +1 -1
- package/lib/Utils/messages.d.ts.map +1 -1
- package/lib/Utils/messages.js +751 -1096
- package/lib/Utils/messages.js.map +1 -1
- package/lib/Utils/noise-handler.d.ts +1 -1
- package/lib/Utils/process-message.d.ts.map +1 -1
- package/lib/Utils/process-message.js +103 -1
- package/lib/Utils/process-message.js.map +1 -1
- package/lib/Utils/signal.d.ts +13 -0
- package/lib/Utils/signal.d.ts.map +1 -1
- package/lib/Utils/signal.js +42 -0
- package/lib/Utils/signal.js.map +1 -1
- package/lib/Utils/sync-action-utils.d.ts.map +1 -1
- package/lib/Utils/sync-action-utils.js +1 -0
- package/lib/Utils/sync-action-utils.js.map +1 -1
- package/lib/Utils/tc-token-utils.d.ts +26 -1
- package/lib/Utils/tc-token-utils.d.ts.map +1 -1
- package/lib/Utils/tc-token-utils.js +151 -5
- package/lib/Utils/tc-token-utils.js.map +1 -1
- package/lib/Utils/validate-connection.d.ts.map +1 -1
- package/lib/Utils/validate-connection.js +12 -2
- package/lib/Utils/validate-connection.js.map +1 -1
- package/lib/WABinary/decode.d.ts +1 -1
- package/lib/WABinary/decode.d.ts.map +1 -1
- package/lib/WABinary/generic-utils.d.ts +1 -3
- package/lib/WABinary/generic-utils.d.ts.map +1 -1
- package/lib/WABinary/generic-utils.js +0 -78
- package/lib/WABinary/generic-utils.js.map +1 -1
- package/lib/WAM/encode.d.ts +1 -1
- package/lib/WAM/encode.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +26 -3
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/index.d.ts +1 -0
- package/lib/WAUSync/Protocols/index.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/index.js +1 -0
- package/lib/WAUSync/Protocols/index.js.map +1 -1
- package/lib/WAUSync/USyncQuery.d.ts +1 -0
- package/lib/WAUSync/USyncQuery.d.ts.map +1 -1
- package/lib/WAUSync/USyncQuery.js +6 -2
- package/lib/WAUSync/USyncQuery.js.map +1 -1
- package/lib/WAUSync/USyncUser.d.ts +4 -0
- package/lib/WAUSync/USyncUser.d.ts.map +1 -1
- package/lib/WAUSync/USyncUser.js +8 -0
- package/lib/WAUSync/USyncUser.js.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +13 -12
- package/lib/index.js.map +1 -1
- package/package.json +93 -23
- package/LICENSE +0 -21
- package/lib/Socket/dugong.d.ts +0 -130
- package/lib/Socket/dugong.d.ts.map +0 -1
- package/lib/Socket/dugong.js +0 -768
- package/lib/Socket/dugong.js.map +0 -1
- package/lib/Types/Newsletter.d.ts.map +0 -1
- package/lib/Types/Newsletter.js.map +0 -1
- package/lib/Utils/kyy-features.d.ts +0 -158
- package/lib/Utils/kyy-features.js +0 -365
- package/lib/Utils/rich-messages.d.ts +0 -277
- package/lib/Utils/rich-messages.d.ts.map +0 -1
- package/lib/Utils/rich-messages.js +0 -1144
- package/lib/Utils/rich-messages.js.map +0 -1
- package/lib/Utils/sticker-pack.d.ts +0 -10
- package/lib/Utils/sticker-pack.js +0 -111
package/lib/Types/Message.d.ts
CHANGED
|
@@ -1,422 +1,320 @@
|
|
|
1
|
-
import type { Readable } from
|
|
2
|
-
import type { URL } from
|
|
3
|
-
import { proto } from
|
|
4
|
-
import type { MediaType } from
|
|
5
|
-
import type { BinaryNode } from
|
|
6
|
-
import type { GroupMetadata } from
|
|
7
|
-
import type { CacheStore } from
|
|
1
|
+
import type { Readable } from 'stream';
|
|
2
|
+
import type { URL } from 'url';
|
|
3
|
+
import { proto } from '../../WAProto/index.js';
|
|
4
|
+
import type { MediaType } from '../Defaults/index.js';
|
|
5
|
+
import type { BinaryNode } from '../WABinary/index.js';
|
|
6
|
+
import type { GroupMetadata } from './GroupMetadata.js';
|
|
7
|
+
import type { CacheStore } from './Socket.js';
|
|
8
8
|
export { proto as WAProto };
|
|
9
9
|
export type WAMessage = proto.IWebMessageInfo & {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
key: WAMessageKey;
|
|
11
|
+
messageStubParameters?: any;
|
|
12
|
+
category?: string;
|
|
13
|
+
retryCount?: number;
|
|
14
14
|
};
|
|
15
15
|
export type WAMessageContent = proto.IMessage;
|
|
16
16
|
export type WAContactMessage = proto.Message.IContactMessage;
|
|
17
17
|
export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage;
|
|
18
18
|
export type WAMessageKey = proto.IMessageKey & {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
remoteJidAlt?: string;
|
|
20
|
+
remoteJidUsername?: string;
|
|
21
|
+
participantAlt?: string;
|
|
22
|
+
participantUsername?: string;
|
|
23
|
+
server_id?: string;
|
|
24
|
+
addressingMode?: string;
|
|
25
|
+
isViewOnce?: boolean;
|
|
24
26
|
};
|
|
25
27
|
export type WATextMessage = proto.Message.IExtendedTextMessage;
|
|
26
28
|
export type WAContextInfo = proto.IContextInfo;
|
|
27
29
|
export type WALocationMessage = proto.Message.ILocationMessage;
|
|
28
|
-
export type WAGenericMediaMessage =
|
|
29
|
-
| proto.Message.IVideoMessage
|
|
30
|
-
| proto.Message.IImageMessage
|
|
31
|
-
| proto.Message.IAudioMessage
|
|
32
|
-
| proto.Message.IDocumentMessage
|
|
33
|
-
| proto.Message.IStickerMessage;
|
|
30
|
+
export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
|
|
34
31
|
export declare const WAMessageStubType: typeof proto.WebMessageInfo.StubType;
|
|
35
32
|
export declare const WAMessageStatus: typeof proto.WebMessageInfo.Status;
|
|
36
|
-
import type { ILogger } from
|
|
33
|
+
import type { ILogger } from '../Utils/logger.js';
|
|
37
34
|
export type WAMediaPayloadURL = {
|
|
38
|
-
|
|
35
|
+
url: URL | string;
|
|
39
36
|
};
|
|
40
37
|
export type WAMediaPayloadStream = {
|
|
41
|
-
|
|
38
|
+
stream: Readable;
|
|
42
39
|
};
|
|
43
40
|
export type WAMediaUpload = Buffer | WAMediaPayloadStream | WAMediaPayloadURL;
|
|
44
41
|
/** Set of message types that are supported by the library */
|
|
45
42
|
export type MessageType = keyof proto.Message;
|
|
46
43
|
export declare enum WAMessageAddressingMode {
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
PN = "pn",
|
|
45
|
+
LID = "lid"
|
|
49
46
|
}
|
|
50
|
-
export type MessageWithContextInfo =
|
|
51
|
-
| "imageMessage"
|
|
52
|
-
| "contactMessage"
|
|
53
|
-
| "locationMessage"
|
|
54
|
-
| "extendedTextMessage"
|
|
55
|
-
| "documentMessage"
|
|
56
|
-
| "audioMessage"
|
|
57
|
-
| "videoMessage"
|
|
58
|
-
| "call"
|
|
59
|
-
| "contactsArrayMessage"
|
|
60
|
-
| "liveLocationMessage"
|
|
61
|
-
| "templateMessage"
|
|
62
|
-
| "stickerMessage"
|
|
63
|
-
| "groupInviteMessage"
|
|
64
|
-
| "templateButtonReplyMessage"
|
|
65
|
-
| "productMessage"
|
|
66
|
-
| "listMessage"
|
|
67
|
-
| "orderMessage"
|
|
68
|
-
| "listResponseMessage"
|
|
69
|
-
| "buttonsMessage"
|
|
70
|
-
| "buttonsResponseMessage"
|
|
71
|
-
| "interactiveMessage"
|
|
72
|
-
| "interactiveResponseMessage"
|
|
73
|
-
| "pollCreationMessage"
|
|
74
|
-
| "requestPhoneNumberMessage"
|
|
75
|
-
| "messageHistoryBundle"
|
|
76
|
-
| "eventMessage"
|
|
77
|
-
| "newsletterAdminInviteMessage"
|
|
78
|
-
| "albumMessage"
|
|
79
|
-
| "stickerPackMessage"
|
|
80
|
-
| "pollResultSnapshotMessage"
|
|
81
|
-
| "messageHistoryNotice";
|
|
47
|
+
export type MessageWithContextInfo = 'imageMessage' | 'contactMessage' | 'locationMessage' | 'extendedTextMessage' | 'documentMessage' | 'audioMessage' | 'videoMessage' | 'call' | 'contactsArrayMessage' | 'liveLocationMessage' | 'templateMessage' | 'stickerMessage' | 'groupInviteMessage' | 'templateButtonReplyMessage' | 'productMessage' | 'listMessage' | 'orderMessage' | 'listResponseMessage' | 'buttonsMessage' | 'buttonsResponseMessage' | 'interactiveMessage' | 'interactiveResponseMessage' | 'pollCreationMessage' | 'requestPhoneNumberMessage' | 'messageHistoryBundle' | 'eventMessage' | 'newsletterAdminInviteMessage' | 'albumMessage' | 'stickerPackMessage' | 'pollResultSnapshotMessage' | 'messageHistoryNotice';
|
|
82
48
|
export type DownloadableMessage = {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
49
|
+
mediaKey?: Uint8Array | null;
|
|
50
|
+
directPath?: string | null;
|
|
51
|
+
url?: string | null;
|
|
86
52
|
};
|
|
87
|
-
export type MessageReceiptType =
|
|
88
|
-
| "read"
|
|
89
|
-
| "read-self"
|
|
90
|
-
| "hist_sync"
|
|
91
|
-
| "peer_msg"
|
|
92
|
-
| "sender"
|
|
93
|
-
| "inactive"
|
|
94
|
-
| "played"
|
|
95
|
-
| undefined;
|
|
53
|
+
export type MessageReceiptType = 'read' | 'read-self' | 'hist_sync' | 'peer_msg' | 'sender' | 'inactive' | 'played' | undefined;
|
|
96
54
|
export type MediaConnInfo = {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
55
|
+
auth: string;
|
|
56
|
+
ttl: number;
|
|
57
|
+
hosts: {
|
|
58
|
+
hostname: string;
|
|
59
|
+
maxContentLengthBytes: number;
|
|
60
|
+
}[];
|
|
61
|
+
fetchDate: Date;
|
|
104
62
|
};
|
|
105
63
|
export interface WAUrlInfo {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
64
|
+
'canonical-url': string;
|
|
65
|
+
'matched-text': string;
|
|
66
|
+
title: string;
|
|
67
|
+
description?: string;
|
|
68
|
+
jpegThumbnail?: Buffer;
|
|
69
|
+
highQualityThumbnail?: proto.Message.IImageMessage;
|
|
70
|
+
originalThumbnailUrl?: string;
|
|
113
71
|
}
|
|
114
72
|
type Mentionable = {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
73
|
+
/** list of jids that are mentioned in the accompanying text */
|
|
74
|
+
mentions?: string[];
|
|
75
|
+
/** mention all */
|
|
76
|
+
mentionAll?: boolean;
|
|
119
77
|
};
|
|
120
78
|
type Contextable = {
|
|
121
|
-
|
|
122
|
-
|
|
79
|
+
/** add contextInfo to the message */
|
|
80
|
+
contextInfo?: proto.IContextInfo;
|
|
123
81
|
};
|
|
124
82
|
type ViewOnce = {
|
|
125
|
-
|
|
83
|
+
viewOnce?: boolean;
|
|
126
84
|
};
|
|
127
85
|
type Editable = {
|
|
128
|
-
|
|
86
|
+
edit?: WAMessageKey;
|
|
129
87
|
};
|
|
130
88
|
type WithDimensions = {
|
|
131
|
-
|
|
132
|
-
|
|
89
|
+
width?: number;
|
|
90
|
+
height?: number;
|
|
133
91
|
};
|
|
134
92
|
export type PollMessageOptions = {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
93
|
+
name: string;
|
|
94
|
+
selectableCount?: number;
|
|
95
|
+
values: string[];
|
|
96
|
+
/** 32 byte message secret to encrypt poll selections */
|
|
97
|
+
messageSecret?: Uint8Array;
|
|
98
|
+
toAnnouncementGroup?: boolean;
|
|
141
99
|
};
|
|
142
100
|
export type EventMessageOptions = {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
101
|
+
name: string;
|
|
102
|
+
description?: string;
|
|
103
|
+
startDate: Date;
|
|
104
|
+
endDate?: Date;
|
|
105
|
+
location?: WALocationMessage;
|
|
106
|
+
call?: 'audio' | 'video';
|
|
107
|
+
isCancelled?: boolean;
|
|
108
|
+
isScheduleCall?: boolean;
|
|
109
|
+
extraGuestsAllowed?: boolean;
|
|
110
|
+
messageSecret?: Uint8Array<ArrayBufferLike>;
|
|
111
|
+
};
|
|
112
|
+
export type AlbumMessageOptions = {
|
|
113
|
+
/** Number of images expected in the album */
|
|
114
|
+
expectedImageCount?: number;
|
|
115
|
+
/** Number of videos expected in the album */
|
|
116
|
+
expectedVideoCount?: number;
|
|
153
117
|
};
|
|
154
118
|
type SharePhoneNumber = {
|
|
155
|
-
|
|
119
|
+
sharePhoneNumber: boolean;
|
|
156
120
|
};
|
|
157
121
|
type RequestPhoneNumber = {
|
|
158
|
-
|
|
122
|
+
requestPhoneNumber: boolean;
|
|
123
|
+
};
|
|
124
|
+
export type AnyMediaMessageContent = (({
|
|
125
|
+
image: WAMediaUpload;
|
|
126
|
+
caption?: string;
|
|
127
|
+
jpegThumbnail?: string;
|
|
128
|
+
} & Mentionable & Contextable & WithDimensions) | ({
|
|
129
|
+
video: WAMediaUpload;
|
|
130
|
+
caption?: string;
|
|
131
|
+
gifPlayback?: boolean;
|
|
132
|
+
jpegThumbnail?: string;
|
|
133
|
+
/** if set to true, will send as a `video note` */
|
|
134
|
+
ptv?: boolean;
|
|
135
|
+
} & Mentionable & Contextable & WithDimensions) | {
|
|
136
|
+
audio: WAMediaUpload;
|
|
137
|
+
/** if set to true, will send as a `voice note` */
|
|
138
|
+
ptt?: boolean;
|
|
139
|
+
/** optionally tell the duration of the audio */
|
|
140
|
+
seconds?: number;
|
|
141
|
+
} | ({
|
|
142
|
+
sticker: WAMediaUpload;
|
|
143
|
+
isAnimated?: boolean;
|
|
144
|
+
} & WithDimensions) | ({
|
|
145
|
+
document: WAMediaUpload;
|
|
146
|
+
mimetype: string;
|
|
147
|
+
fileName?: string;
|
|
148
|
+
caption?: string;
|
|
149
|
+
} & Contextable)) & {
|
|
150
|
+
mimetype?: string;
|
|
151
|
+
} & Editable & {
|
|
152
|
+
/** key of the parent albumMessage to associate this media with */
|
|
153
|
+
albumParentKey?: WAMessageKey;
|
|
159
154
|
};
|
|
160
|
-
export type AnyMediaMessageContent = (
|
|
161
|
-
| ({
|
|
162
|
-
image: WAMediaUpload;
|
|
163
|
-
caption?: string;
|
|
164
|
-
jpegThumbnail?: string;
|
|
165
|
-
} & Mentionable &
|
|
166
|
-
Contextable &
|
|
167
|
-
WithDimensions)
|
|
168
|
-
| ({
|
|
169
|
-
video: WAMediaUpload;
|
|
170
|
-
caption?: string;
|
|
171
|
-
gifPlayback?: boolean;
|
|
172
|
-
jpegThumbnail?: string;
|
|
173
|
-
/** if set to true, will send as a `video note` */
|
|
174
|
-
ptv?: boolean;
|
|
175
|
-
} & Mentionable &
|
|
176
|
-
Contextable &
|
|
177
|
-
WithDimensions)
|
|
178
|
-
| {
|
|
179
|
-
audio: WAMediaUpload;
|
|
180
|
-
/** if set to true, will send as a `voice note` */
|
|
181
|
-
ptt?: boolean;
|
|
182
|
-
/** optionally tell the duration of the audio */
|
|
183
|
-
seconds?: number;
|
|
184
|
-
}
|
|
185
|
-
| ({
|
|
186
|
-
sticker: WAMediaUpload;
|
|
187
|
-
isAnimated?: boolean;
|
|
188
|
-
} & WithDimensions)
|
|
189
|
-
| ({
|
|
190
|
-
document: WAMediaUpload;
|
|
191
|
-
mimetype: string;
|
|
192
|
-
fileName?: string;
|
|
193
|
-
caption?: string;
|
|
194
|
-
} & Contextable)
|
|
195
|
-
) & {
|
|
196
|
-
mimetype?: string;
|
|
197
|
-
} & Editable;
|
|
198
155
|
export type ButtonReplyInfo = {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
156
|
+
displayText: string;
|
|
157
|
+
id: string;
|
|
158
|
+
index: number;
|
|
202
159
|
};
|
|
203
160
|
export type GroupInviteInfo = {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
};
|
|
210
|
-
export type WASendableProduct = Omit<
|
|
211
|
-
proto.Message.ProductMessage.IProductSnapshot,
|
|
212
|
-
"productImage"
|
|
213
|
-
> & {
|
|
214
|
-
productImage: WAMediaUpload;
|
|
161
|
+
inviteCode: string;
|
|
162
|
+
inviteExpiration: number;
|
|
163
|
+
text: string;
|
|
164
|
+
jid: string;
|
|
165
|
+
subject: string;
|
|
215
166
|
};
|
|
216
|
-
export type
|
|
217
|
-
|
|
218
|
-
| {
|
|
219
|
-
sticker: WAMediaUpload;
|
|
220
|
-
emojis?: string[];
|
|
221
|
-
accessibilityLabel?: string;
|
|
222
|
-
};
|
|
223
|
-
export type StickerPackContent = {
|
|
224
|
-
name: string;
|
|
225
|
-
publisher?: string;
|
|
226
|
-
description?: string;
|
|
227
|
-
packId?: string;
|
|
228
|
-
stickers: StickerPackItem[];
|
|
229
|
-
cover?: WAMediaUpload;
|
|
167
|
+
export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
|
|
168
|
+
productImage: WAMediaUpload;
|
|
230
169
|
};
|
|
231
|
-
export type AnyRegularMessageContent = (
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
| ({
|
|
243
|
-
poll: PollMessageOptions;
|
|
244
|
-
} & Mentionable &
|
|
245
|
-
Contextable &
|
|
246
|
-
Editable)
|
|
247
|
-
| {
|
|
248
|
-
contacts: {
|
|
170
|
+
export type AnyRegularMessageContent = (({
|
|
171
|
+
text: string;
|
|
172
|
+
linkPreview?: WAUrlInfo | null;
|
|
173
|
+
} & Mentionable & Contextable & Editable) | AnyMediaMessageContent | {
|
|
174
|
+
event: EventMessageOptions;
|
|
175
|
+
} | ({
|
|
176
|
+
poll: PollMessageOptions;
|
|
177
|
+
} & Mentionable & Contextable & Editable) | ({
|
|
178
|
+
album: AlbumMessageOptions;
|
|
179
|
+
} & Contextable & Mentionable) | {
|
|
180
|
+
contacts: {
|
|
249
181
|
displayName?: string;
|
|
250
182
|
contacts: proto.Message.IContactMessage[];
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
| {
|
|
254
|
-
location: WALocationMessage;
|
|
255
|
-
}
|
|
256
|
-
| {
|
|
257
|
-
react: proto.Message.IReactionMessage;
|
|
258
|
-
}
|
|
259
|
-
| {
|
|
260
|
-
buttonReply: ButtonReplyInfo;
|
|
261
|
-
type: "template" | "plain";
|
|
262
|
-
}
|
|
263
|
-
| {
|
|
264
|
-
groupInvite: GroupInviteInfo;
|
|
265
|
-
}
|
|
266
|
-
| {
|
|
267
|
-
listReply: Omit<proto.Message.IListResponseMessage, "contextInfo">;
|
|
268
|
-
}
|
|
269
|
-
| {
|
|
270
|
-
pin: WAMessageKey;
|
|
271
|
-
type: proto.PinInChat.Type;
|
|
272
|
-
/**
|
|
273
|
-
* 24 hours, 7 days, 30 days
|
|
274
|
-
*/
|
|
275
|
-
time?: 86400 | 604800 | 2592000;
|
|
276
|
-
}
|
|
277
|
-
| {
|
|
278
|
-
product: WASendableProduct;
|
|
279
|
-
businessOwnerJid?: string;
|
|
280
|
-
body?: string;
|
|
281
|
-
footer?: string;
|
|
282
|
-
}
|
|
283
|
-
| ({
|
|
284
|
-
stickerPack: StickerPackContent;
|
|
285
|
-
} & Mentionable &
|
|
286
|
-
Contextable)
|
|
287
|
-
| SharePhoneNumber
|
|
288
|
-
| RequestPhoneNumber
|
|
289
|
-
) &
|
|
290
|
-
ViewOnce;
|
|
291
|
-
export type AnyMessageContent =
|
|
292
|
-
| AnyRegularMessageContent
|
|
293
|
-
| {
|
|
294
|
-
forward: WAMessage;
|
|
295
|
-
force?: boolean;
|
|
296
|
-
}
|
|
297
|
-
| {
|
|
298
|
-
/** Delete your message or anyone's message in a group (admin required) */
|
|
299
|
-
delete: WAMessageKey;
|
|
300
|
-
}
|
|
301
|
-
| {
|
|
302
|
-
disappearingMessagesInChat: boolean | number;
|
|
303
|
-
}
|
|
304
|
-
| {
|
|
305
|
-
limitSharing: boolean;
|
|
306
183
|
};
|
|
307
|
-
|
|
184
|
+
} | {
|
|
185
|
+
location: WALocationMessage;
|
|
186
|
+
} | {
|
|
187
|
+
react: proto.Message.IReactionMessage;
|
|
188
|
+
} | {
|
|
189
|
+
buttonReply: ButtonReplyInfo;
|
|
190
|
+
type: 'template' | 'plain';
|
|
191
|
+
} | {
|
|
192
|
+
groupInvite: GroupInviteInfo;
|
|
193
|
+
} | {
|
|
194
|
+
listReply: Omit<proto.Message.IListResponseMessage, 'contextInfo'>;
|
|
195
|
+
} | {
|
|
196
|
+
pin: WAMessageKey;
|
|
197
|
+
type: proto.PinInChat.Type;
|
|
198
|
+
/**
|
|
199
|
+
* 24 hours, 7 days, 30 days
|
|
200
|
+
*/
|
|
201
|
+
time?: 86400 | 604800 | 2592000;
|
|
202
|
+
} | {
|
|
203
|
+
product: WASendableProduct;
|
|
204
|
+
businessOwnerJid?: string;
|
|
205
|
+
body?: string;
|
|
206
|
+
footer?: string;
|
|
207
|
+
} | SharePhoneNumber | RequestPhoneNumber) & ViewOnce;
|
|
208
|
+
export type AnyMessageContent = AnyRegularMessageContent | {
|
|
209
|
+
forward: WAMessage;
|
|
210
|
+
force?: boolean;
|
|
211
|
+
} | {
|
|
212
|
+
/** Delete your message or anyone's message in a group (admin required) */
|
|
213
|
+
delete: WAMessageKey;
|
|
214
|
+
} | {
|
|
215
|
+
disappearingMessagesInChat: boolean | number;
|
|
216
|
+
} | {
|
|
217
|
+
limitSharing: boolean;
|
|
218
|
+
};
|
|
219
|
+
export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>;
|
|
308
220
|
type MinimalRelayOptions = {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
221
|
+
/** override the message ID with a custom provided string */
|
|
222
|
+
messageId?: string;
|
|
223
|
+
/** should we use group metadata cache, or fetch afresh from the server; default assumed to be "true" */
|
|
224
|
+
useCachedGroupMetadata?: boolean;
|
|
313
225
|
};
|
|
314
226
|
export type MessageRelayOptions = MinimalRelayOptions & {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
227
|
+
/** only send to a specific participant; used when a message decryption fails for a single user */
|
|
228
|
+
participant?: {
|
|
229
|
+
jid: string;
|
|
230
|
+
count: number;
|
|
231
|
+
};
|
|
232
|
+
/** additional attributes to add to the WA binary node */
|
|
233
|
+
additionalAttributes?: {
|
|
234
|
+
[_: string]: string;
|
|
235
|
+
};
|
|
236
|
+
additionalNodes?: BinaryNode[];
|
|
237
|
+
/** should we use the devices cache, or fetch afresh from the server; default assumed to be "true" */
|
|
238
|
+
useUserDevicesCache?: boolean;
|
|
239
|
+
/** jid list of participants for status@broadcast */
|
|
240
|
+
statusJidList?: string[];
|
|
329
241
|
};
|
|
330
242
|
export type MiscMessageGenerationOptions = MinimalRelayOptions & {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
243
|
+
/** optional, if you want to manually set the timestamp of the message */
|
|
244
|
+
timestamp?: Date;
|
|
245
|
+
/** the message you want to quote */
|
|
246
|
+
quoted?: WAMessage;
|
|
247
|
+
/** disappearing messages settings */
|
|
248
|
+
ephemeralExpiration?: number | string;
|
|
249
|
+
/** timeout for media upload to WA server */
|
|
250
|
+
mediaUploadTimeoutMs?: number;
|
|
251
|
+
/** jid list of participants for status@broadcast */
|
|
252
|
+
statusJidList?: string[];
|
|
253
|
+
/** backgroundcolor for status */
|
|
254
|
+
backgroundColor?: string;
|
|
255
|
+
/** font type for status */
|
|
256
|
+
font?: number;
|
|
257
|
+
/** if it is broadcast */
|
|
258
|
+
broadcast?: boolean;
|
|
347
259
|
};
|
|
348
|
-
export type MessageGenerationOptionsFromContent =
|
|
349
|
-
MiscMessageGenerationOptions & {
|
|
260
|
+
export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
|
|
350
261
|
userJid: string;
|
|
351
|
-
|
|
352
|
-
export type WAMediaUploadFunction = (
|
|
353
|
-
encFilePath: string,
|
|
354
|
-
opts: {
|
|
262
|
+
};
|
|
263
|
+
export type WAMediaUploadFunction = (encFilePath: string, opts: {
|
|
355
264
|
fileEncSha256B64: string;
|
|
356
265
|
mediaType: MediaType;
|
|
357
|
-
newsletter?: boolean;
|
|
358
266
|
timeoutMs?: number;
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
fbid?: number;
|
|
267
|
+
}) => Promise<{
|
|
268
|
+
mediaUrl: string;
|
|
269
|
+
directPath: string;
|
|
270
|
+
meta_hmac?: string;
|
|
271
|
+
ts?: number;
|
|
272
|
+
fbid?: number;
|
|
366
273
|
}>;
|
|
367
274
|
export type MediaGenerationOptions = {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
275
|
+
logger?: ILogger;
|
|
276
|
+
mediaTypeOverride?: MediaType;
|
|
277
|
+
upload: WAMediaUploadFunction;
|
|
278
|
+
/** cache media so it does not have to be uploaded again */
|
|
279
|
+
mediaCache?: CacheStore;
|
|
280
|
+
mediaUploadTimeoutMs?: number;
|
|
281
|
+
options?: RequestInit;
|
|
282
|
+
backgroundColor?: string;
|
|
283
|
+
font?: number;
|
|
377
284
|
};
|
|
378
285
|
export type MessageContentGenerationOptions = MediaGenerationOptions & {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
type: "audio" | "video",
|
|
386
|
-
event?: {
|
|
387
|
-
startTime: number;
|
|
388
|
-
},
|
|
389
|
-
) => Promise<string | undefined>;
|
|
390
|
-
jid?: string;
|
|
286
|
+
getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>;
|
|
287
|
+
getProfilePicUrl?: (jid: string, type: 'image' | 'preview') => Promise<string | undefined>;
|
|
288
|
+
getCallLink?: (type: 'audio' | 'video', event?: {
|
|
289
|
+
startTime: number;
|
|
290
|
+
}) => Promise<string | undefined>;
|
|
291
|
+
jid?: string;
|
|
391
292
|
};
|
|
392
|
-
export type MessageGenerationOptions = MessageContentGenerationOptions &
|
|
393
|
-
MessageGenerationOptionsFromContent;
|
|
293
|
+
export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent;
|
|
394
294
|
/**
|
|
395
295
|
* Type of message upsert
|
|
396
296
|
* 1. notify => notify the user, this message was just received
|
|
397
297
|
* 2. append => append the message to the chat history, no notification required
|
|
398
298
|
*/
|
|
399
|
-
export type MessageUpsertType =
|
|
299
|
+
export type MessageUpsertType = 'append' | 'notify';
|
|
400
300
|
export type MessageUserReceipt = proto.IUserReceipt;
|
|
401
301
|
export type WAMessageUpdate = {
|
|
402
|
-
|
|
403
|
-
|
|
302
|
+
update: Partial<WAMessage>;
|
|
303
|
+
key: WAMessageKey;
|
|
304
|
+
};
|
|
305
|
+
export type WAMessageCursor = {
|
|
306
|
+
before: WAMessageKey | undefined;
|
|
307
|
+
} | {
|
|
308
|
+
after: WAMessageKey | undefined;
|
|
404
309
|
};
|
|
405
|
-
export type WAMessageCursor =
|
|
406
|
-
| {
|
|
407
|
-
before: WAMessageKey | undefined;
|
|
408
|
-
}
|
|
409
|
-
| {
|
|
410
|
-
after: WAMessageKey | undefined;
|
|
411
|
-
};
|
|
412
310
|
export type MessageUserReceiptUpdate = {
|
|
413
|
-
|
|
414
|
-
|
|
311
|
+
key: WAMessageKey;
|
|
312
|
+
receipt: MessageUserReceipt;
|
|
415
313
|
};
|
|
416
314
|
export type MediaDecryptionKeyInfo = {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
315
|
+
iv: Uint8Array;
|
|
316
|
+
cipherKey: Uint8Array;
|
|
317
|
+
macKey?: Uint8Array;
|
|
420
318
|
};
|
|
421
|
-
export type MinimalMessage = Pick<WAMessage,
|
|
422
|
-
//# sourceMappingURL=Message.d.ts.map
|
|
319
|
+
export type MinimalMessage = Pick<WAMessage, 'key' | 'messageTimestamp'>;
|
|
320
|
+
//# sourceMappingURL=Message.d.ts.map
|