@queenanya/baileys 7.2.6 → 7.2.8
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/Defaults/index.d.ts +1 -0
- package/lib/Socket/business.d.ts +4 -1
- package/lib/Socket/chats.d.ts +3 -0
- package/lib/Socket/chats.js +73 -2
- package/lib/Socket/groups.d.ts +9 -0
- package/lib/Socket/index.d.ts +4 -1
- package/lib/Socket/messages-recv.d.ts +3 -0
- package/lib/Socket/messages-recv.js +123 -115
- package/lib/Socket/messages-send.d.ts +3 -0
- package/lib/Socket/newsletter.d.ts +3 -0
- package/lib/Socket/registration.d.ts +4 -1
- package/lib/Socket/socket.d.ts +1 -0
- package/lib/Types/Auth.d.ts +1 -0
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Events.d.ts +4 -0
- package/lib/Types/Message.d.ts +1 -0
- package/lib/Utils/chat-utils.d.ts +1 -0
- package/lib/Utils/crypto.d.ts +1 -0
- package/lib/Utils/event-buffer.js +7 -1
- package/lib/Utils/generics.d.ts +1 -0
- package/lib/Utils/generics.js +2 -1
- package/lib/Utils/history.js +1 -1
- package/lib/Utils/logger.d.ts +1 -1
- package/lib/Utils/messages-media.d.ts +14 -0
- package/lib/Utils/messages-media.js +116 -1
- package/lib/Utils/messages.d.ts +1 -0
- package/lib/Utils/noise-handler.d.ts +1 -0
- package/lib/Utils/process-message.js +2 -1
- package/lib/WABinary/decode.d.ts +1 -0
- package/lib/WABinary/generic-utils.d.ts +1 -0
- package/lib/WAM/BinaryInfo.d.ts +1 -0
- package/lib/WAM/encode.d.ts +1 -0
- package/package.json +1 -2
package/lib/Defaults/index.d.ts
CHANGED
package/lib/Socket/business.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="long" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
3
4
|
import { GetCatalogOptions, ProductCreate, ProductUpdate, SocketConfig } from '../Types';
|
|
4
5
|
import { BinaryNode } from '../WABinary';
|
|
5
6
|
export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
6
|
-
logger: import("pino").Logger<never>;
|
|
7
|
+
logger: import("pino").Logger<never, boolean>;
|
|
7
8
|
getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
|
|
8
9
|
getCatalog: ({ jid, limit, cursor }: GetCatalogOptions) => Promise<{
|
|
9
10
|
products: import("../Types").Product[];
|
|
@@ -117,6 +118,8 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
117
118
|
setAt: Date;
|
|
118
119
|
} | undefined>;
|
|
119
120
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
121
|
+
updateProfilePictureFull: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
122
|
+
updateProfilePictureFull2: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
120
123
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
121
124
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
122
125
|
updateProfileName: (name: string) => Promise<void>;
|
package/lib/Socket/chats.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { Boom } from '@hapi/boom';
|
|
3
4
|
import { proto } from '../../WAProto';
|
|
4
5
|
import { ChatModification, MessageUpsertType, SocketConfig, WABusinessProfile, WAMediaUpload, WAPatchCreate, WAPresence, WAPrivacyCallValue, WAPrivacyGroupAddValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '../Types';
|
|
@@ -31,6 +32,8 @@ export declare const makeChatsSocket: (config: SocketConfig) => {
|
|
|
31
32
|
setAt: Date;
|
|
32
33
|
} | undefined>;
|
|
33
34
|
updateProfilePicture: (jid: string, content: WAMediaUpload) => Promise<void>;
|
|
35
|
+
updateProfilePictureFull: (jid: string, content: WAMediaUpload) => Promise<void>;
|
|
36
|
+
updateProfilePictureFull2: (jid: string, content: WAMediaUpload) => Promise<void>;
|
|
34
37
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
35
38
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
36
39
|
updateProfileName: (name: string) => Promise<void>;
|
package/lib/Socket/chats.js
CHANGED
|
@@ -196,11 +196,72 @@ const makeChatsSocket = (config) => {
|
|
|
196
196
|
};
|
|
197
197
|
/** update the profile picture for yourself or a group */
|
|
198
198
|
const updateProfilePicture = async (jid, content) => {
|
|
199
|
+
let targetJid;
|
|
200
|
+
if (!jid) {
|
|
201
|
+
throw new boom_1.Boom('Illegal no-jid profile update. Please specify either your ID or the ID of the chat you wish to update');
|
|
202
|
+
}
|
|
203
|
+
if ((0, WABinary_1.jidNormalizedUser)(jid) !== (0, WABinary_1.jidNormalizedUser)(authState.creds.me.id)) {
|
|
204
|
+
targetJid = (0, WABinary_1.jidNormalizedUser)(jid); // in case it is someone other than us
|
|
205
|
+
}
|
|
199
206
|
const { img } = await (0, Utils_1.generateProfilePicture)(content);
|
|
200
207
|
await query({
|
|
201
208
|
tag: 'iq',
|
|
202
209
|
attrs: {
|
|
203
|
-
|
|
210
|
+
target: targetJid,
|
|
211
|
+
to: WABinary_1.S_WHATSAPP_NET,
|
|
212
|
+
type: 'set',
|
|
213
|
+
xmlns: 'w:profile:picture'
|
|
214
|
+
},
|
|
215
|
+
content: [
|
|
216
|
+
{
|
|
217
|
+
tag: 'picture',
|
|
218
|
+
attrs: { type: 'image' },
|
|
219
|
+
content: img
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
/** update the profile picture for yourself or a group as Full */
|
|
225
|
+
const updateProfilePictureFull = async (jid, content) => {
|
|
226
|
+
let targetJid;
|
|
227
|
+
if (!jid) {
|
|
228
|
+
throw new boom_1.Boom('Illegal no-jid profile update. Please specify either your ID or the ID of the chat you wish to update');
|
|
229
|
+
}
|
|
230
|
+
if ((0, WABinary_1.jidNormalizedUser)(jid) !== (0, WABinary_1.jidNormalizedUser)(authState.creds.me.id)) {
|
|
231
|
+
targetJid = (0, WABinary_1.jidNormalizedUser)(jid); // in case it is someone other than us
|
|
232
|
+
}
|
|
233
|
+
const { img } = await (0, Utils_1.generateProfilePictureFull)(content);
|
|
234
|
+
await query({
|
|
235
|
+
tag: 'iq',
|
|
236
|
+
attrs: {
|
|
237
|
+
target: targetJid,
|
|
238
|
+
to: WABinary_1.S_WHATSAPP_NET,
|
|
239
|
+
type: 'set',
|
|
240
|
+
xmlns: 'w:profile:picture'
|
|
241
|
+
},
|
|
242
|
+
content: [
|
|
243
|
+
{
|
|
244
|
+
tag: 'picture',
|
|
245
|
+
attrs: { type: 'image' },
|
|
246
|
+
content: img
|
|
247
|
+
}
|
|
248
|
+
]
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
const updateProfilePictureFull2 = async (jid, content) => {
|
|
252
|
+
let targetJid;
|
|
253
|
+
if (!jid) {
|
|
254
|
+
throw new boom_1.Boom('Illegal no-jid profile update. Please specify either your ID or the ID of the chat you wish to update');
|
|
255
|
+
}
|
|
256
|
+
if ((0, WABinary_1.jidNormalizedUser)(jid) !== (0, WABinary_1.jidNormalizedUser)(authState.creds.me.id)) {
|
|
257
|
+
targetJid = (0, WABinary_1.jidNormalizedUser)(jid); // in case it is someone other than us
|
|
258
|
+
}
|
|
259
|
+
const { img } = await (0, Utils_1.generateProfilePictureFP)(content);
|
|
260
|
+
await query({
|
|
261
|
+
tag: 'iq',
|
|
262
|
+
attrs: {
|
|
263
|
+
target: targetJid,
|
|
264
|
+
to: WABinary_1.S_WHATSAPP_NET,
|
|
204
265
|
type: 'set',
|
|
205
266
|
xmlns: 'w:profile:picture'
|
|
206
267
|
},
|
|
@@ -215,10 +276,18 @@ const makeChatsSocket = (config) => {
|
|
|
215
276
|
};
|
|
216
277
|
/** remove the profile picture for yourself or a group */
|
|
217
278
|
const removeProfilePicture = async (jid) => {
|
|
279
|
+
let targetJid;
|
|
280
|
+
if (!jid) {
|
|
281
|
+
throw new boom_1.Boom('Illegal no-jid profile update. Please specify either your ID or the ID of the chat you wish to update');
|
|
282
|
+
}
|
|
283
|
+
if ((0, WABinary_1.jidNormalizedUser)(jid) !== (0, WABinary_1.jidNormalizedUser)(authState.creds.me.id)) {
|
|
284
|
+
targetJid = (0, WABinary_1.jidNormalizedUser)(jid); // in case it is someone other than us
|
|
285
|
+
}
|
|
218
286
|
await query({
|
|
219
287
|
tag: 'iq',
|
|
220
288
|
attrs: {
|
|
221
|
-
|
|
289
|
+
target: targetJid,
|
|
290
|
+
to: WABinary_1.S_WHATSAPP_NET,
|
|
222
291
|
type: 'set',
|
|
223
292
|
xmlns: 'w:profile:picture'
|
|
224
293
|
}
|
|
@@ -850,6 +919,8 @@ const makeChatsSocket = (config) => {
|
|
|
850
919
|
fetchDisappearingDuration,
|
|
851
920
|
fetchStatus,
|
|
852
921
|
updateProfilePicture,
|
|
922
|
+
updateProfilePictureFull,
|
|
923
|
+
updateProfilePictureFull2,
|
|
853
924
|
removeProfilePicture,
|
|
854
925
|
updateProfileStatus,
|
|
855
926
|
updateProfileName,
|
package/lib/Socket/groups.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { proto } from '../../WAProto';
|
|
3
4
|
import { GroupMetadata, ParticipantAction, SocketConfig, WAMessageKey } from '../Types';
|
|
4
5
|
import { BinaryNode } from '../WABinary';
|
|
@@ -67,9 +68,17 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
67
68
|
}[]>;
|
|
68
69
|
fetchStatus: (jid: string) => Promise<{
|
|
69
70
|
status: string | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* revoke a v4 invite for someone
|
|
73
|
+
* @param groupJid group jid
|
|
74
|
+
* @param invitedJid jid of person you invited
|
|
75
|
+
* @returns true if successful
|
|
76
|
+
*/
|
|
70
77
|
setAt: Date;
|
|
71
78
|
} | undefined>;
|
|
72
79
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
80
|
+
updateProfilePictureFull: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
81
|
+
updateProfilePictureFull2: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
73
82
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
74
83
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
75
84
|
updateProfileName: (name: string) => Promise<void>;
|
package/lib/Socket/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/// <reference types="long" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
3
4
|
import { UserFacingSocketConfig } from '../Types';
|
|
4
5
|
declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
5
6
|
register: (code: string) => Promise<import("./registration").ExistsResponse>;
|
|
6
7
|
requestRegistrationCode: (registrationOptions?: import("./registration").RegistrationOptions | undefined) => Promise<import("./registration").ExistsResponse>;
|
|
7
|
-
logger: import("pino").Logger<never>;
|
|
8
|
+
logger: import("pino").Logger<never, boolean>;
|
|
8
9
|
getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
|
|
9
10
|
getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
|
|
10
11
|
products: import("../Types").Product[];
|
|
@@ -118,6 +119,8 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
|
118
119
|
setAt: Date;
|
|
119
120
|
} | undefined>;
|
|
120
121
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
122
|
+
updateProfilePictureFull: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
123
|
+
updateProfilePictureFull2: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
121
124
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
122
125
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
123
126
|
updateProfileName: (name: string) => Promise<void>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { Boom } from '@hapi/boom';
|
|
3
4
|
import { proto } from '../../WAProto';
|
|
4
5
|
import { MessageReceiptType, MessageRelayOptions, SocketConfig, WAMessageKey } from '../Types';
|
|
@@ -104,6 +105,8 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
|
|
|
104
105
|
setAt: Date;
|
|
105
106
|
} | undefined>;
|
|
106
107
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
108
|
+
updateProfilePictureFull: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
109
|
+
updateProfilePictureFull2: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
107
110
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
108
111
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
109
112
|
updateProfileName: (name: string) => Promise<void>;
|
|
@@ -557,59 +557,63 @@ const makeMessagesRecvSocket = (config) => {
|
|
|
557
557
|
const items = (0, WABinary_1.getBinaryNodeChildren)(content[0], 'item');
|
|
558
558
|
ids.push(...items.map(i => i.attrs.id));
|
|
559
559
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
(
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
if (
|
|
571
|
-
|
|
572
|
-
|
|
560
|
+
try {
|
|
561
|
+
await Promise.all([
|
|
562
|
+
processingMutex.mutex(async () => {
|
|
563
|
+
const status = (0, Utils_1.getStatusFromReceiptType)(attrs.type);
|
|
564
|
+
if (typeof status !== 'undefined' &&
|
|
565
|
+
(
|
|
566
|
+
// basically, we only want to know when a message from us has been delivered to/read by the other person
|
|
567
|
+
// or another device of ours has read some messages
|
|
568
|
+
status > WAProto_1.proto.WebMessageInfo.Status.DELIVERY_ACK ||
|
|
569
|
+
!isNodeFromMe)) {
|
|
570
|
+
if ((0, WABinary_1.isJidGroup)(remoteJid) || (0, WABinary_1.isJidStatusBroadcast)(remoteJid)) {
|
|
571
|
+
if (attrs.participant) {
|
|
572
|
+
const updateKey = status === WAProto_1.proto.WebMessageInfo.Status.DELIVERY_ACK ? 'receiptTimestamp' : 'readTimestamp';
|
|
573
|
+
ev.emit('message-receipt.update', ids.map(id => ({
|
|
574
|
+
key: { ...key, id },
|
|
575
|
+
receipt: {
|
|
576
|
+
userJid: (0, WABinary_1.jidNormalizedUser)(attrs.participant),
|
|
577
|
+
[updateKey]: +attrs.t
|
|
578
|
+
}
|
|
579
|
+
})));
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
ev.emit('messages.update', ids.map(id => ({
|
|
573
584
|
key: { ...key, id },
|
|
574
|
-
|
|
575
|
-
userJid: (0, WABinary_1.jidNormalizedUser)(attrs.participant),
|
|
576
|
-
[updateKey]: +attrs.t
|
|
577
|
-
}
|
|
585
|
+
update: { status }
|
|
578
586
|
})));
|
|
579
587
|
}
|
|
580
588
|
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
try {
|
|
595
|
-
logger.debug({ attrs, key }, 'recv retry request');
|
|
596
|
-
await sendMessagesAgain(key, ids, retryNode);
|
|
589
|
+
if (attrs.type === 'retry') {
|
|
590
|
+
// correctly set who is asking for the retry
|
|
591
|
+
key.participant = key.participant || attrs.from;
|
|
592
|
+
const retryNode = (0, WABinary_1.getBinaryNodeChild)(node, 'retry');
|
|
593
|
+
if (willSendMessageAgain(ids[0], key.participant)) {
|
|
594
|
+
if (key.fromMe) {
|
|
595
|
+
try {
|
|
596
|
+
logger.debug({ attrs, key }, 'recv retry request');
|
|
597
|
+
await sendMessagesAgain(key, ids, retryNode);
|
|
598
|
+
}
|
|
599
|
+
catch (error) {
|
|
600
|
+
logger.error({ key, ids, trace: error.stack }, 'error in sending message again');
|
|
601
|
+
}
|
|
597
602
|
}
|
|
598
|
-
|
|
599
|
-
logger.
|
|
603
|
+
else {
|
|
604
|
+
logger.info({ attrs, key }, 'recv retry for not fromMe message');
|
|
600
605
|
}
|
|
601
606
|
}
|
|
602
607
|
else {
|
|
603
|
-
logger.info({ attrs, key }, '
|
|
608
|
+
logger.info({ attrs, key }, 'will not send message again, as sent too many times');
|
|
604
609
|
}
|
|
605
610
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
]);
|
|
611
|
+
})
|
|
612
|
+
]);
|
|
613
|
+
}
|
|
614
|
+
finally {
|
|
615
|
+
await sendMessageAck(node);
|
|
616
|
+
}
|
|
613
617
|
};
|
|
614
618
|
const handleNotification = async (node) => {
|
|
615
619
|
const remoteJid = node.attrs.from;
|
|
@@ -618,36 +622,35 @@ const makeMessagesRecvSocket = (config) => {
|
|
|
618
622
|
await sendMessageAck(node);
|
|
619
623
|
return;
|
|
620
624
|
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
625
|
+
try {
|
|
626
|
+
await Promise.all([
|
|
627
|
+
processingMutex.mutex(async () => {
|
|
628
|
+
var _a;
|
|
629
|
+
const msg = await processNotification(node);
|
|
630
|
+
if (msg) {
|
|
631
|
+
const fromMe = (0, WABinary_1.areJidsSameUser)(node.attrs.participant || remoteJid, authState.creds.me.id);
|
|
632
|
+
msg.key = {
|
|
633
|
+
remoteJid,
|
|
634
|
+
fromMe,
|
|
635
|
+
participant: node.attrs.participant,
|
|
636
|
+
id: node.attrs.id,
|
|
637
|
+
...(msg.key || {})
|
|
638
|
+
};
|
|
639
|
+
(_a = msg.participant) !== null && _a !== void 0 ? _a : (msg.participant = node.attrs.participant);
|
|
640
|
+
msg.messageTimestamp = +node.attrs.t;
|
|
641
|
+
const fullMsg = WAProto_1.proto.WebMessageInfo.fromObject(msg);
|
|
642
|
+
await upsertMessage(fullMsg, 'append');
|
|
643
|
+
}
|
|
644
|
+
})
|
|
645
|
+
]);
|
|
646
|
+
}
|
|
647
|
+
finally {
|
|
648
|
+
await sendMessageAck(node);
|
|
649
|
+
}
|
|
642
650
|
};
|
|
643
651
|
const handleMessage = async (node) => {
|
|
644
652
|
var _a, _b, _c;
|
|
645
653
|
if (shouldIgnoreJid(node.attrs.from) && node.attrs.from !== '@s.whatsapp.net') {
|
|
646
|
-
if (ignoreMsgLoading && node.attrs.offline) {
|
|
647
|
-
logger.debug({ key: node.attrs.key }, 'ignored offline message');
|
|
648
|
-
await sendMessageAck(node);
|
|
649
|
-
return;
|
|
650
|
-
}
|
|
651
654
|
logger.debug({ key: node.attrs.key }, 'ignored message');
|
|
652
655
|
await sendMessageAck(node);
|
|
653
656
|
return;
|
|
@@ -676,57 +679,61 @@ const makeMessagesRecvSocket = (config) => {
|
|
|
676
679
|
ev.emit('chats.phoneNumberShare', { lid: node.attrs.from, jid: node.attrs.sender_pn });
|
|
677
680
|
}
|
|
678
681
|
}
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
if (
|
|
687
|
-
|
|
682
|
+
try {
|
|
683
|
+
await Promise.all([
|
|
684
|
+
processingMutex.mutex(async () => {
|
|
685
|
+
await decrypt();
|
|
686
|
+
// message failed to decrypt
|
|
687
|
+
if (msg.messageStubType === WAProto_1.proto.WebMessageInfo.StubType.CIPHERTEXT) {
|
|
688
|
+
retryMutex.mutex(async () => {
|
|
689
|
+
if (ws.isOpen) {
|
|
690
|
+
if ((0, WABinary_1.getBinaryNodeChild)(node, 'unavailable')) {
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
const encNode = (0, WABinary_1.getBinaryNodeChild)(node, 'enc');
|
|
694
|
+
await sendRetryRequest(node, !encNode);
|
|
695
|
+
if (retryRequestDelayMs) {
|
|
696
|
+
await (0, Utils_1.delay)(retryRequestDelayMs);
|
|
697
|
+
}
|
|
688
698
|
}
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
if (retryRequestDelayMs) {
|
|
692
|
-
await (0, Utils_1.delay)(retryRequestDelayMs);
|
|
699
|
+
else {
|
|
700
|
+
logger.debug({ node }, 'connection closed, ignoring retry req');
|
|
693
701
|
}
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
else {
|
|
705
|
+
// no type in the receipt => message delivered
|
|
706
|
+
let type = undefined;
|
|
707
|
+
let participant = msg.key.participant;
|
|
708
|
+
if (category === 'peer') { // special peer message
|
|
709
|
+
type = 'peer_msg';
|
|
694
710
|
}
|
|
695
|
-
else {
|
|
696
|
-
|
|
711
|
+
else if (msg.key.fromMe) { // message was sent by us from a different device
|
|
712
|
+
type = 'sender';
|
|
713
|
+
// need to specially handle this case
|
|
714
|
+
if ((0, WABinary_1.isJidUser)(msg.key.remoteJid)) {
|
|
715
|
+
participant = author;
|
|
716
|
+
}
|
|
697
717
|
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
else if (msg.key.fromMe) { // message was sent by us from a different device
|
|
708
|
-
type = 'sender';
|
|
709
|
-
// need to specially handle this case
|
|
710
|
-
if ((0, WABinary_1.isJidUser)(msg.key.remoteJid)) {
|
|
711
|
-
participant = author;
|
|
718
|
+
else if (!sendActiveReceipts) {
|
|
719
|
+
type = 'inactive';
|
|
720
|
+
}
|
|
721
|
+
await sendReceipt(msg.key.remoteJid, participant, [msg.key.id], type);
|
|
722
|
+
// send ack for history message
|
|
723
|
+
const isAnyHistoryMsg = (0, Utils_1.getHistoryMsg)(msg.message);
|
|
724
|
+
if (isAnyHistoryMsg) {
|
|
725
|
+
const jid = (0, WABinary_1.jidNormalizedUser)(msg.key.remoteJid);
|
|
726
|
+
await sendReceipt(jid, undefined, [msg.key.id], 'hist_sync');
|
|
712
727
|
}
|
|
713
728
|
}
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
await sendReceipt(jid, undefined, [msg.key.id], 'hist_sync');
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
(0, Utils_2.cleanMessage)(msg, authState.creds.me.id);
|
|
726
|
-
await upsertMessage(msg, node.attrs.offline ? 'append' : 'notify');
|
|
727
|
-
}),
|
|
728
|
-
sendMessageAck(node)
|
|
729
|
-
]);
|
|
729
|
+
(0, Utils_2.cleanMessage)(msg, authState.creds.me.id);
|
|
730
|
+
await upsertMessage(msg, node.attrs.offline ? 'append' : 'notify');
|
|
731
|
+
})
|
|
732
|
+
]);
|
|
733
|
+
}
|
|
734
|
+
finally {
|
|
735
|
+
await sendMessageAck(node);
|
|
736
|
+
}
|
|
730
737
|
};
|
|
731
738
|
const fetchMessageHistory = async (count, oldestMsgKey, oldestMsgTimestamp) => {
|
|
732
739
|
var _a;
|
|
@@ -803,13 +810,14 @@ const makeMessagesRecvSocket = (config) => {
|
|
|
803
810
|
call.isGroup = existingCall.isGroup;
|
|
804
811
|
}
|
|
805
812
|
// delete data once call has ended
|
|
806
|
-
if (status === 'reject' || status === 'accept' || status === 'timeout') {
|
|
813
|
+
if (status === 'reject' || status === 'accept' || status === 'timeout' || status === 'terminate') {
|
|
807
814
|
callOfferCache.del(call.id);
|
|
808
815
|
}
|
|
809
816
|
ev.emit('call', [call]);
|
|
810
817
|
await sendMessageAck(node);
|
|
811
818
|
};
|
|
812
819
|
const handleBadAck = async ({ attrs }) => {
|
|
820
|
+
// const key: WAMessageKey = { remoteJid: attrs.from, fromMe: true, id: attrs.id }
|
|
813
821
|
const key = { remoteJid: attrs.from, fromMe: true, id: attrs.id, server_id: attrs === null || attrs === void 0 ? void 0 : attrs.server_id };
|
|
814
822
|
// current hypothesis is that if pash is sent in the ack
|
|
815
823
|
// it means -- the message hasn't reached all devices yet
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { Boom } from '@hapi/boom';
|
|
3
4
|
import { proto } from '../../WAProto';
|
|
4
5
|
import { AnyMessageContent, MediaConnInfo, MessageReceiptType, MessageRelayOptions, MiscMessageGenerationOptions, SocketConfig, WAMessageKey } from '../Types';
|
|
@@ -97,6 +98,8 @@ export declare const makeMessagesSocket: (config: SocketConfig) => {
|
|
|
97
98
|
setAt: Date;
|
|
98
99
|
} | undefined>;
|
|
99
100
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
101
|
+
updateProfilePictureFull: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
102
|
+
updateProfilePictureFull2: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
100
103
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
101
104
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
102
105
|
updateProfileName: (name: string) => Promise<void>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { SocketConfig, WAMediaUpload, NewsletterMetadata, NewsletterReactionMode, NewsletterViewRole, NewsletterFetchedUpdate } from '../Types';
|
|
3
4
|
import { BinaryNode } from '../WABinary';
|
|
4
5
|
export declare const makeNewsletterSocket: (config: SocketConfig) => {
|
|
@@ -82,6 +83,8 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
|
|
|
82
83
|
setAt: Date;
|
|
83
84
|
} | undefined>;
|
|
84
85
|
updateProfilePicture: (jid: string, content: WAMediaUpload) => Promise<void>;
|
|
86
|
+
updateProfilePictureFull: (jid: string, content: WAMediaUpload) => Promise<void>;
|
|
87
|
+
updateProfilePictureFull2: (jid: string, content: WAMediaUpload) => Promise<void>;
|
|
85
88
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
86
89
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
87
90
|
updateProfileName: (name: string) => Promise<void>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/// <reference types="long" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
3
4
|
import { AxiosRequestConfig } from 'axios';
|
|
4
5
|
import { KeyPair, SignedKeyPair, SocketConfig } from '../Types';
|
|
5
6
|
export declare const makeRegistrationSocket: (config: SocketConfig) => {
|
|
6
7
|
register: (code: string) => Promise<ExistsResponse>;
|
|
7
8
|
requestRegistrationCode: (registrationOptions?: RegistrationOptions) => Promise<ExistsResponse>;
|
|
8
|
-
logger: import("pino").Logger<never>;
|
|
9
|
+
logger: import("pino").Logger<never, boolean>;
|
|
9
10
|
getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
|
|
10
11
|
getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
|
|
11
12
|
products: import("../Types").Product[];
|
|
@@ -119,6 +120,8 @@ export declare const makeRegistrationSocket: (config: SocketConfig) => {
|
|
|
119
120
|
setAt: Date;
|
|
120
121
|
} | undefined>;
|
|
121
122
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
123
|
+
updateProfilePictureFull: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
124
|
+
updateProfilePictureFull2: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
122
125
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
123
126
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
124
127
|
updateProfileName: (name: string) => Promise<void>;
|
package/lib/Socket/socket.d.ts
CHANGED
package/lib/Types/Auth.d.ts
CHANGED
package/lib/Types/Call.d.ts
CHANGED
package/lib/Types/Events.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export type BaileysEventMap = {
|
|
|
23
23
|
isLatest?: boolean;
|
|
24
24
|
progress?: number | null;
|
|
25
25
|
syncType?: proto.HistorySync.HistorySyncType;
|
|
26
|
+
peerDataRequestSessionId?: string | null;
|
|
26
27
|
};
|
|
27
28
|
/** upsert chats */
|
|
28
29
|
'chats.upsert': Chat[];
|
|
@@ -144,6 +145,9 @@ export type BufferedEventData = {
|
|
|
144
145
|
};
|
|
145
146
|
empty: boolean;
|
|
146
147
|
isLatest: boolean;
|
|
148
|
+
progress?: number | null;
|
|
149
|
+
syncType?: proto.HistorySync.HistorySyncType;
|
|
150
|
+
peerDataRequestSessionId?: string;
|
|
147
151
|
};
|
|
148
152
|
chatUpserts: {
|
|
149
153
|
[jid: string]: Chat;
|
package/lib/Types/Message.d.ts
CHANGED
package/lib/Utils/crypto.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { KeyPair } from '../Types';
|
|
3
4
|
/** prefix version byte to the pub keys, required for some curve crypto functions */
|
|
4
5
|
export declare const generateSignalPubKey: (pubKey: Uint8Array | Buffer) => Uint8Array | Buffer;
|
|
@@ -176,6 +176,9 @@ function append(data, historyCache, event, eventData, logger) {
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
data.historySets.empty = false;
|
|
179
|
+
data.historySets.syncType = eventData.syncType;
|
|
180
|
+
data.historySets.progress = eventData.progress;
|
|
181
|
+
data.historySets.peerDataRequestSessionId = eventData.peerDataRequestSessionId;
|
|
179
182
|
data.historySets.isLatest = eventData.isLatest || data.historySets.isLatest;
|
|
180
183
|
break;
|
|
181
184
|
case 'chats.upsert':
|
|
@@ -442,7 +445,10 @@ function consolidateEvents(data) {
|
|
|
442
445
|
chats: Object.values(data.historySets.chats),
|
|
443
446
|
messages: Object.values(data.historySets.messages),
|
|
444
447
|
contacts: Object.values(data.historySets.contacts),
|
|
445
|
-
|
|
448
|
+
syncType: data.historySets.syncType,
|
|
449
|
+
progress: data.historySets.progress,
|
|
450
|
+
isLatest: data.historySets.isLatest,
|
|
451
|
+
peerDataRequestSessionId: data.historySets.peerDataRequestSessionId
|
|
446
452
|
};
|
|
447
453
|
}
|
|
448
454
|
const chatUpsertList = Object.values(data.chatUpserts);
|
package/lib/Utils/generics.d.ts
CHANGED
package/lib/Utils/generics.js
CHANGED
package/lib/Utils/history.js
CHANGED
package/lib/Utils/logger.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("pino").Logger<never>;
|
|
1
|
+
declare const _default: import("pino").Logger<never, boolean>;
|
|
2
2
|
export default _default;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
/// <reference types="node" />
|
|
4
|
+
/// <reference types="node" />
|
|
4
5
|
import { Boom } from '@hapi/boom';
|
|
5
6
|
import { AxiosRequestConfig } from 'axios';
|
|
6
7
|
import type { Logger } from 'pino';
|
|
@@ -23,6 +24,19 @@ export declare const encodeBase64EncodedStringForUpload: (b64: string) => string
|
|
|
23
24
|
export declare const generateProfilePicture: (mediaUpload: WAMediaUpload) => Promise<{
|
|
24
25
|
img: Buffer;
|
|
25
26
|
}>;
|
|
27
|
+
export declare const generateProfilePictureFull: (mediaUpload: WAMediaUpload) => Promise<{
|
|
28
|
+
img: Buffer;
|
|
29
|
+
}>;
|
|
30
|
+
export declare const generateProfilePictureFP: (mediaUpload: WAMediaUpload) => Promise<{
|
|
31
|
+
img: Buffer;
|
|
32
|
+
}>;
|
|
33
|
+
export declare const generatePP: (buffer: any) => Promise<{
|
|
34
|
+
img: any;
|
|
35
|
+
preview: any;
|
|
36
|
+
}>;
|
|
37
|
+
export declare const changeprofileFull: (img: any) => Promise<{
|
|
38
|
+
img: any;
|
|
39
|
+
}>;
|
|
26
40
|
/** gets the SHA256 of the given media message */
|
|
27
41
|
export declare const mediaMessageSHA256B64: (message: WAMessageContent) => string | null | undefined;
|
|
28
42
|
export declare function getAudioDuration(buffer: Buffer | string | Readable): Promise<number | undefined>;
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.getStatusCodeForMediaRetry = exports.decryptMediaRetryData = exports.decodeMediaRetryNode = exports.encryptMediaRetryRequest = exports.getWAUploadToServer = exports.extensionForMediaMessage = exports.downloadEncryptedContent = exports.downloadContentFromMessage = exports.getUrlFromDirectPath = exports.encryptedStream = exports.prepareStream = exports.getHttpStream = exports.generateThumbnail = exports.getStream = exports.toBuffer = exports.toReadable = exports.getAudioWaveform = exports.getAudioDuration = exports.mediaMessageSHA256B64 = exports.generateProfilePicture = exports.encodeBase64EncodedStringForUpload = exports.extractImageThumb = exports.getMediaKeys = exports.hkdfInfoKey = void 0;
|
|
29
|
+
exports.getStatusCodeForMediaRetry = exports.decryptMediaRetryData = exports.decodeMediaRetryNode = exports.encryptMediaRetryRequest = exports.getWAUploadToServer = exports.extensionForMediaMessage = exports.downloadEncryptedContent = exports.downloadContentFromMessage = exports.getUrlFromDirectPath = exports.encryptedStream = exports.prepareStream = exports.getHttpStream = exports.generateThumbnail = exports.getStream = exports.toBuffer = exports.toReadable = exports.getAudioWaveform = exports.getAudioDuration = exports.mediaMessageSHA256B64 = exports.changeprofileFull = exports.generatePP = exports.generateProfilePictureFP = exports.generateProfilePictureFull = exports.generateProfilePicture = exports.encodeBase64EncodedStringForUpload = exports.extractImageThumb = exports.getMediaKeys = exports.hkdfInfoKey = void 0;
|
|
30
30
|
const boom_1 = require("@hapi/boom");
|
|
31
31
|
const axios_1 = __importDefault(require("axios"));
|
|
32
32
|
const child_process_1 = require("child_process");
|
|
@@ -185,6 +185,121 @@ const generateProfilePicture = async (mediaUpload) => {
|
|
|
185
185
|
};
|
|
186
186
|
};
|
|
187
187
|
exports.generateProfilePicture = generateProfilePicture;
|
|
188
|
+
const generateProfilePictureFull = async (mediaUpload) => {
|
|
189
|
+
var _a, _b;
|
|
190
|
+
let bufferOrFilePath;
|
|
191
|
+
if (Buffer.isBuffer(mediaUpload)) {
|
|
192
|
+
bufferOrFilePath = mediaUpload;
|
|
193
|
+
}
|
|
194
|
+
else if ('url' in mediaUpload) {
|
|
195
|
+
bufferOrFilePath = mediaUpload.url.toString();
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
bufferOrFilePath = await (0, exports.toBuffer)(mediaUpload.stream);
|
|
199
|
+
}
|
|
200
|
+
const lib = await getImageProcessingLibrary();
|
|
201
|
+
let img;
|
|
202
|
+
if ('sharp' in lib && typeof ((_a = lib.sharp) === null || _a === void 0 ? void 0 : _a.default) === 'function') {
|
|
203
|
+
img = lib.sharp.default(bufferOrFilePath)
|
|
204
|
+
.resize(720, 720)
|
|
205
|
+
.jpeg({
|
|
206
|
+
quality: 50,
|
|
207
|
+
})
|
|
208
|
+
.toBuffer();
|
|
209
|
+
}
|
|
210
|
+
else if ('jimp' in lib && typeof ((_b = lib.jimp) === null || _b === void 0 ? void 0 : _b.read) === 'function') {
|
|
211
|
+
const { read, MIME_JPEG, RESIZE_BILINEAR } = lib.jimp;
|
|
212
|
+
const jimp = await read(bufferOrFilePath);
|
|
213
|
+
const min = Math.min(jimp.getWidth(), jimp.getHeight());
|
|
214
|
+
const cropped = jimp.crop(0, 0, min, min);
|
|
215
|
+
img = cropped
|
|
216
|
+
.quality(50)
|
|
217
|
+
.resize(720, 720, RESIZE_BILINEAR)
|
|
218
|
+
.getBufferAsync(MIME_JPEG);
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
throw new boom_1.Boom('No image processing library available');
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
img: await img,
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
exports.generateProfilePictureFull = generateProfilePictureFull;
|
|
228
|
+
const generateProfilePictureFP = async (mediaUpload) => {
|
|
229
|
+
var _a, _b;
|
|
230
|
+
let bufferOrFilePath;
|
|
231
|
+
if (Buffer.isBuffer(mediaUpload)) {
|
|
232
|
+
bufferOrFilePath = mediaUpload;
|
|
233
|
+
}
|
|
234
|
+
else if ('url' in mediaUpload) {
|
|
235
|
+
bufferOrFilePath = mediaUpload.url.toString();
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
bufferOrFilePath = await (0, exports.toBuffer)(mediaUpload.stream);
|
|
239
|
+
}
|
|
240
|
+
const lib = await getImageProcessingLibrary();
|
|
241
|
+
let img;
|
|
242
|
+
if ('sharp' in lib && typeof ((_a = lib.sharp) === null || _a === void 0 ? void 0 : _a.default) === 'function') {
|
|
243
|
+
img = lib.sharp.default(bufferOrFilePath)
|
|
244
|
+
.resize(1280, 1280)
|
|
245
|
+
.jpeg({
|
|
246
|
+
quality: 50,
|
|
247
|
+
})
|
|
248
|
+
.toBuffer();
|
|
249
|
+
}
|
|
250
|
+
else if ('jimp' in lib && typeof ((_b = lib.jimp) === null || _b === void 0 ? void 0 : _b.read) === 'function') {
|
|
251
|
+
const { read, MIME_JPEG, RESIZE_BILINEAR } = lib.jimp;
|
|
252
|
+
const jimp = await read(bufferOrFilePath);
|
|
253
|
+
const min = Math.min(jimp.getWidth(), jimp.getHeight());
|
|
254
|
+
const cropped = jimp.crop(0, 0, min, min);
|
|
255
|
+
img = cropped
|
|
256
|
+
.quality(50)
|
|
257
|
+
.resize(1280, 1280, RESIZE_BILINEAR)
|
|
258
|
+
.getBufferAsync(MIME_JPEG);
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
throw new boom_1.Boom('No image processing library available');
|
|
262
|
+
}
|
|
263
|
+
return {
|
|
264
|
+
img: await img,
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
exports.generateProfilePictureFP = generateProfilePictureFP;
|
|
268
|
+
const generatePP = async (buffer) => {
|
|
269
|
+
const Jimp = require('jimp');
|
|
270
|
+
const { read, MIME_JPEG, RESIZE_BILINEAR } = require('jimp');
|
|
271
|
+
const jimp = await Jimp.read(buffer);
|
|
272
|
+
const min = jimp.getWidth();
|
|
273
|
+
const max = jimp.getHeight();
|
|
274
|
+
const cropped = jimp.crop(0, 0, min, max);
|
|
275
|
+
return {
|
|
276
|
+
img: await cropped.scaleToFit(720, 720).getBufferAsync(Jimp.MIME_JPEG),
|
|
277
|
+
preview: await cropped.normalize().getBufferAsync(Jimp.MIME_JPEG),
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
exports.generatePP = generatePP;
|
|
281
|
+
const changeprofileFull = async (img) => {
|
|
282
|
+
const Jimp = require('jimp');
|
|
283
|
+
const { read, MIME_JPEG, RESIZE_BILINEAR } = require('jimp');
|
|
284
|
+
const jimp = await read(img);
|
|
285
|
+
const min = Math.min(jimp.getWidth(), jimp.getHeight());
|
|
286
|
+
const cropped = jimp.crop(0, 0, jimp.getWidth(), jimp.getHeight());
|
|
287
|
+
let width = jimp.getWidth(), hight = jimp.getHeight(), ratio;
|
|
288
|
+
if (width > hight) {
|
|
289
|
+
ratio = jimp.getWidth() / 720;
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
ratio = jimp.getWidth() / 324;
|
|
293
|
+
}
|
|
294
|
+
;
|
|
295
|
+
width = width / ratio;
|
|
296
|
+
hight = hight / ratio;
|
|
297
|
+
img = cropped.quality(100).resize(width, hight).getBufferAsync(MIME_JPEG);
|
|
298
|
+
return {
|
|
299
|
+
img: await img
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
exports.changeprofileFull = changeprofileFull;
|
|
188
303
|
/** gets the SHA256 of the given media message */
|
|
189
304
|
const mediaMessageSHA256B64 = (message) => {
|
|
190
305
|
const media = Object.values(message)[0];
|
package/lib/Utils/messages.d.ts
CHANGED
|
@@ -150,7 +150,8 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
150
150
|
...data,
|
|
151
151
|
isLatest: histNotification.syncType !== WAProto_1.proto.HistorySync.HistorySyncType.ON_DEMAND
|
|
152
152
|
? isLatest
|
|
153
|
-
: undefined
|
|
153
|
+
: undefined,
|
|
154
|
+
peerDataRequestSessionId: histNotification.peerDataRequestSessionId
|
|
154
155
|
});
|
|
155
156
|
}
|
|
156
157
|
break;
|
package/lib/WABinary/decode.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import type { BinaryNode, BinaryNodeCodingOptions } from './types';
|
|
3
4
|
export declare const decompressingIfRequired: (buffer: Buffer) => Promise<Buffer>;
|
|
4
5
|
export declare const decodeDecompressedBinaryNode: (buffer: Buffer, opts: Pick<BinaryNodeCodingOptions, 'DOUBLE_BYTE_TOKENS' | 'SINGLE_BYTE_TOKENS' | 'TAGS'>, indexRef?: {
|
package/lib/WAM/BinaryInfo.d.ts
CHANGED
package/lib/WAM/encode.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@queenanya/baileys",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.8",
|
|
4
4
|
"description": "WhatsApp API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"whatsapp",
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@adiwajshing/keyed-db": "^0.2.4",
|
|
47
|
-
"@queenanya/invite": "latest",
|
|
48
47
|
"@hapi/boom": "^10.0.1",
|
|
49
48
|
"async-lock": "^1.4.1",
|
|
50
49
|
"audio-decode": "^2.2.0",
|