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