@jkt48connect-corp/baileys 7.3.2 → 7.3.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/README.md +459 -143
- package/WAProto/WAProto.proto +227 -2
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.d.ts +9 -7
- package/lib/Defaults/index.js +6 -4
- package/lib/Socket/Client/index.d.ts +2 -3
- package/lib/Socket/Client/index.js +2 -3
- 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 +8 -3
- package/lib/Socket/chats.d.ts +21 -19
- package/lib/Socket/chats.js +51 -48
- package/lib/Socket/groups.d.ts +28 -26
- package/lib/Socket/groups.js +2 -1
- package/lib/Socket/index.d.ts +6 -3
- package/lib/Socket/messages-recv.d.ts +8 -3
- package/lib/Socket/messages-recv.js +308 -149
- package/lib/Socket/messages-send.d.ts +23 -26
- package/lib/Socket/messages-send.js +193 -166
- package/lib/Socket/newsletter.d.ts +2 -2
- package/lib/Socket/newsletter.js +3 -3
- package/lib/Socket/registration.d.ts +8 -3
- package/lib/Socket/socket.d.ts +8 -6
- package/lib/Socket/socket.js +19 -14
- 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 -2
- package/lib/Store/make-ordered-dictionary.d.ts +1 -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 +3 -1
- package/lib/Types/Label.d.ts +11 -0
- package/lib/Types/Message.d.ts +324 -328
- package/lib/Types/Socket.d.ts +7 -0
- package/lib/Types/USync.d.ts +25 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.d.ts +9 -0
- package/lib/Utils/chat-utils.d.ts +4 -4
- package/lib/Utils/chat-utils.js +41 -20
- package/lib/Utils/crypto.d.ts +1 -1
- package/lib/Utils/crypto.js +4 -2
- package/lib/Utils/decode-wa-message.d.ts +17 -0
- package/lib/Utils/decode-wa-message.js +42 -14
- package/lib/Utils/generics.d.ts +4 -10
- package/lib/Utils/generics.js +30 -14
- package/lib/Utils/history.d.ts +6 -2
- package/lib/Utils/history.js +3 -0
- package/lib/Utils/messages.d.ts +0 -1
- package/lib/Utils/messages.js +247 -39
- 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.d.ts +2 -2
- package/lib/Utils/validate-connection.js +1 -1
- package/lib/WABinary/encode.d.ts +1 -1
- package/lib/WABinary/encode.js +16 -10
- 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/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +23 -18
- package/LICENSE +0 -21
- package/lib/index.ts +0 -13
package/lib/Types/Message.d.ts
CHANGED
@@ -1,218 +1,229 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
import
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import
|
9
|
-
import {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
export
|
14
|
-
export type
|
15
|
-
export type
|
16
|
-
export type
|
17
|
-
export type
|
18
|
-
export type
|
19
|
-
export type
|
20
|
-
export type
|
21
|
-
export type
|
22
|
-
|
23
|
-
export
|
24
|
-
|
25
|
-
export import WAMessageStatus = proto.WebMessageInfo.Status
|
26
|
-
export type WAMediaUpload = Buffer | {
|
1
|
+
/// <reference types="node" />
|
2
|
+
/// <reference types="node" />
|
3
|
+
/// <reference types="node" />
|
4
|
+
import { AxiosRequestConfig } from 'axios';
|
5
|
+
import type { Logger } from 'pino';
|
6
|
+
import type { Readable } from 'stream';
|
7
|
+
import type { URL } from 'url';
|
8
|
+
import { BinaryNode } from '../WABinary';
|
9
|
+
import { proto } from '../../WAProto';
|
10
|
+
import { MEDIA_HKDF_KEY_MAPPING } from '../Defaults';
|
11
|
+
import type { GroupMetadata } from './GroupMetadata';
|
12
|
+
import { CacheStore } from './Socket';
|
13
|
+
export { proto as WAProto };
|
14
|
+
export type WAMessage = proto.IWebMessageInfo;
|
15
|
+
export type WAMessageContent = proto.IMessage;
|
16
|
+
export type WAContactMessage = proto.Message.IContactMessage;
|
17
|
+
export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage;
|
18
|
+
export type WAMessageKey = proto.IMessageKey;
|
19
|
+
export type WATextMessage = proto.Message.IExtendedTextMessage;
|
20
|
+
export type WAContextInfo = proto.IContextInfo;
|
21
|
+
export type WALocationMessage = proto.Message.ILocationMessage;
|
22
|
+
export type WALiveLocationMessage = proto.Message.ILiveLocationMessage;
|
23
|
+
export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
|
24
|
+
export import WAMessageStubType = proto.WebMessageInfo.StubType;
|
25
|
+
export import WAMessageStatus = proto.WebMessageInfo.Status;
|
26
|
+
export type WAMediaUpload = Buffer | {
|
27
|
+
url: URL | string;
|
28
|
+
} | {
|
29
|
+
stream: Readable;
|
30
|
+
};
|
31
|
+
export import Annotations = proto.IInteractiveAnnotation;
|
27
32
|
/** Set of message types that are supported by the library */
|
28
|
-
export type MessageType = keyof proto.Message
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
33
|
+
export type MessageType = keyof proto.Message;
|
34
|
+
export type DownloadableMessage = {
|
35
|
+
mediaKey?: Uint8Array | null;
|
36
|
+
directPath?: string | null;
|
37
|
+
url?: string | null;
|
38
|
+
};
|
39
|
+
export type MessageReceiptType = 'read' | 'read-self' | 'hist_sync' | 'peer_msg' | 'sender' | 'inactive' | 'played' | undefined;
|
34
40
|
export type MediaConnInfo = {
|
35
|
-
auth: string
|
36
|
-
ttl: number
|
37
|
-
hosts: {
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
+
auth: string;
|
42
|
+
ttl: number;
|
43
|
+
hosts: {
|
44
|
+
hostname: string;
|
45
|
+
maxContentLengthBytes: number;
|
46
|
+
}[];
|
47
|
+
fetchDate: Date;
|
48
|
+
};
|
41
49
|
export interface WAUrlInfo {
|
42
|
-
'canonical-url': string
|
43
|
-
'matched-text': string
|
44
|
-
title: string
|
45
|
-
description?: string
|
46
|
-
jpegThumbnail?: Buffer
|
47
|
-
highQualityThumbnail?: proto.Message.IImageMessage
|
48
|
-
originalThumbnailUrl?: string
|
50
|
+
'canonical-url': string;
|
51
|
+
'matched-text': string;
|
52
|
+
title: string;
|
53
|
+
description?: string;
|
54
|
+
jpegThumbnail?: Buffer;
|
55
|
+
highQualityThumbnail?: proto.Message.IImageMessage;
|
56
|
+
originalThumbnailUrl?: string;
|
57
|
+
}
|
58
|
+
export interface Media {
|
59
|
+
image?: WAMediaUpload;
|
60
|
+
video?: WAMediaUpload;
|
61
|
+
}
|
62
|
+
export interface Carousel {
|
63
|
+
image?: WAMediaUpload;
|
64
|
+
video?: WAMediaUpload;
|
65
|
+
product?: WASendableProduct;
|
66
|
+
title?: string;
|
67
|
+
caption?: string;
|
68
|
+
footer?: string;
|
69
|
+
buttons?: proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton[];
|
49
70
|
}
|
50
|
-
|
51
|
-
// types to generate WA messages
|
52
71
|
type Mentionable = {
|
53
72
|
/** list of jids that are mentioned in the accompanying text */
|
54
|
-
mentions?: string[]
|
55
|
-
}
|
73
|
+
mentions?: string[];
|
74
|
+
};
|
56
75
|
type Contextable = {
|
57
76
|
/** add contextInfo to the message */
|
58
|
-
contextInfo?: proto.IContextInfo
|
59
|
-
}
|
77
|
+
contextInfo?: proto.IContextInfo;
|
78
|
+
};
|
60
79
|
type ViewOnce = {
|
61
|
-
viewOnce?: boolean
|
62
|
-
}
|
63
|
-
|
64
|
-
type ViewOnceV2 = {
|
65
|
-
viewOnceV2?: boolean;
|
66
|
-
}
|
67
|
-
type ViewOnceV2Extension = {
|
68
|
-
viewOnceV2Extension?: boolean;
|
69
|
-
}
|
70
|
-
type Ephemeral = {
|
71
|
-
ephemeral?: boolean;
|
72
|
-
}
|
73
|
-
|
80
|
+
viewOnce?: boolean;
|
81
|
+
};
|
74
82
|
type Buttonable = {
|
75
83
|
/** add buttons to the message */
|
76
|
-
buttons?: proto.Message.ButtonsMessage.IButton[]
|
77
|
-
}
|
78
|
-
|
84
|
+
buttons?: proto.Message.ButtonsMessage.IButton[];
|
85
|
+
};
|
79
86
|
type Templatable = {
|
80
87
|
/** add buttons to the message (conflicts with normal buttons)*/
|
81
|
-
templateButtons?: proto.IHydratedTemplateButton[]
|
82
|
-
|
83
|
-
|
84
|
-
}
|
85
|
-
|
88
|
+
templateButtons?: proto.IHydratedTemplateButton[];
|
89
|
+
footer?: string;
|
90
|
+
};
|
86
91
|
type Interactiveable = {
|
87
|
-
/** add buttons to the message
|
88
|
-
interactiveButtons?: proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton[]
|
92
|
+
/** add buttons to the message (conflicts with normal buttons)*/
|
93
|
+
interactiveButtons?: proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton[];
|
94
|
+
title?: string;
|
89
95
|
subtitle?: string;
|
90
96
|
media?: boolean;
|
91
|
-
}
|
92
|
-
|
97
|
+
};
|
93
98
|
type Shopable = {
|
94
99
|
shop?: proto.Message.InteractiveMessage.ShopMessage.Surface;
|
95
100
|
id?: string;
|
101
|
+
title?: string;
|
96
102
|
subtitle?: string;
|
97
103
|
media?: boolean;
|
98
|
-
}
|
99
|
-
|
104
|
+
};
|
105
|
+
type Collectionable = {
|
106
|
+
collection?: {
|
107
|
+
bizJid?: string;
|
108
|
+
id?: string;
|
109
|
+
version?: number;
|
110
|
+
};
|
111
|
+
title?: string;
|
112
|
+
subtitle?: string;
|
113
|
+
media?: boolean;
|
114
|
+
};
|
100
115
|
type Cardsable = {
|
101
|
-
cards?:
|
116
|
+
cards?: Carousel[];
|
117
|
+
title?: string;
|
102
118
|
subtitle?: string;
|
103
|
-
}
|
104
|
-
|
119
|
+
};
|
105
120
|
type Editable = {
|
106
|
-
|
107
|
-
}
|
108
|
-
type Listable = {
|
121
|
+
edit?: WAMessageKey;
|
122
|
+
};
|
123
|
+
type Listable = {
|
109
124
|
/** Sections of the List */
|
110
|
-
sections?: proto.Message.ListMessage.ISection[]
|
111
|
-
|
125
|
+
sections?: proto.Message.ListMessage.ISection[];
|
112
126
|
/** Title of a List Message only */
|
113
|
-
title?: string
|
114
|
-
|
127
|
+
title?: string;
|
115
128
|
/** Text of the button on the list (required) */
|
116
|
-
buttonText?: string
|
117
|
-
|
118
|
-
/** ListType of the List */
|
119
|
-
listType?: proto.Message.ListMessage.ListType
|
120
|
-
}
|
129
|
+
buttonText?: string;
|
130
|
+
};
|
121
131
|
type WithDimensions = {
|
122
|
-
width?: number
|
123
|
-
height?: number
|
124
|
-
}
|
125
|
-
|
132
|
+
width?: number;
|
133
|
+
height?: number;
|
134
|
+
};
|
126
135
|
export type PollMessageOptions = {
|
127
|
-
name: string
|
128
|
-
selectableCount?: number
|
129
|
-
values: string[]
|
136
|
+
name: string;
|
137
|
+
selectableCount?: number;
|
138
|
+
values: string[];
|
130
139
|
/** 32 byte message secret to encrypt poll selections */
|
131
|
-
messageSecret?: Uint8Array
|
132
|
-
toAnnouncementGroup?: boolean
|
133
|
-
}
|
134
|
-
|
140
|
+
messageSecret?: Uint8Array;
|
141
|
+
toAnnouncementGroup?: boolean;
|
142
|
+
};
|
143
|
+
export type PollResultMessage = {
|
144
|
+
name: string;
|
145
|
+
votes: proto.Message.PollResultSnapshotMessage.PollVote[];
|
146
|
+
messageSecret?: Uint8Array;
|
147
|
+
};
|
135
148
|
type SharePhoneNumber = {
|
136
|
-
sharePhoneNumber: boolean
|
137
|
-
}
|
138
|
-
|
149
|
+
sharePhoneNumber: boolean;
|
150
|
+
};
|
139
151
|
type RequestPhoneNumber = {
|
140
|
-
requestPhoneNumber: boolean
|
141
|
-
}
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
152
|
+
requestPhoneNumber: boolean;
|
153
|
+
};
|
154
|
+
export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
|
155
|
+
productImage: WAMediaUpload;
|
156
|
+
};
|
157
|
+
export type MediaType = keyof typeof MEDIA_HKDF_KEY_MAPPING;
|
158
|
+
export type AnyMediaMessageContent = (({
|
159
|
+
image: WAMediaUpload;
|
160
|
+
caption?: string;
|
161
|
+
jpegThumbnail?: string;
|
162
|
+
annotations?: Annotations;
|
163
|
+
} & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & WithDimensions) | ({
|
164
|
+
video: WAMediaUpload;
|
165
|
+
caption?: string;
|
166
|
+
gifPlayback?: boolean;
|
167
|
+
jpegThumbnail?: string;
|
168
|
+
/** if set to true, will send as a `video note` */
|
169
|
+
ptv?: boolean;
|
170
|
+
annotations?: Annotations;
|
171
|
+
} & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & WithDimensions) | {
|
172
|
+
audio: WAMediaUpload;
|
173
|
+
/** if set to true, will send as a `voice note` */
|
174
|
+
ptt?: boolean;
|
175
|
+
/** optionally tell the duration of the audio */
|
176
|
+
seconds?: number;
|
177
|
+
annotations?: Annotations;
|
178
|
+
} | ({
|
179
|
+
sticker: WAMediaUpload;
|
180
|
+
isAnimated?: boolean;
|
181
|
+
annotations?: Annotations;
|
182
|
+
} & WithDimensions) | ({
|
183
|
+
document: WAMediaUpload;
|
184
|
+
mimetype: string;
|
185
|
+
fileName?: string;
|
186
|
+
caption?: string;
|
187
|
+
annotations?: Annotations;
|
188
|
+
} & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable)) & {
|
189
|
+
mimetype?: string;
|
190
|
+
} & Editable;
|
177
191
|
export type ButtonReplyInfo = {
|
178
|
-
displayText: string
|
179
|
-
id: string
|
180
|
-
index: number
|
181
|
-
|
182
|
-
|
192
|
+
displayText: string;
|
193
|
+
id: string;
|
194
|
+
index: number;
|
195
|
+
text: string;
|
196
|
+
nativeFlow: proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage;
|
197
|
+
};
|
183
198
|
export type GroupInviteInfo = {
|
184
|
-
inviteCode: string
|
185
|
-
inviteExpiration: number
|
186
|
-
text: string
|
187
|
-
jid: string
|
188
|
-
subject: string
|
189
|
-
|
190
|
-
|
199
|
+
inviteCode: string;
|
200
|
+
inviteExpiration: number;
|
201
|
+
text: string;
|
202
|
+
jid: string;
|
203
|
+
subject: string;
|
204
|
+
thumbnail: Buffer;
|
205
|
+
};
|
191
206
|
export type PinInChatInfo = {
|
192
207
|
key: WAMessageKey;
|
193
208
|
type?: number;
|
194
209
|
time?: number;
|
195
|
-
}
|
196
|
-
|
210
|
+
};
|
197
211
|
export type KeepInChatInfo = {
|
198
212
|
key: WAMessageKey;
|
199
213
|
type?: number;
|
200
214
|
time?: number;
|
201
|
-
}
|
202
|
-
|
215
|
+
};
|
203
216
|
export type CallCreationInfo = {
|
204
217
|
time?: number;
|
205
218
|
title?: string;
|
206
219
|
type?: number;
|
207
|
-
}
|
208
|
-
|
220
|
+
};
|
209
221
|
export type PaymentInviteInfo = {
|
210
222
|
type?: number;
|
211
223
|
expiry?: number;
|
212
|
-
}
|
213
|
-
|
214
|
-
|
215
|
-
expiry: number;
|
224
|
+
};
|
225
|
+
export type RequestPaymentInfo = {
|
226
|
+
expiry: number;
|
216
227
|
amount: number;
|
217
228
|
currency: string;
|
218
229
|
from: string;
|
@@ -220,27 +231,23 @@ export type RequestPaymentInfo = {
|
|
220
231
|
sticker?: WAMediaUpload;
|
221
232
|
background: string;
|
222
233
|
/** add contextInfo to the message */
|
223
|
-
contextInfo?: proto.IContextInfo
|
224
|
-
}
|
225
|
-
|
226
|
-
|
234
|
+
contextInfo?: proto.IContextInfo;
|
235
|
+
};
|
227
236
|
export type EventsInfo = {
|
228
237
|
isCanceled?: boolean;
|
229
238
|
name: string;
|
230
239
|
description: string;
|
231
240
|
joinLink?: string;
|
232
241
|
startTime?: number;
|
233
|
-
messageSecret?: Uint8Array
|
234
|
-
}
|
235
|
-
|
242
|
+
messageSecret?: Uint8Array;
|
243
|
+
};
|
236
244
|
export type AdminInviteInfo = {
|
237
|
-
inviteExpiration: number
|
238
|
-
text: string
|
239
|
-
jid: string
|
240
|
-
subject: string
|
241
|
-
thumbnail: Buffer
|
242
|
-
}
|
243
|
-
|
245
|
+
inviteExpiration: number;
|
246
|
+
text: string;
|
247
|
+
jid: string;
|
248
|
+
subject: string;
|
249
|
+
thumbnail: Buffer;
|
250
|
+
};
|
244
251
|
export type OrderInfo = {
|
245
252
|
id: number;
|
246
253
|
thumbnail: string;
|
@@ -253,185 +260,174 @@ export type OrderInfo = {
|
|
253
260
|
token: string;
|
254
261
|
amount: number;
|
255
262
|
currency: string;
|
256
|
-
}
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
}
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
| {
|
315
|
-
order: OrderInfo
|
316
|
-
}
|
317
|
-
| {
|
318
|
-
call: CallCreationInfo
|
319
|
-
}
|
320
|
-
| {
|
321
|
-
inviteAdmin: AdminInviteInfo
|
322
|
-
}
|
323
|
-
| {
|
324
|
-
listReply: Omit<proto.Message.IListResponseMessage, 'contextInfo'>
|
325
|
-
}
|
326
|
-
| ({
|
327
|
-
product: WASendableProduct
|
328
|
-
businessOwnerJid?: string
|
329
|
-
body?: string
|
330
|
-
footer?: string
|
331
|
-
} & Mentionable & Contextable & Interactiveable & Shopable & Cardsable & WithDimensions)
|
332
|
-
| SharePhoneNumber | RequestPhoneNumber
|
333
|
-
) & ViewOnce
|
334
|
-
|
263
|
+
};
|
264
|
+
export type AnyRegularMessageContent = (({
|
265
|
+
text: string;
|
266
|
+
linkPreview?: WAUrlInfo | null;
|
267
|
+
} & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & Listable & Editable) | AnyMediaMessageContent | ({
|
268
|
+
poll: PollMessageOptions;
|
269
|
+
} | {
|
270
|
+
pollResult: PollResultMessage;
|
271
|
+
} & Mentionable & Contextable & Buttonable & Templatable & Editable) | {
|
272
|
+
contacts: {
|
273
|
+
displayName?: string;
|
274
|
+
contacts: proto.Message.IContactMessage[];
|
275
|
+
};
|
276
|
+
} | {
|
277
|
+
location: WALocationMessage;
|
278
|
+
} | {
|
279
|
+
liveLocation: WALiveLocationMessage;
|
280
|
+
} | {
|
281
|
+
react: proto.Message.IReactionMessage;
|
282
|
+
} | {
|
283
|
+
buttonReply: ButtonReplyInfo;
|
284
|
+
type: 'template' | 'plain' | 'interactive';
|
285
|
+
} | {
|
286
|
+
groupInvite: GroupInviteInfo;
|
287
|
+
} | {
|
288
|
+
pin: WAMessageKey;
|
289
|
+
type: proto.PinInChat.Type;
|
290
|
+
/**
|
291
|
+
* 24 hours, 7 days, 30 days
|
292
|
+
*/
|
293
|
+
time?: 86400 | 604800 | 2592000;
|
294
|
+
} | {
|
295
|
+
keep: WAMessageKey;
|
296
|
+
type: number;
|
297
|
+
/**
|
298
|
+
* 24 hours, 7 days, 90 days
|
299
|
+
*/
|
300
|
+
time?: 86400 | 604800 | 7776000;
|
301
|
+
} | {
|
302
|
+
paymentInvite: PaymentInviteInfo;
|
303
|
+
} | {
|
304
|
+
requestPayment: RequestPaymentInfo;
|
305
|
+
} | {
|
306
|
+
event: EventsInfo;
|
307
|
+
} | {
|
308
|
+
order: OrderInfo;
|
309
|
+
} | {
|
310
|
+
call: CallCreationInfo;
|
311
|
+
} | {
|
312
|
+
inviteAdmin: AdminInviteInfo;
|
313
|
+
} | {
|
314
|
+
listReply: Omit<proto.Message.IListResponseMessage, 'contextInfo'>;
|
315
|
+
} | ({
|
316
|
+
product: WASendableProduct;
|
317
|
+
businessOwnerJid?: string;
|
318
|
+
body?: string;
|
319
|
+
footer?: string;
|
320
|
+
} & Mentionable & Contextable & Interactiveable & Shopable & Collectionable & Cardsable & WithDimensions) | SharePhoneNumber | RequestPhoneNumber) & ViewOnce;
|
335
321
|
export type AnyMessageContent = AnyRegularMessageContent | {
|
336
|
-
|
337
|
-
|
322
|
+
forward: WAMessage;
|
323
|
+
force?: boolean;
|
338
324
|
} | {
|
339
325
|
/** Delete your message or anyone's message in a group (admin required) */
|
340
|
-
|
326
|
+
delete: WAMessageKey;
|
341
327
|
} | {
|
342
|
-
|
343
|
-
}
|
344
|
-
|
345
|
-
export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>
|
346
|
-
|
328
|
+
disappearingMessagesInChat: boolean | number;
|
329
|
+
};
|
330
|
+
export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>;
|
347
331
|
type MinimalRelayOptions = {
|
348
332
|
/** override the message ID with a custom provided string */
|
349
|
-
messageId?: string
|
333
|
+
messageId?: string;
|
350
334
|
/** cached group metadata, use to prevent redundant requests to WA & speed up msg sending */
|
351
|
-
cachedGroupMetadata?: (jid: string) => Promise<GroupMetadataParticipants | undefined
|
352
|
-
}
|
353
|
-
|
335
|
+
cachedGroupMetadata?: (jid: string) => Promise<GroupMetadataParticipants | undefined>;
|
336
|
+
};
|
354
337
|
export type MessageRelayOptions = MinimalRelayOptions & {
|
355
338
|
/** only send to a specific participant; used when a message decryption fails for a single user */
|
356
|
-
participant?: {
|
339
|
+
participant?: {
|
340
|
+
jid: string;
|
341
|
+
count: number;
|
342
|
+
};
|
357
343
|
/** additional attributes to add to the WA binary node */
|
358
|
-
additionalAttributes?: {
|
344
|
+
additionalAttributes?: {
|
345
|
+
[_: string]: string;
|
346
|
+
};
|
359
347
|
additionalNodes?: BinaryNode[];
|
360
348
|
/** should we use the devices cache, or fetch afresh from the server; default assumed to be "true" */
|
361
|
-
useUserDevicesCache?: boolean
|
349
|
+
useUserDevicesCache?: boolean;
|
362
350
|
/** jid list of participants for status@broadcast */
|
363
|
-
statusJidList?: string[]
|
364
|
-
}
|
365
|
-
|
351
|
+
statusJidList?: string[];
|
352
|
+
};
|
366
353
|
export type MiscMessageGenerationOptions = MinimalRelayOptions & {
|
367
354
|
/** optional, if you want to manually set the timestamp of the message */
|
368
|
-
|
355
|
+
timestamp?: Date;
|
369
356
|
/** the message you want to quote */
|
370
|
-
|
357
|
+
quoted?: WAMessage;
|
371
358
|
additionalNodes?: BinaryNode[];
|
372
359
|
/** disappearing messages settings */
|
373
|
-
ephemeralExpiration?: number | string
|
360
|
+
ephemeralExpiration?: number | string;
|
374
361
|
/** timeout for media upload to WA server */
|
375
|
-
mediaUploadTimeoutMs?: number
|
362
|
+
mediaUploadTimeoutMs?: number;
|
376
363
|
/** jid list of participants for status@broadcast */
|
377
|
-
statusJidList?: string[]
|
364
|
+
statusJidList?: string[];
|
378
365
|
/** backgroundcolor for status */
|
379
|
-
backgroundColor?: string
|
366
|
+
backgroundColor?: string;
|
380
367
|
/** font type for status */
|
381
|
-
font?: number
|
368
|
+
font?: number;
|
382
369
|
/** if it is broadcast */
|
383
|
-
broadcast?: boolean
|
384
|
-
|
370
|
+
broadcast?: boolean;
|
371
|
+
/** delay of message time */
|
372
|
+
delay?: number;
|
373
|
+
};
|
385
374
|
export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
|
386
|
-
|
387
|
-
}
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
375
|
+
userJid: string;
|
376
|
+
};
|
377
|
+
export type WAMediaUploadFunctionOpts = {
|
378
|
+
fileEncSha256B64: string;
|
379
|
+
mediaType: MediaType;
|
380
|
+
newsletter?: boolean;
|
381
|
+
timeoutMs?: number;
|
382
|
+
};
|
383
|
+
export type WAMediaUploadFunction = (readStream: Readable | Buffer, opts: WAMediaUploadFunctionOpts) => Promise<{
|
384
|
+
mediaUrl: string;
|
385
|
+
directPath: string;
|
386
|
+
handle?: string;
|
387
|
+
}>;
|
393
388
|
export type MediaGenerationOptions = {
|
394
|
-
|
395
|
-
mediaTypeOverride?: MediaType
|
396
|
-
upload: WAMediaUploadFunction
|
389
|
+
logger?: Logger;
|
390
|
+
mediaTypeOverride?: MediaType;
|
391
|
+
upload: WAMediaUploadFunction;
|
397
392
|
/** cache media so it does not have to be uploaded again */
|
398
|
-
mediaCache?: CacheStore
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
font?: number
|
407
|
-
|
393
|
+
mediaCache?: CacheStore;
|
394
|
+
mediaUploadTimeoutMs?: number;
|
395
|
+
options?: AxiosRequestConfig;
|
396
|
+
/** the message you want to quote */
|
397
|
+
quoted?: WAMessage;
|
398
|
+
backgroundColor?: string;
|
399
|
+
font?: number;
|
408
400
|
/** The message is for newsletter? */
|
409
|
-
newsletter?: boolean
|
410
|
-
}
|
401
|
+
newsletter?: boolean;
|
402
|
+
};
|
411
403
|
export type MessageContentGenerationOptions = MediaGenerationOptions & {
|
412
|
-
|
413
|
-
|
414
|
-
}
|
415
|
-
export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent
|
404
|
+
getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>;
|
405
|
+
getProfilePicUrl?: (jid: string, type: 'image' | 'preview') => Promise<string | undefined>;
|
406
|
+
};
|
407
|
+
export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent;
|
416
408
|
/**
|
417
409
|
* Type of message upsert
|
418
410
|
* 1. notify => notify the user, this message was just received
|
419
411
|
* 2. append => append the message to the chat history, no notification required
|
420
412
|
*/
|
421
|
-
export type MessageUpsertType = 'append' | 'notify'
|
422
|
-
|
423
|
-
export type
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
export type WAMessageCursor = {
|
428
|
-
|
429
|
-
|
430
|
-
|
413
|
+
export type MessageUpsertType = 'append' | 'notify';
|
414
|
+
export type MessageUserReceipt = proto.IUserReceipt;
|
415
|
+
export type WAMessageUpdate = {
|
416
|
+
update: Partial<WAMessage>;
|
417
|
+
key: proto.IMessageKey;
|
418
|
+
};
|
419
|
+
export type WAMessageCursor = {
|
420
|
+
before: WAMessageKey | undefined;
|
421
|
+
} | {
|
422
|
+
after: WAMessageKey | undefined;
|
423
|
+
};
|
424
|
+
export type MessageUserReceiptUpdate = {
|
425
|
+
key: proto.IMessageKey;
|
426
|
+
receipt: MessageUserReceipt;
|
427
|
+
};
|
431
428
|
export type MediaDecryptionKeyInfo = {
|
432
|
-
iv: Buffer
|
433
|
-
cipherKey: Buffer
|
434
|
-
macKey?: Buffer
|
435
|
-
}
|
436
|
-
|
437
|
-
export type MinimalMessage = Pick<proto.IWebMessageInfo, 'key' | 'messageTimestamp'>
|
429
|
+
iv: Buffer;
|
430
|
+
cipherKey: Buffer;
|
431
|
+
macKey?: Buffer;
|
432
|
+
};
|
433
|
+
export type MinimalMessage = Pick<proto.IWebMessageInfo, 'key' | 'messageTimestamp'>;
|