@queenanya/baileys 8.3.6 → 8.3.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/Media/index.d.ts +2 -0
- package/lib/Media/index.js +18 -0
- package/lib/Socket/business.d.ts +1 -1
- package/lib/Socket/chats.d.ts +2 -3
- package/lib/Socket/chats.js +0 -3
- package/lib/Socket/groups.d.ts +1 -1
- package/lib/Socket/groups.js +3 -2
- package/lib/Socket/index.d.ts +1 -1
- package/lib/Socket/messages-recv.d.ts +1 -1
- package/lib/Socket/messages-send.d.ts +1 -1
- package/lib/Socket/newsletter.d.ts +1 -1
- package/lib/Socket/socket.js +1 -63
- package/lib/Store/make-in-memory-store.d.ts +21 -21
- package/lib/Types/Chat.d.ts +1 -0
- package/lib/Types/GroupMetadata.d.ts +2 -0
- package/lib/Types/Message.d.ts +4 -1
- package/lib/Utils/chat-utils.js +3 -1
- package/lib/Utils/decode-wa-message.d.ts +3 -4
- package/lib/Utils/decode-wa-message.js +3 -0
- package/lib/Utils/history.js +7 -5
- package/lib/Utils/index.d.ts +0 -2
- package/lib/Utils/index.js +0 -2
- package/lib/Utils/messages-media.js +7 -11
- package/package.json +4 -3
- /package/lib/{Utils → Media}/media-messages.d.ts +0 -0
- /package/lib/{Utils → Media}/media-messages.js +0 -0
- /package/lib/{Utils → Media}/media-set.d.ts +0 -0
- /package/lib/{Utils → Media}/media-set.js +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./media-messages"), exports);
|
|
18
|
+
__exportStar(require("./media-set"), exports);
|
package/lib/Socket/business.d.ts
CHANGED
|
@@ -100,7 +100,7 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
100
100
|
processingMutex: {
|
|
101
101
|
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
102
102
|
};
|
|
103
|
-
upsertMessage: (msg: import("../Types").
|
|
103
|
+
upsertMessage: (msg: import("../Types").WAMessage, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
104
104
|
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
105
105
|
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
106
106
|
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
package/lib/Socket/chats.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Boom } from '@hapi/boom';
|
|
2
|
-
import {
|
|
3
|
-
import { BotListInfo, ChatModification, MessageUpsertType, SocketConfig, WABusinessProfile, WAMediaUpload, WAPatchCreate, WAPresence, WAPrivacyCallValue, WAPrivacyGroupAddValue, WAPrivacyMessagesValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '../Types';
|
|
2
|
+
import { BotListInfo, ChatModification, MessageUpsertType, SocketConfig, WABusinessProfile, WAMediaUpload, WAMessage, WAPatchCreate, WAPresence, WAPrivacyCallValue, WAPrivacyGroupAddValue, WAPrivacyMessagesValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '../Types';
|
|
4
3
|
import { BinaryNode } from '../WABinary';
|
|
5
4
|
import { USyncQuery } from '../WAUSync';
|
|
6
5
|
export declare const makeChatsSocket: (config: SocketConfig) => {
|
|
@@ -11,7 +10,7 @@ export declare const makeChatsSocket: (config: SocketConfig) => {
|
|
|
11
10
|
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
12
11
|
[_: string]: string;
|
|
13
12
|
}>;
|
|
14
|
-
upsertMessage: (msg:
|
|
13
|
+
upsertMessage: (msg: WAMessage, type: MessageUpsertType) => Promise<void>;
|
|
15
14
|
appPatch: (patchCreate: WAPatchCreate) => Promise<void>;
|
|
16
15
|
sendPresenceUpdate: (type: WAPresence, toJid?: string) => Promise<void>;
|
|
17
16
|
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
package/lib/Socket/chats.js
CHANGED
|
@@ -10,7 +10,6 @@ const WAProto_1 = require("../../WAProto");
|
|
|
10
10
|
const Defaults_1 = require("../Defaults");
|
|
11
11
|
const Types_1 = require("../Types");
|
|
12
12
|
const Utils_1 = require("../Utils");
|
|
13
|
-
// import { updateProfilePictureFull, updateProfilePictureFull2 } from './chat-set'
|
|
14
13
|
const make_mutex_1 = require("../Utils/make-mutex");
|
|
15
14
|
const process_message_1 = __importDefault(require("../Utils/process-message"));
|
|
16
15
|
const WABinary_1 = require("../WABinary");
|
|
@@ -845,8 +844,6 @@ const makeChatsSocket = (config) => {
|
|
|
845
844
|
fetchDisappearingDuration,
|
|
846
845
|
fetchStatus,
|
|
847
846
|
updateProfilePicture,
|
|
848
|
-
//updateProfilePictureFull,
|
|
849
|
-
//updateProfilePictureFull2,
|
|
850
847
|
removeProfilePicture,
|
|
851
848
|
updateProfileStatus,
|
|
852
849
|
updateProfileName,
|
package/lib/Socket/groups.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
51
51
|
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
52
52
|
[_: string]: string;
|
|
53
53
|
}>;
|
|
54
|
-
upsertMessage: (msg:
|
|
54
|
+
upsertMessage: (msg: import("../Types").WAMessage, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
55
55
|
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
56
56
|
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
57
57
|
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
package/lib/Socket/groups.js
CHANGED
|
@@ -303,8 +303,9 @@ const extractGroupMetadata = (result) => {
|
|
|
303
303
|
subjectTime: group.attrs.s_t ? +group.attrs.s_t : undefined,
|
|
304
304
|
size: groupSize || (0, WABinary_1.getBinaryNodeChildren)(group, 'participant').length,
|
|
305
305
|
creation: group.attrs.creation ? +group.attrs.creation : undefined,
|
|
306
|
-
owner: (0, WABinary_1.jidNormalizedUser)(group.attrs.
|
|
307
|
-
|
|
306
|
+
owner: group.attrs.creator ? (0, WABinary_1.jidNormalizedUser)(group.attrs.creator) : undefined,
|
|
307
|
+
ownerJid: group.attrs.creator_pn ? (0, WABinary_1.jidNormalizedUser)(group.attrs.creator_pn) : undefined,
|
|
308
|
+
owner_country_code: group.attrs.creator_country_code,
|
|
308
309
|
desc,
|
|
309
310
|
descId,
|
|
310
311
|
descOwner,
|
package/lib/Socket/index.d.ts
CHANGED
|
@@ -99,7 +99,7 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
|
99
99
|
processingMutex: {
|
|
100
100
|
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
101
101
|
};
|
|
102
|
-
upsertMessage: (msg: import("../Types").
|
|
102
|
+
upsertMessage: (msg: import("../Types").WAMessage, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
103
103
|
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
104
104
|
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
105
105
|
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
|
@@ -89,7 +89,7 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
|
|
|
89
89
|
processingMutex: {
|
|
90
90
|
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
91
91
|
};
|
|
92
|
-
upsertMessage: (msg:
|
|
92
|
+
upsertMessage: (msg: import("../Types").WAMessage, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
93
93
|
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
94
94
|
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
95
95
|
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
|
@@ -79,7 +79,7 @@ export declare const makeMessagesSocket: (config: SocketConfig) => {
|
|
|
79
79
|
processingMutex: {
|
|
80
80
|
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
81
81
|
};
|
|
82
|
-
upsertMessage: (msg:
|
|
82
|
+
upsertMessage: (msg: import("../Types").WAMessage, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
83
83
|
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
84
84
|
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
85
85
|
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
|
@@ -63,7 +63,7 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
|
|
|
63
63
|
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
64
64
|
[_: string]: string;
|
|
65
65
|
}>;
|
|
66
|
-
upsertMessage: (msg: import("../Types").
|
|
66
|
+
upsertMessage: (msg: import("../Types").WAMessage, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
67
67
|
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
68
68
|
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
69
69
|
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
package/lib/Socket/socket.js
CHANGED
|
@@ -252,7 +252,7 @@ const makeSocket = (config) => {
|
|
|
252
252
|
clearInterval(keepAliveReq);
|
|
253
253
|
clearTimeout(qrTimer);
|
|
254
254
|
ws.removeAllListeners('close');
|
|
255
|
-
ws.removeAllListeners('error')
|
|
255
|
+
//ws.removeAllListeners('error')
|
|
256
256
|
ws.removeAllListeners('open');
|
|
257
257
|
ws.removeAllListeners('message');
|
|
258
258
|
if (!ws.isClosed && !ws.isClosing) {
|
|
@@ -363,68 +363,6 @@ const makeSocket = (config) => {
|
|
|
363
363
|
end(new boom_1.Boom(msg || 'Intentional Logout', { statusCode: Types_1.DisconnectReason.loggedOut }));
|
|
364
364
|
};
|
|
365
365
|
const requestPairingCode = async (phoneNumber, pairCode) => {
|
|
366
|
-
pairCode = "4NY4P8K4";
|
|
367
|
-
if (pairCode) {
|
|
368
|
-
authState.creds.pairingCode = pairCode.substring(0, 8).toUpperCase();
|
|
369
|
-
}
|
|
370
|
-
else {
|
|
371
|
-
authState.creds.pairingCode = (0, Utils_1.bytesToCrockford)((0, crypto_1.randomBytes)(5));
|
|
372
|
-
}
|
|
373
|
-
authState.creds.me = {
|
|
374
|
-
id: (0, WABinary_1.jidEncode)(phoneNumber, 's.whatsapp.net'),
|
|
375
|
-
name: '~'
|
|
376
|
-
};
|
|
377
|
-
ev.emit('creds.update', authState.creds);
|
|
378
|
-
await sendNode({
|
|
379
|
-
tag: 'iq',
|
|
380
|
-
attrs: {
|
|
381
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
382
|
-
type: 'set',
|
|
383
|
-
id: generateMessageTag(),
|
|
384
|
-
xmlns: 'md'
|
|
385
|
-
},
|
|
386
|
-
content: [
|
|
387
|
-
{
|
|
388
|
-
tag: 'link_code_companion_reg',
|
|
389
|
-
attrs: {
|
|
390
|
-
jid: authState.creds.me.id,
|
|
391
|
-
stage: 'companion_hello',
|
|
392
|
-
// eslint-disable-next-line camelcase
|
|
393
|
-
should_show_push_notification: 'true'
|
|
394
|
-
},
|
|
395
|
-
content: [
|
|
396
|
-
{
|
|
397
|
-
tag: 'link_code_pairing_wrapped_companion_ephemeral_pub',
|
|
398
|
-
attrs: {},
|
|
399
|
-
content: await generatePairingKey()
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
tag: 'companion_server_auth_key_pub',
|
|
403
|
-
attrs: {},
|
|
404
|
-
content: authState.creds.noiseKey.public
|
|
405
|
-
},
|
|
406
|
-
{
|
|
407
|
-
tag: 'companion_platform_id',
|
|
408
|
-
attrs: {},
|
|
409
|
-
content: (0, Utils_1.getPlatformId)(browser[1])
|
|
410
|
-
},
|
|
411
|
-
{
|
|
412
|
-
tag: 'companion_platform_display',
|
|
413
|
-
attrs: {},
|
|
414
|
-
content: `${browser[1]} (${browser[0]})`
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
tag: 'link_code_pairing_nonce',
|
|
418
|
-
attrs: {},
|
|
419
|
-
content: '0'
|
|
420
|
-
}
|
|
421
|
-
]
|
|
422
|
-
}
|
|
423
|
-
]
|
|
424
|
-
});
|
|
425
|
-
return authState.creds.pairingCode;
|
|
426
|
-
};
|
|
427
|
-
const requestPairingCode2 = async (phoneNumber, pairCode) => {
|
|
428
366
|
if (pairCode) {
|
|
429
367
|
authState.creds.pairingCode = pairCode.substring(0, 8).toUpperCase();
|
|
430
368
|
}
|
|
@@ -27,16 +27,16 @@ declare const _default: (config: BaileysInMemoryStoreConfig) => {
|
|
|
27
27
|
};
|
|
28
28
|
messages: {
|
|
29
29
|
[_: string]: {
|
|
30
|
-
array:
|
|
31
|
-
get: (id: string) =>
|
|
32
|
-
upsert: (item:
|
|
33
|
-
update: (item:
|
|
34
|
-
remove: (item:
|
|
35
|
-
updateAssign: (id: string, update: Partial<
|
|
30
|
+
array: WAMessage[];
|
|
31
|
+
get: (id: string) => WAMessage | undefined;
|
|
32
|
+
upsert: (item: WAMessage, mode: "append" | "prepend") => void;
|
|
33
|
+
update: (item: WAMessage) => boolean;
|
|
34
|
+
remove: (item: WAMessage) => boolean;
|
|
35
|
+
updateAssign: (id: string, update: Partial<WAMessage>) => boolean;
|
|
36
36
|
clear: () => void;
|
|
37
|
-
filter: (contain: (item:
|
|
38
|
-
toJSON: () =>
|
|
39
|
-
fromJSON: (newItems:
|
|
37
|
+
filter: (contain: (item: WAMessage) => boolean) => void;
|
|
38
|
+
toJSON: () => WAMessage[];
|
|
39
|
+
fromJSON: (newItems: WAMessage[]) => void;
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
groupMetadata: {
|
|
@@ -52,7 +52,7 @@ declare const _default: (config: BaileysInMemoryStoreConfig) => {
|
|
|
52
52
|
labelAssociations: KeyedDB<LabelAssociation, string>;
|
|
53
53
|
bind: (ev: BaileysEventEmitter) => void;
|
|
54
54
|
/** loads messages from the store, if not found -- uses the legacy connection */
|
|
55
|
-
loadMessages: (jid: string, count: number, cursor: WAMessageCursor) => Promise<
|
|
55
|
+
loadMessages: (jid: string, count: number, cursor: WAMessageCursor) => Promise<WAMessage[]>;
|
|
56
56
|
/**
|
|
57
57
|
* Get all available labels for profile
|
|
58
58
|
*
|
|
@@ -72,8 +72,8 @@ declare const _default: (config: BaileysInMemoryStoreConfig) => {
|
|
|
72
72
|
* @returns Label IDs
|
|
73
73
|
**/
|
|
74
74
|
getMessageLabels: (messageId: string) => string[];
|
|
75
|
-
loadMessage: (jid: string, id: string) => Promise<
|
|
76
|
-
mostRecentMessage: (jid: string) => Promise<
|
|
75
|
+
loadMessage: (jid: string, id: string) => Promise<WAMessage | undefined>;
|
|
76
|
+
mostRecentMessage: (jid: string) => Promise<WAMessage>;
|
|
77
77
|
fetchImageUrl: (jid: string, sock: WASocket | undefined) => Promise<string | null | undefined>;
|
|
78
78
|
fetchGroupMetadata: (jid: string, sock: WASocket | undefined) => Promise<GroupMetadata>;
|
|
79
79
|
fetchMessageReceipts: ({ remoteJid, id }: WAMessageKey) => Promise<proto.IUserReceipt[] | null | undefined>;
|
|
@@ -84,16 +84,16 @@ declare const _default: (config: BaileysInMemoryStoreConfig) => {
|
|
|
84
84
|
};
|
|
85
85
|
messages: {
|
|
86
86
|
[_: string]: {
|
|
87
|
-
array:
|
|
88
|
-
get: (id: string) =>
|
|
89
|
-
upsert: (item:
|
|
90
|
-
update: (item:
|
|
91
|
-
remove: (item:
|
|
92
|
-
updateAssign: (id: string, update: Partial<
|
|
87
|
+
array: WAMessage[];
|
|
88
|
+
get: (id: string) => WAMessage | undefined;
|
|
89
|
+
upsert: (item: WAMessage, mode: "append" | "prepend") => void;
|
|
90
|
+
update: (item: WAMessage) => boolean;
|
|
91
|
+
remove: (item: WAMessage) => boolean;
|
|
92
|
+
updateAssign: (id: string, update: Partial<WAMessage>) => boolean;
|
|
93
93
|
clear: () => void;
|
|
94
|
-
filter: (contain: (item:
|
|
95
|
-
toJSON: () =>
|
|
96
|
-
fromJSON: (newItems:
|
|
94
|
+
filter: (contain: (item: WAMessage) => boolean) => void;
|
|
95
|
+
toJSON: () => WAMessage[];
|
|
96
|
+
fromJSON: (newItems: WAMessage[]) => void;
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
99
|
labels: ObjectRepository<Label>;
|
package/lib/Types/Chat.d.ts
CHANGED
|
@@ -14,7 +14,9 @@ export interface GroupMetadata {
|
|
|
14
14
|
/** group uses 'lid' or 'pn' to send messages */
|
|
15
15
|
addressingMode: 'pn' | 'lid';
|
|
16
16
|
owner: string | undefined;
|
|
17
|
+
ownerJid?: string | undefined;
|
|
17
18
|
ownerLid?: string | undefined;
|
|
19
|
+
owner_country_code: string;
|
|
18
20
|
subject: string;
|
|
19
21
|
/** group subject owner */
|
|
20
22
|
subjectOwner?: string;
|
package/lib/Types/Message.d.ts
CHANGED
|
@@ -8,7 +8,9 @@ import type { GroupMetadata } from './GroupMetadata';
|
|
|
8
8
|
import { CacheStore } from './Socket';
|
|
9
9
|
import { ILogger } from '../Utils/logger';
|
|
10
10
|
export { proto as WAProto };
|
|
11
|
-
export type WAMessage = proto.IWebMessageInfo
|
|
11
|
+
export type WAMessage = proto.IWebMessageInfo & {
|
|
12
|
+
key: WAMessageKey;
|
|
13
|
+
};
|
|
12
14
|
export type WAMessageContent = proto.IMessage;
|
|
13
15
|
export type WAContactMessage = proto.Message.IContactMessage;
|
|
14
16
|
export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage;
|
|
@@ -17,6 +19,7 @@ export type WAMessageKey = proto.IMessageKey & {
|
|
|
17
19
|
senderLid?: string;
|
|
18
20
|
participantLid?: string;
|
|
19
21
|
server_id?: string;
|
|
22
|
+
isViewOnce?: boolean;
|
|
20
23
|
};
|
|
21
24
|
export type WATextMessage = proto.Message.IExtendedTextMessage;
|
|
22
25
|
export type WAContextInfo = proto.IContextInfo;
|
package/lib/Utils/chat-utils.js
CHANGED
|
@@ -436,7 +436,9 @@ const chatModificationToAppPatch = (mod, jid) => {
|
|
|
436
436
|
else if ('clear' in mod) {
|
|
437
437
|
patch = {
|
|
438
438
|
syncAction: {
|
|
439
|
-
clearChatAction: {
|
|
439
|
+
clearChatAction: {
|
|
440
|
+
messageRange: getMessageRange(mod.lastMessages)
|
|
441
|
+
}
|
|
440
442
|
},
|
|
441
443
|
index: ['clearChat', jid, '1' /*the option here is 0 when keep starred messages is enabled*/, '0'],
|
|
442
444
|
type: 'regular_high',
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { proto } from '../../WAProto';
|
|
2
1
|
import { ILogger } from './logger';
|
|
3
|
-
import { SignalRepository } from '../Types';
|
|
2
|
+
import { SignalRepository, WAMessage } from '../Types';
|
|
4
3
|
import { BinaryNode } from '../WABinary';
|
|
5
4
|
export declare const NO_MESSAGE_FOUND_ERROR_TEXT = "Message absent from node";
|
|
6
5
|
export declare const MISSING_KEYS_ERROR_TEXT = "Key used already or never filled";
|
|
@@ -24,12 +23,12 @@ export declare const NACK_REASONS: {
|
|
|
24
23
|
* @note this will only parse the message, not decrypt it
|
|
25
24
|
*/
|
|
26
25
|
export declare function decodeMessageNode(stanza: BinaryNode, meId: string, meLid: string): {
|
|
27
|
-
fullMessage:
|
|
26
|
+
fullMessage: WAMessage;
|
|
28
27
|
author: string;
|
|
29
28
|
sender: string;
|
|
30
29
|
};
|
|
31
30
|
export declare const decryptMessageNode: (stanza: BinaryNode, meId: string, meLid: string, repository: SignalRepository, logger: ILogger) => {
|
|
32
|
-
fullMessage:
|
|
31
|
+
fullMessage: WAMessage;
|
|
33
32
|
category: string;
|
|
34
33
|
author: string;
|
|
35
34
|
decrypt(): Promise<void>;
|
|
@@ -130,6 +130,9 @@ const decryptMessageNode = (stanza, meId, meLid, repository, logger) => {
|
|
|
130
130
|
const details = WAProto_1.proto.VerifiedNameCertificate.Details.decode(cert.details);
|
|
131
131
|
fullMessage.verifiedBizName = details.verifiedName;
|
|
132
132
|
}
|
|
133
|
+
if (tag === 'unavailable' && attrs.type === 'view_once') {
|
|
134
|
+
fullMessage.key.isViewOnce = true;
|
|
135
|
+
}
|
|
133
136
|
if (tag !== 'enc' && tag !== 'plaintext') {
|
|
134
137
|
continue;
|
|
135
138
|
}
|
package/lib/Utils/history.js
CHANGED
|
@@ -37,9 +37,9 @@ const processHistoryMessage = (item) => {
|
|
|
37
37
|
contacts.push({ id: chat.id, name: chat.name || undefined, lid: chat.lidJid || undefined, jid: (0, WABinary_1.isJidUser)(chat.id) ? chat.id : chat.pnJid });
|
|
38
38
|
const msgs = chat.messages || [];
|
|
39
39
|
delete chat.messages;
|
|
40
|
-
delete chat.archived
|
|
41
|
-
delete chat.muteEndTime
|
|
42
|
-
delete chat.pinned
|
|
40
|
+
//delete chat.archived
|
|
41
|
+
//delete chat.muteEndTime
|
|
42
|
+
//delete chat.pinned
|
|
43
43
|
for (const item of msgs) {
|
|
44
44
|
const message = item.message;
|
|
45
45
|
messages.push(message);
|
|
@@ -59,9 +59,11 @@ const processHistoryMessage = (item) => {
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
/**
|
|
63
|
+
if(isJidUser(chat.id) && chat.readOnly && chat.archived) {
|
|
64
|
+
delete chat.readOnly
|
|
64
65
|
}
|
|
66
|
+
*/
|
|
65
67
|
chats.push({ ...chat });
|
|
66
68
|
}
|
|
67
69
|
break;
|
package/lib/Utils/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export * from './generics';
|
|
2
2
|
export * from './decode-wa-message';
|
|
3
3
|
export * from './messages';
|
|
4
|
-
export * from './media-messages';
|
|
5
|
-
export * from './media-set';
|
|
6
4
|
export * from './messages-media';
|
|
7
5
|
export * from './validate-connection';
|
|
8
6
|
export * from './crypto';
|
package/lib/Utils/index.js
CHANGED
|
@@ -17,8 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./generics"), exports);
|
|
18
18
|
__exportStar(require("./decode-wa-message"), exports);
|
|
19
19
|
__exportStar(require("./messages"), exports);
|
|
20
|
-
__exportStar(require("./media-messages"), exports);
|
|
21
|
-
__exportStar(require("./media-set"), exports);
|
|
22
20
|
__exportStar(require("./messages-media"), exports);
|
|
23
21
|
__exportStar(require("./validate-connection"), exports);
|
|
24
22
|
__exportStar(require("./crypto"), exports);
|
|
@@ -62,16 +62,7 @@ const crypto_1 = require("./crypto");
|
|
|
62
62
|
const generics_1 = require("./generics");
|
|
63
63
|
const getTmpFilesDirectory = () => (0, os_1.tmpdir)();
|
|
64
64
|
const getImageProcessingLibrary = async () => {
|
|
65
|
-
const [_jimp, sharp] = await Promise.all([
|
|
66
|
-
(async () => {
|
|
67
|
-
const jimp = await (Promise.resolve().then(() => __importStar(require('jimp'))).catch(() => { }));
|
|
68
|
-
return jimp;
|
|
69
|
-
})(),
|
|
70
|
-
(async () => {
|
|
71
|
-
const sharp = await (Promise.resolve().then(() => __importStar(require('sharp'))).catch(() => { }));
|
|
72
|
-
return sharp;
|
|
73
|
-
})()
|
|
74
|
-
]);
|
|
65
|
+
const [_jimp, sharp] = await Promise.all([Promise.resolve().then(() => __importStar(require('jimp'))).catch(() => { }), Promise.resolve().then(() => __importStar(require('sharp'))).catch(() => { })]);
|
|
75
66
|
if (sharp) {
|
|
76
67
|
return { sharp };
|
|
77
68
|
}
|
|
@@ -415,7 +406,12 @@ const getStream = async (item, opts) => {
|
|
|
415
406
|
if ('stream' in item) {
|
|
416
407
|
return { stream: item.stream, type: 'readable' };
|
|
417
408
|
}
|
|
418
|
-
|
|
409
|
+
const urlStr = item.url.toString();
|
|
410
|
+
if (urlStr.startsWith('data:')) {
|
|
411
|
+
const buffer = Buffer.from(urlStr.split(',')[1], 'base64');
|
|
412
|
+
return { stream: (0, exports.toReadable)(buffer), type: 'buffer' };
|
|
413
|
+
}
|
|
414
|
+
if (urlStr.startsWith('http://') || urlStr.startsWith('https://')) {
|
|
419
415
|
return { stream: await (0, exports.getHttpStream)(item.url, opts), type: 'remote' };
|
|
420
416
|
}
|
|
421
417
|
return { stream: (0, fs_1.createReadStream)(item.url), type: 'file' };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@queenanya/baileys",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.8",
|
|
4
4
|
"description": "Custom Baileys WhatsApp API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"baileys",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"cheerio": "^1.0.0 || ^1.0.0_rc.12 || ^1.0.0-rc.10",
|
|
42
42
|
"libphonenumber-js": "^1.10.20",
|
|
43
43
|
"libsignal": "github:nstar-y/libsignal",
|
|
44
|
+
"jimp": "^0.22.12",
|
|
44
45
|
"lodash": "^4.17.21",
|
|
45
46
|
"music-metadata": "^7.12.3",
|
|
46
47
|
"pino": "^9.6",
|
|
@@ -65,7 +66,7 @@
|
|
|
65
66
|
"protobufjs-cli": "^1.1.3",
|
|
66
67
|
"qrcode-terminal": "^0.12.0",
|
|
67
68
|
"release-it": "^17.6.0",
|
|
68
|
-
"sharp": "^0.34.
|
|
69
|
+
"sharp": "^0.34.2",
|
|
69
70
|
"ts-jest": "^29.2.2",
|
|
70
71
|
"ts-node": "^10.9.2",
|
|
71
72
|
"typedoc": "^0.27.9",
|
|
@@ -77,7 +78,7 @@
|
|
|
77
78
|
"jimp": "^0.22.12",
|
|
78
79
|
"link-preview-js": "^3.0.5",
|
|
79
80
|
"qrcode-terminal": "^0.12.0",
|
|
80
|
-
"sharp": "^0.34.
|
|
81
|
+
"sharp": "^0.34.2"
|
|
81
82
|
},
|
|
82
83
|
"peerDependenciesMeta": {
|
|
83
84
|
"audio-decode": {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|