@queenanya/baileys 8.5.0-beta → 8.5.1
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/CHANGELOG.md +1 -1
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Socket/business.d.ts +4 -1
- package/lib/Socket/chats.d.ts +1 -0
- package/lib/Socket/chats.js +11 -2
- package/lib/Socket/communities.d.ts +220 -0
- package/lib/Socket/communities.js +363 -0
- package/lib/Socket/groups.d.ts +1 -0
- package/lib/Socket/index.d.ts +34 -1
- package/lib/Socket/index.js +2 -2
- package/lib/Socket/messages-recv.d.ts +4 -1
- package/lib/Socket/messages-recv.js +26 -7
- package/lib/Socket/messages-send.d.ts +4 -99
- package/lib/Socket/messages-send.js +8 -100
- package/lib/Socket/newsletter.d.ts +1 -0
- package/lib/Types/Chat.d.ts +2 -0
- package/lib/Utils/auth-utils.js +1 -1
- package/lib/Utils/chat-utils.js +11 -0
- package/lib/Utils/history.js +2 -1
- package/lib/WAMedia/media-set.d.ts +4 -0
- package/lib/WAMedia/media-set.js +170 -29
- package/package.json +1 -1
package/lib/Socket/groups.d.ts
CHANGED
|
@@ -69,6 +69,7 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
69
69
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
70
70
|
updateProfileName: (name: string) => Promise<void>;
|
|
71
71
|
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
72
|
+
updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: boolean) => Promise<void>;
|
|
72
73
|
updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
|
|
73
74
|
updateMessagesPrivacy: (value: import("../Types").WAPrivacyMessagesValue) => Promise<void>;
|
|
74
75
|
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
package/lib/Socket/index.d.ts
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
import { UserFacingSocketConfig } from '../Types';
|
|
2
2
|
declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
3
|
+
communityMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
|
|
4
|
+
communityCreate: (subject: string, body: string) => Promise<import("../Types").GroupMetadata | null>;
|
|
5
|
+
communityLeave: (id: string) => Promise<void>;
|
|
6
|
+
communityUpdateSubject: (jid: string, subject: string) => Promise<void>;
|
|
7
|
+
communityRequestParticipantsList: (jid: string) => Promise<{
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
}[]>;
|
|
10
|
+
communityRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
|
|
11
|
+
status: string;
|
|
12
|
+
jid: string;
|
|
13
|
+
}[]>;
|
|
14
|
+
communityParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
|
|
15
|
+
status: string;
|
|
16
|
+
jid: string;
|
|
17
|
+
content: import("..").BinaryNode;
|
|
18
|
+
}[]>;
|
|
19
|
+
communityUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
20
|
+
communityInviteCode: (jid: string) => Promise<string | undefined>;
|
|
21
|
+
communityRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
22
|
+
communityAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
23
|
+
communityRevokeInviteV4: (communityJid: string, invitedJid: string) => Promise<boolean>;
|
|
24
|
+
communityAcceptInviteV4: (key: string | import("../Types").WAMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<any>;
|
|
25
|
+
communityGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
|
|
26
|
+
communityToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
27
|
+
communitySettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
|
|
28
|
+
communityMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
|
|
29
|
+
communityJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
|
|
30
|
+
communityFetchAllParticipating: () => Promise<{
|
|
31
|
+
[_: string]: import("../Types").GroupMetadata;
|
|
32
|
+
}>;
|
|
3
33
|
logger: import("../Utils/logger").ILogger;
|
|
4
34
|
getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
|
|
5
35
|
getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
|
|
@@ -37,11 +67,13 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
|
37
67
|
}>;
|
|
38
68
|
getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("..").JidWithDevice[]>;
|
|
39
69
|
createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: import("..").BinaryNode["attrs"]) => Promise<{
|
|
40
|
-
nodes:
|
|
70
|
+
nodes: any[];
|
|
41
71
|
shouldIncludeDeviceIdentity: boolean;
|
|
42
72
|
}>;
|
|
43
73
|
sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
|
|
44
74
|
updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
|
|
75
|
+
sendStatusMentions: (jid: any, content: any) => Promise<import("../Types").WAProto.WebMessageInfo>;
|
|
76
|
+
sendStatusMentionsV2: (jid: any, content: any) => Promise<import("../Types").WAProto.WebMessageInfo>;
|
|
45
77
|
sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo>;
|
|
46
78
|
subscribeNewsletterUpdates: (jid: string) => Promise<{
|
|
47
79
|
duration: string;
|
|
@@ -117,6 +149,7 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
|
117
149
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
118
150
|
updateProfileName: (name: string) => Promise<void>;
|
|
119
151
|
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
152
|
+
updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: boolean) => Promise<void>;
|
|
120
153
|
updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
|
|
121
154
|
updateMessagesPrivacy: (value: import("../Types").WAPrivacyMessagesValue) => Promise<void>;
|
|
122
155
|
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
package/lib/Socket/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const Defaults_1 = require("../Defaults");
|
|
4
|
-
const
|
|
4
|
+
const communities_1 = require("./communities");
|
|
5
5
|
// export the last socket layer
|
|
6
|
-
const makeWASocket = (config) => ((0,
|
|
6
|
+
const makeWASocket = (config) => ((0, communities_1.makeCommunitiesSocket)({
|
|
7
7
|
...Defaults_1.DEFAULT_CONNECTION_CONFIG,
|
|
8
8
|
...config
|
|
9
9
|
}));
|
|
@@ -27,11 +27,13 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
|
|
|
27
27
|
}>;
|
|
28
28
|
getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../WABinary").JidWithDevice[]>;
|
|
29
29
|
createParticipantNodes: (jids: string[], message: proto.IMessage, extraAttrs?: BinaryNode["attrs"]) => Promise<{
|
|
30
|
-
nodes:
|
|
30
|
+
nodes: any[];
|
|
31
31
|
shouldIncludeDeviceIdentity: boolean;
|
|
32
32
|
}>;
|
|
33
33
|
sendPeerDataOperationMessage: (pdoMessage: proto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
|
|
34
34
|
updateMediaMessage: (message: proto.IWebMessageInfo) => Promise<proto.IWebMessageInfo>;
|
|
35
|
+
sendStatusMentions: (jid: any, content: any) => Promise<proto.WebMessageInfo>;
|
|
36
|
+
sendStatusMentionsV2: (jid: any, content: any) => Promise<proto.WebMessageInfo>;
|
|
35
37
|
sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<proto.WebMessageInfo>;
|
|
36
38
|
subscribeNewsletterUpdates: (jid: string) => Promise<{
|
|
37
39
|
duration: string;
|
|
@@ -107,6 +109,7 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
|
|
|
107
109
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
108
110
|
updateProfileName: (name: string) => Promise<void>;
|
|
109
111
|
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
112
|
+
updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: boolean) => Promise<void>;
|
|
110
113
|
updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
|
|
111
114
|
updateMessagesPrivacy: (value: import("../Types").WAPrivacyMessagesValue) => Promise<void>;
|
|
112
115
|
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
@@ -21,18 +21,18 @@ const makeMessagesRecvSocket = (config) => {
|
|
|
21
21
|
const { ev, authState, ws, processingMutex, signalRepository, query, upsertMessage, resyncAppState, groupMetadata, onUnexpectedError, assertSessions, sendNode, relayMessage, sendReceipt, uploadPreKeys, createParticipantNodes, getUSyncDevices, sendPeerDataOperationMessage, } = sock;
|
|
22
22
|
/** this mutex ensures that each retryRequest will wait for the previous one to finish */
|
|
23
23
|
const retryMutex = (0, make_mutex_1.makeMutex)();
|
|
24
|
-
const msgRetryCache = config.msgRetryCounterCache || new node_cache_1.default({
|
|
24
|
+
const msgRetryCache = (config.msgRetryCounterCache || new node_cache_1.default({
|
|
25
25
|
stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.MSG_RETRY, // 1 hour
|
|
26
26
|
useClones: false
|
|
27
|
-
});
|
|
28
|
-
const callOfferCache = config.callOfferCache || new node_cache_1.default({
|
|
27
|
+
}));
|
|
28
|
+
const callOfferCache = (config.callOfferCache || new node_cache_1.default({
|
|
29
29
|
stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.CALL_OFFER, // 5 mins
|
|
30
30
|
useClones: false
|
|
31
|
-
});
|
|
32
|
-
const placeholderResendCache = config.placeholderResendCache || new node_cache_1.default({
|
|
31
|
+
}));
|
|
32
|
+
const placeholderResendCache = (config.placeholderResendCache || new node_cache_1.default({
|
|
33
33
|
stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.MSG_RETRY, // 1 hour
|
|
34
34
|
useClones: false
|
|
35
|
-
});
|
|
35
|
+
}));
|
|
36
36
|
let sendActiveReceipts = false;
|
|
37
37
|
const sendMessageAck = async ({ tag, attrs, content }, errorCode) => {
|
|
38
38
|
const stanza = {
|
|
@@ -868,11 +868,30 @@ const makeMessagesRecvSocket = (config) => {
|
|
|
868
868
|
return sendPeerDataOperationMessage(pdoMessage);
|
|
869
869
|
};
|
|
870
870
|
const handleCall = async (node) => {
|
|
871
|
+
let status;
|
|
871
872
|
const { attrs } = node;
|
|
872
873
|
const [infoChild] = (0, WABinary_1.getAllBinaryNodeChildren)(node);
|
|
874
|
+
if (!infoChild) {
|
|
875
|
+
throw new boom_1.Boom('Missing call info in call node');
|
|
876
|
+
}
|
|
873
877
|
const callId = infoChild.attrs['call-id'];
|
|
874
878
|
const from = infoChild.attrs.from || infoChild.attrs['call-creator'];
|
|
875
|
-
|
|
879
|
+
status = (0, Utils_1.getCallStatusFromNode)(infoChild);
|
|
880
|
+
if ((0, WABinary_1.isLidUser)(from) && infoChild.tag === 'relaylatency') {
|
|
881
|
+
const verify = callOfferCache.get(callId);
|
|
882
|
+
if (!verify) {
|
|
883
|
+
status = 'offer';
|
|
884
|
+
const callLid = {
|
|
885
|
+
chatId: attrs.from,
|
|
886
|
+
from,
|
|
887
|
+
id: callId,
|
|
888
|
+
date: new Date(+attrs.t * 1000),
|
|
889
|
+
offline: !!attrs.offline,
|
|
890
|
+
status
|
|
891
|
+
};
|
|
892
|
+
callOfferCache.set(callId, callLid);
|
|
893
|
+
}
|
|
894
|
+
}
|
|
876
895
|
const call = {
|
|
877
896
|
chatId: attrs.from,
|
|
878
897
|
from,
|
|
@@ -17,109 +17,13 @@ export declare const makeMessagesSocket: (config: SocketConfig) => {
|
|
|
17
17
|
}>;
|
|
18
18
|
getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<JidWithDevice[]>;
|
|
19
19
|
createParticipantNodes: (jids: string[], message: proto.IMessage, extraAttrs?: BinaryNode["attrs"]) => Promise<{
|
|
20
|
-
nodes:
|
|
20
|
+
nodes: any[];
|
|
21
21
|
shouldIncludeDeviceIdentity: boolean;
|
|
22
22
|
}>;
|
|
23
23
|
sendPeerDataOperationMessage: (pdoMessage: proto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
|
|
24
24
|
updateMediaMessage: (message: proto.IWebMessageInfo) => Promise<proto.IWebMessageInfo>;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const media = await generateWAMessage(STORIES_JID, content, {
|
|
28
|
-
upload: await waUploadToServer,
|
|
29
|
-
backgroundColor: "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0"),
|
|
30
|
-
font: content.text ? Math.floor(Math.random() * 9) : undefined,
|
|
31
|
-
userJid: jid
|
|
32
|
-
})
|
|
33
|
-
const additionalNodes = [{
|
|
34
|
-
tag: 'meta',
|
|
35
|
-
attrs: {},
|
|
36
|
-
content: [{
|
|
37
|
-
tag: 'mentioned_users',
|
|
38
|
-
attrs: {},
|
|
39
|
-
content: [{
|
|
40
|
-
tag: 'to',
|
|
41
|
-
attrs: {
|
|
42
|
-
jid
|
|
43
|
-
},
|
|
44
|
-
content: undefined,
|
|
45
|
-
}],
|
|
46
|
-
}],
|
|
47
|
-
}]
|
|
48
|
-
let Private = isJidUser(jid)
|
|
49
|
-
let statusJid = Private ? [jid] : (await groupMetadata(jid)).participants.map((num) => num.id)
|
|
50
|
-
await relayMessage(STORIES_JID, media.message, {
|
|
51
|
-
messageId: media.key.id,
|
|
52
|
-
statusJidList: statusJid,
|
|
53
|
-
additionalNodes,
|
|
54
|
-
})
|
|
55
|
-
let type = Private ? 'statusMentionMessage' : 'groupStatusMentionMessage'
|
|
56
|
-
let msg = await generateWAMessageFromContent(jid, {
|
|
57
|
-
[type]: {
|
|
58
|
-
message: {
|
|
59
|
-
protocolMessage: {
|
|
60
|
-
key: media.key,
|
|
61
|
-
type: 25,
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
messageContextInfo: {
|
|
66
|
-
messageSecret: randomBytes(32)
|
|
67
|
-
}
|
|
68
|
-
}, { userJid: jid })
|
|
69
|
-
await relayMessage(jid, msg.message, {
|
|
70
|
-
additionalNodes: Private ? [{
|
|
71
|
-
tag: 'meta',
|
|
72
|
-
attrs: {
|
|
73
|
-
is_status_mention: 'true'
|
|
74
|
-
},
|
|
75
|
-
content: undefined,
|
|
76
|
-
}] : undefined
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
return media
|
|
80
|
-
},
|
|
81
|
-
sendStatusMentionsV2: async (jid, content) => {
|
|
82
|
-
const media = await generateWAMessage(STORIES_JID, content, {
|
|
83
|
-
upload: await waUploadToServer,
|
|
84
|
-
backgroundColor: "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0"),
|
|
85
|
-
font: content.text ? Math.floor(Math.random() * 9) : undefined,
|
|
86
|
-
userJid: jid
|
|
87
|
-
})
|
|
88
|
-
const additionalNodes = [{
|
|
89
|
-
tag: 'meta',
|
|
90
|
-
attrs: {},
|
|
91
|
-
content: [{
|
|
92
|
-
tag: 'mentioned_users',
|
|
93
|
-
attrs: {},
|
|
94
|
-
content: [{
|
|
95
|
-
tag: 'to',
|
|
96
|
-
attrs: { jid },
|
|
97
|
-
content: undefined
|
|
98
|
-
}]
|
|
99
|
-
}]
|
|
100
|
-
}]
|
|
101
|
-
let Private = isJidUser(jid)
|
|
102
|
-
let statusJid = Private ? [jid] : (await groupMetadata(jid)).participants.map((num) => num.id)
|
|
103
|
-
await relayMessage(STORIES_JID, media.message, {
|
|
104
|
-
messageId: media.key.id,
|
|
105
|
-
statusJidList: statusJid,
|
|
106
|
-
additionalNodes
|
|
107
|
-
})
|
|
108
|
-
let type = Private ? 'statusMentionMessage' : 'groupStatusMentionMessage'
|
|
109
|
-
let msg = await generateWAMessageFromContent(jid, {
|
|
110
|
-
[type]: {
|
|
111
|
-
message: {
|
|
112
|
-
protocolMessage: {
|
|
113
|
-
key: media.key,
|
|
114
|
-
type: 25
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}, { userJid: jid })
|
|
119
|
-
await relayMessage(jid, msg.message, {})
|
|
120
|
-
return media
|
|
121
|
-
},
|
|
122
|
-
*/
|
|
25
|
+
sendStatusMentions: (jid: any, content: any) => Promise<proto.WebMessageInfo>;
|
|
26
|
+
sendStatusMentionsV2: (jid: any, content: any) => Promise<proto.WebMessageInfo>;
|
|
123
27
|
sendMessage: (jid: string, content: AnyMessageContent, options?: MiscMessageGenerationOptions) => Promise<proto.WebMessageInfo>;
|
|
124
28
|
subscribeNewsletterUpdates: (jid: string) => Promise<{
|
|
125
29
|
duration: string;
|
|
@@ -195,6 +99,7 @@ return media
|
|
|
195
99
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
196
100
|
updateProfileName: (name: string) => Promise<void>;
|
|
197
101
|
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
102
|
+
updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: boolean) => Promise<void>;
|
|
198
103
|
updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
|
|
199
104
|
updateMessagesPrivacy: (value: import("../Types").WAPrivacyMessagesValue) => Promise<void>;
|
|
200
105
|
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
@@ -12,16 +12,17 @@ const Defaults_1 = require("../Defaults");
|
|
|
12
12
|
const Utils_1 = require("../Utils");
|
|
13
13
|
const link_preview_1 = require("../Utils/link-preview");
|
|
14
14
|
const WABinary_1 = require("../WABinary");
|
|
15
|
+
const WAMedia_1 = require("../WAMedia");
|
|
15
16
|
const WAUSync_1 = require("../WAUSync");
|
|
16
17
|
const newsletter_1 = require("./newsletter");
|
|
17
18
|
const makeMessagesSocket = (config) => {
|
|
18
19
|
const { logger, linkPreviewImageThumbnailWidth, generateHighQualityLinkPreview, options: axiosOptions, patchMessageBeforeSending, cachedGroupMetadata, } = config;
|
|
19
20
|
const sock = (0, newsletter_1.makeNewsletterSocket)(config);
|
|
20
21
|
const { ev, authState, processingMutex, signalRepository, upsertMessage, query, fetchPrivacySettings, sendNode, groupMetadata, groupToggleEphemeral, } = sock;
|
|
21
|
-
const userDevicesCache = config.userDevicesCache || new node_cache_1.default({
|
|
22
|
+
const userDevicesCache = (config.userDevicesCache || new node_cache_1.default({
|
|
22
23
|
stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.USER_DEVICES, // 5 minutes
|
|
23
24
|
useClones: false
|
|
24
|
-
});
|
|
25
|
+
}));
|
|
25
26
|
let mediaConn;
|
|
26
27
|
const refreshMediaConn = async (forceGet = false) => {
|
|
27
28
|
const media = await mediaConn;
|
|
@@ -686,105 +687,12 @@ const makeMessagesSocket = (config) => {
|
|
|
686
687
|
]);
|
|
687
688
|
return message;
|
|
688
689
|
},
|
|
689
|
-
// some problem have this code so it's need to fix and maybe in future it's will be fixed but for now commenting the code but you open issue for this features
|
|
690
|
-
/**#
|
|
691
690
|
sendStatusMentions: async (jid, content) => {
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
})
|
|
698
|
-
const additionalNodes = [{
|
|
699
|
-
tag: 'meta',
|
|
700
|
-
attrs: {},
|
|
701
|
-
content: [{
|
|
702
|
-
tag: 'mentioned_users',
|
|
703
|
-
attrs: {},
|
|
704
|
-
content: [{
|
|
705
|
-
tag: 'to',
|
|
706
|
-
attrs: {
|
|
707
|
-
jid
|
|
708
|
-
},
|
|
709
|
-
content: undefined,
|
|
710
|
-
}],
|
|
711
|
-
}],
|
|
712
|
-
}]
|
|
713
|
-
let Private = isJidUser(jid)
|
|
714
|
-
let statusJid = Private ? [jid] : (await groupMetadata(jid)).participants.map((num) => num.id)
|
|
715
|
-
await relayMessage(STORIES_JID, media.message, {
|
|
716
|
-
messageId: media.key.id,
|
|
717
|
-
statusJidList: statusJid,
|
|
718
|
-
additionalNodes,
|
|
719
|
-
})
|
|
720
|
-
let type = Private ? 'statusMentionMessage' : 'groupStatusMentionMessage'
|
|
721
|
-
let msg = await generateWAMessageFromContent(jid, {
|
|
722
|
-
[type]: {
|
|
723
|
-
message: {
|
|
724
|
-
protocolMessage: {
|
|
725
|
-
key: media.key,
|
|
726
|
-
type: 25,
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
},
|
|
730
|
-
messageContextInfo: {
|
|
731
|
-
messageSecret: randomBytes(32)
|
|
732
|
-
}
|
|
733
|
-
}, { userJid: jid })
|
|
734
|
-
await relayMessage(jid, msg.message, {
|
|
735
|
-
additionalNodes: Private ? [{
|
|
736
|
-
tag: 'meta',
|
|
737
|
-
attrs: {
|
|
738
|
-
is_status_mention: 'true'
|
|
739
|
-
},
|
|
740
|
-
content: undefined,
|
|
741
|
-
}] : undefined
|
|
742
|
-
})
|
|
743
|
-
|
|
744
|
-
return media
|
|
745
|
-
},
|
|
746
|
-
sendStatusMentionsV2: async (jid, content) => {
|
|
747
|
-
const media = await generateWAMessage(STORIES_JID, content, {
|
|
748
|
-
upload: await waUploadToServer,
|
|
749
|
-
backgroundColor: "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0"),
|
|
750
|
-
font: content.text ? Math.floor(Math.random() * 9) : undefined,
|
|
751
|
-
userJid: jid
|
|
752
|
-
})
|
|
753
|
-
const additionalNodes = [{
|
|
754
|
-
tag: 'meta',
|
|
755
|
-
attrs: {},
|
|
756
|
-
content: [{
|
|
757
|
-
tag: 'mentioned_users',
|
|
758
|
-
attrs: {},
|
|
759
|
-
content: [{
|
|
760
|
-
tag: 'to',
|
|
761
|
-
attrs: { jid },
|
|
762
|
-
content: undefined
|
|
763
|
-
}]
|
|
764
|
-
}]
|
|
765
|
-
}]
|
|
766
|
-
let Private = isJidUser(jid)
|
|
767
|
-
let statusJid = Private ? [jid] : (await groupMetadata(jid)).participants.map((num) => num.id)
|
|
768
|
-
await relayMessage(STORIES_JID, media.message, {
|
|
769
|
-
messageId: media.key.id,
|
|
770
|
-
statusJidList: statusJid,
|
|
771
|
-
additionalNodes
|
|
772
|
-
})
|
|
773
|
-
let type = Private ? 'statusMentionMessage' : 'groupStatusMentionMessage'
|
|
774
|
-
let msg = await generateWAMessageFromContent(jid, {
|
|
775
|
-
[type]: {
|
|
776
|
-
message: {
|
|
777
|
-
protocolMessage: {
|
|
778
|
-
key: media.key,
|
|
779
|
-
type: 25
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
}, { userJid: jid })
|
|
784
|
-
await relayMessage(jid, msg.message, {})
|
|
785
|
-
return media
|
|
786
|
-
},
|
|
787
|
-
*/
|
|
691
|
+
return await (0, WAMedia_1.sendStatusMentions)(jid, content, sock);
|
|
692
|
+
},
|
|
693
|
+
sendStatusMentionsV2: async (jid, content) => {
|
|
694
|
+
return await (0, WAMedia_1.sendStatusMentionsV2)(jid, content, sock);
|
|
695
|
+
},
|
|
788
696
|
sendMessage: async (jid, content, options = {}) => {
|
|
789
697
|
var _a, _b, _c;
|
|
790
698
|
const userJid = authState.creds.me.id;
|
|
@@ -81,6 +81,7 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
|
|
|
81
81
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
82
82
|
updateProfileName: (name: string) => Promise<void>;
|
|
83
83
|
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
84
|
+
updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: boolean) => Promise<void>;
|
|
84
85
|
updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
|
|
85
86
|
updateMessagesPrivacy: (value: import("../Types").WAPrivacyMessagesValue) => Promise<void>;
|
|
86
87
|
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
package/lib/Types/Chat.d.ts
CHANGED
|
@@ -90,6 +90,8 @@ export type ChatModification = {
|
|
|
90
90
|
lastMessages: LastMessageList;
|
|
91
91
|
} | {
|
|
92
92
|
contact: proto.SyncActionValue.IContactAction | null;
|
|
93
|
+
} | {
|
|
94
|
+
disableLinkPreviews: proto.SyncActionValue.IPrivacySettingDisableLinkPreviewsAction;
|
|
93
95
|
} | {
|
|
94
96
|
addChatLabel: ChatLabelAssociationActionBody;
|
|
95
97
|
} | {
|
package/lib/Utils/auth-utils.js
CHANGED
package/lib/Utils/chat-utils.js
CHANGED
|
@@ -470,6 +470,17 @@ const chatModificationToAppPatch = (mod, jid) => {
|
|
|
470
470
|
operation: mod.contact ? OP.SET : OP.REMOVE
|
|
471
471
|
};
|
|
472
472
|
}
|
|
473
|
+
else if ('disableLinkPreviews' in mod) {
|
|
474
|
+
patch = {
|
|
475
|
+
syncAction: {
|
|
476
|
+
privacySettingDisableLinkPreviewsAction: mod.disableLinkPreviews || {}
|
|
477
|
+
},
|
|
478
|
+
index: ['setting_disableLinkPreviews'],
|
|
479
|
+
type: 'regular',
|
|
480
|
+
apiVersion: 8,
|
|
481
|
+
operation: OP.SET
|
|
482
|
+
};
|
|
483
|
+
}
|
|
473
484
|
else if ('star' in mod) {
|
|
474
485
|
const key = mod.star.messages[0];
|
|
475
486
|
patch = {
|
package/lib/Utils/history.js
CHANGED
|
@@ -18,7 +18,8 @@ const downloadHistory = async (msg, options) => {
|
|
|
18
18
|
}
|
|
19
19
|
let buffer = Buffer.concat(bufferArray);
|
|
20
20
|
// decompress buffer
|
|
21
|
-
|
|
21
|
+
const inflated = await inflatePromise(buffer);
|
|
22
|
+
buffer = Buffer.from(inflated);
|
|
22
23
|
const syncData = WAProto_1.proto.HistorySync.decode(buffer);
|
|
23
24
|
return syncData;
|
|
24
25
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/** update the profile picture for yourself or a group as Full */
|
|
2
2
|
export declare const updateProfilePictureFull: (jid: any, content: any, sock: any) => Promise<void>;
|
|
3
3
|
export declare const updateProfilePictureFull2: (jid: any, content: any, sock: any) => Promise<void>;
|
|
4
|
+
export declare const sendStatusMentionsF: (jid: any, content: any, sock: any) => Promise<import("..").proto.WebMessageInfo>;
|
|
5
|
+
export declare const sendStatusMentionsFV2: (jid: any, content: any, sock: any) => Promise<import("..").proto.WebMessageInfo>;
|
|
4
6
|
export declare const sendStatusMentions: (jid: any, content: any, sock: any) => Promise<import("..").proto.WebMessageInfo>;
|
|
5
7
|
export declare const sendStatusMentionsV2: (jid: any, content: any, sock: any) => Promise<import("..").proto.WebMessageInfo>;
|
|
8
|
+
export declare const sendStatusMentionsH: (jid: any, content: any, sock: any) => Promise<import("..").proto.WebMessageInfo>;
|
|
9
|
+
export declare const sendStatusMentionsHV2: (jid: any, content: any, sock: any) => Promise<import("..").proto.WebMessageInfo>;
|