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