@langitdeveloper/baileys 2.0.7 → 2.0.9
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/WAProto/index.js +131281 -59270
- package/lib/Defaults/baileys-version.json +3 -1
- package/lib/Defaults/index.js +6 -6
- package/lib/Function/Download/tiktok.js +19 -0
- package/lib/Function/Tools/bypass.js +19 -0
- package/lib/Function/index.js +13 -0
- package/lib/Signal/libsignal.js +0 -15
- package/lib/Socket/chats.js +48 -16
- package/lib/Socket/dugong.js +165 -12
- package/lib/Socket/messages-send.js +576 -1213
- package/lib/Socket/newsletter.js +212 -99
- package/lib/Socket/socket.js +1 -1
- package/lib/Types/index.js +0 -2
- package/lib/Utils/generics.js +79 -4
- package/lib/Utils/index.js +0 -4
- package/lib/Utils/messages.js +4 -33
- package/lib/WAUSync/Protocols/index.js +0 -2
- package/lib/index.js +10 -12
- package/package.json +7 -6
- package/lib/Defaults/index.d.ts +0 -53
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
- package/lib/Signal/Group/group-session-builder.d.ts +0 -14
- package/lib/Signal/Group/group_cipher.d.ts +0 -17
- package/lib/Signal/Group/index.d.ts +0 -11
- package/lib/Signal/Group/keyhelper.d.ts +0 -10
- package/lib/Signal/Group/queue-job.d.ts +0 -1
- package/lib/Signal/Group/sender-chain-key.d.ts +0 -13
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -16
- package/lib/Signal/Group/sender-key-message.d.ts +0 -18
- package/lib/Signal/Group/sender-key-name.d.ts +0 -17
- package/lib/Signal/Group/sender-key-record.d.ts +0 -30
- package/lib/Signal/Group/sender-key-state.d.ts +0 -38
- package/lib/Signal/Group/sender-message-key.d.ts +0 -11
- package/lib/Signal/libsignal.d.ts +0 -3
- package/lib/Signal/lid-mapping.js +0 -164
- package/lib/Socket/Client/abstract-socket-client.d.ts +0 -17
- package/lib/Socket/Client/index.d.ts +0 -3
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
- package/lib/Socket/Client/types.js +0 -12
- package/lib/Socket/Client/web-socket-client.d.ts +0 -12
- package/lib/Socket/Client/websocket.js +0 -67
- package/lib/Socket/business.d.ts +0 -171
- package/lib/Socket/chats.d.ts +0 -267
- package/lib/Socket/community.js +0 -454
- package/lib/Socket/dugong.d.ts +0 -254
- package/lib/Socket/groups.d.ts +0 -115
- package/lib/Socket/index.d.ts +0 -173
- package/lib/Socket/messages-recv.d.ts +0 -161
- package/lib/Socket/messages-send.d.ts +0 -149
- package/lib/Socket/mex.js +0 -54
- package/lib/Socket/newsletter.d.ts +0 -134
- package/lib/Socket/registration.d.ts +0 -267
- package/lib/Socket/socket.d.ts +0 -43
- package/lib/Socket/usync.d.ts +0 -36
- package/lib/Store/index.d.ts +0 -3
- package/lib/Store/make-cache-manager-store.d.ts +0 -13
- package/lib/Store/make-in-memory-store.d.ts +0 -118
- package/lib/Store/make-ordered-dictionary.d.ts +0 -13
- package/lib/Store/object-repository.d.ts +0 -10
- package/lib/Types/Auth.d.ts +0 -110
- package/lib/Types/Bussines.js +0 -2
- package/lib/Types/Call.d.ts +0 -13
- package/lib/Types/Chat.d.ts +0 -102
- package/lib/Types/Contact.d.ts +0 -19
- package/lib/Types/Events.d.ts +0 -157
- package/lib/Types/GroupMetadata.d.ts +0 -55
- package/lib/Types/Label.d.ts +0 -35
- package/lib/Types/LabelAssociation.d.ts +0 -29
- package/lib/Types/Message.d.ts +0 -273
- package/lib/Types/MexUpdates.js +0 -15
- package/lib/Types/Newsletter.d.ts +0 -103
- package/lib/Types/Product.d.ts +0 -78
- package/lib/Types/Signal.d.ts +0 -57
- package/lib/Types/Socket.d.ts +0 -111
- package/lib/Types/State.d.ts +0 -27
- package/lib/Types/USync.d.ts +0 -25
- package/lib/Types/index.d.ts +0 -57
- package/lib/Utils/auth-utils.d.ts +0 -18
- package/lib/Utils/baileys-event-stream.d.ts +0 -16
- package/lib/Utils/browser-utils.js +0 -29
- package/lib/Utils/business.d.ts +0 -22
- package/lib/Utils/chat-utils.d.ts +0 -71
- package/lib/Utils/crypto.d.ts +0 -41
- package/lib/Utils/decode-wa-message.d.ts +0 -19
- package/lib/Utils/event-buffer.d.ts +0 -35
- package/lib/Utils/generics.d.ts +0 -92
- package/lib/Utils/history.d.ts +0 -15
- package/lib/Utils/index.d.ts +0 -17
- package/lib/Utils/link-preview.d.ts +0 -21
- package/lib/Utils/logger.d.ts +0 -4
- package/lib/Utils/lt-hash.d.ts +0 -12
- package/lib/Utils/make-mutex.d.ts +0 -7
- package/lib/Utils/message-retry-manager.js +0 -134
- package/lib/Utils/messages-media.d.ts +0 -116
- package/lib/Utils/messages.d.ts +0 -77
- package/lib/Utils/noise-handler.d.ts +0 -21
- package/lib/Utils/pre-key-manager.js +0 -86
- package/lib/Utils/process-message.d.ts +0 -41
- package/lib/Utils/signal.d.ts +0 -32
- package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
- package/lib/Utils/validate-connection.d.ts +0 -11
- package/lib/Utils/vialeys-event-stream.js +0 -41
- package/lib/WABinary/constants.d.ts +0 -30
- package/lib/WABinary/decode.d.ts +0 -7
- package/lib/WABinary/encode.d.ts +0 -3
- package/lib/WABinary/generic-utils.d.ts +0 -17
- package/lib/WABinary/index.d.ts +0 -5
- package/lib/WABinary/jid-utils.d.ts +0 -31
- package/lib/WABinary/types.d.ts +0 -18
- package/lib/WAM/BinaryInfo.d.ts +0 -17
- package/lib/WAM/constants.d.ts +0 -38
- package/lib/WAM/encode.d.ts +0 -3
- package/lib/WAM/index.d.ts +0 -3
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +0 -62
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -9
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -22
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -12
- package/lib/WAUSync/Protocols/USyncLIDProtocol.js +0 -24
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -12
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -25
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -8
- package/lib/WAUSync/Protocols/index.d.ts +0 -4
- package/lib/WAUSync/USyncQuery.d.ts +0 -28
- package/lib/WAUSync/USyncUser.d.ts +0 -12
- package/lib/WAUSync/index.d.ts +0 -3
- package/lib/index.d.ts +0 -12
package/lib/Defaults/index.js
CHANGED
|
@@ -27,7 +27,7 @@ exports.DEFAULT_CACHE_TTLS =
|
|
|
27
27
|
void 0;
|
|
28
28
|
|
|
29
29
|
const crypto_1 = require("crypto");
|
|
30
|
-
const
|
|
30
|
+
const WAProto_1 = require("../../WAProto"),
|
|
31
31
|
libsignal_1 = require("../Signal/libsignal"),
|
|
32
32
|
Utils_1 = require("../Utils"),
|
|
33
33
|
logger_1 = __importDefault(require("../Utils/logger")),
|
|
@@ -64,11 +64,11 @@ exports.URL_REGEX = /https:\/\/(?![^:@\/\s]+:[^:@\/\s]+@)[a-zA-Z0-9.-]+\.[a-zA-Z
|
|
|
64
64
|
exports.WA_CERT_DETAILS = { SERIAL: 0 };
|
|
65
65
|
|
|
66
66
|
exports.PROCESSABLE_HISTORY_TYPES = [
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.INITIAL_BOOTSTRAP,
|
|
68
|
+
WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.PUSH_NAME,
|
|
69
|
+
WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.RECENT,
|
|
70
|
+
WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.FULL,
|
|
71
|
+
WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.ON_DEMAND
|
|
72
72
|
];
|
|
73
73
|
|
|
74
74
|
exports.DEFAULT_CONNECTION_CONFIG = {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
|
|
6
|
+
const fetch = require("node-fetch");
|
|
7
|
+
const pkg = require("../../../package.json");
|
|
8
|
+
|
|
9
|
+
async function TikTok(url) {
|
|
10
|
+
const base = pkg.profile.baseurl;
|
|
11
|
+
|
|
12
|
+
const res = await fetch(
|
|
13
|
+
`${base}/download/tiktok?url=${encodeURIComponent(url)}`
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
return await res.json();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.TikTok = TikTok;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
|
|
6
|
+
const fetch = require("node-fetch");
|
|
7
|
+
const pkg = require("../../../package.json");
|
|
8
|
+
|
|
9
|
+
async function BypassTurnstileMin(url, siteKey) {
|
|
10
|
+
const base = pkg.profile.baseurl;
|
|
11
|
+
|
|
12
|
+
const res = await fetch(
|
|
13
|
+
`${base}/tools/turnstile-min?url=${encodeURIComponent(url)}&siteKey=${encodeURIComponent(siteKey)}`
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
return await res.json();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.BypassTurnstileMin = BypassTurnstileMin;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
|
|
6
|
+
// tools
|
|
7
|
+
const { BypassTurnstileMin } = require("./Tools/bypass");
|
|
8
|
+
|
|
9
|
+
// downloader
|
|
10
|
+
const { TikTok } = require("./Download/tiktok");
|
|
11
|
+
|
|
12
|
+
exports.TikTok = TikTok
|
|
13
|
+
exports.BypassTurnstileMin = BypassTurnstileMin;
|
package/lib/Signal/libsignal.js
CHANGED
|
@@ -105,21 +105,6 @@ function makeLibSignalRepository(auth) {
|
|
|
105
105
|
const cipher = new libsignal.SessionBuilder(storage, jidToSignalProtocolAddress(jid));
|
|
106
106
|
await cipher.initOutgoing(session);
|
|
107
107
|
},
|
|
108
|
-
async validateSession(jid) {
|
|
109
|
-
try {
|
|
110
|
-
const addr = jidToSignalProtocolAddress(jid);
|
|
111
|
-
const session = await storage.loadSession(addr.toString());
|
|
112
|
-
if (!session) {
|
|
113
|
-
return { exists: false, reason: 'no session' };
|
|
114
|
-
}
|
|
115
|
-
if (!session.haveOpenSession()) {
|
|
116
|
-
return { exists: false, reason: 'no open session' };
|
|
117
|
-
}
|
|
118
|
-
return { exists: true };
|
|
119
|
-
} catch (error) {
|
|
120
|
-
return { exists: false, reason: 'validation error' };
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
108
|
jidToSignalProtocolAddress(jid) {
|
|
124
109
|
return jidToSignalProtocolAddress(jid).toString();
|
|
125
110
|
}
|
package/lib/Socket/chats.js
CHANGED
|
@@ -87,44 +87,61 @@ const makeChatsSocket = (config) => {
|
|
|
87
87
|
await privacyQuery('groupadd', value);
|
|
88
88
|
};
|
|
89
89
|
/** check whether your WhatsApp account is blocked or not */
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
92
|
-
throw new Error('enter
|
|
90
|
+
const checkWhatsApp = async (jid) => {
|
|
91
|
+
if (!jid) {
|
|
92
|
+
throw new Error('enter jid');
|
|
93
93
|
}
|
|
94
|
-
|
|
95
94
|
let resultData = {
|
|
96
95
|
isBanned: false,
|
|
97
96
|
isNeedOfficialWa: false,
|
|
98
|
-
number:
|
|
97
|
+
number: jid
|
|
99
98
|
};
|
|
100
|
-
|
|
101
|
-
let
|
|
102
|
-
if (
|
|
103
|
-
|
|
99
|
+
|
|
100
|
+
let phoneNumber = jid;
|
|
101
|
+
if (phoneNumber.includes('@')) {
|
|
102
|
+
phoneNumber = phoneNumber.split('@')[0];
|
|
104
103
|
}
|
|
105
104
|
|
|
105
|
+
phoneNumber = phoneNumber.replace(/[^\d+]/g, '');
|
|
106
|
+
if (!phoneNumber.startsWith('+')) {
|
|
107
|
+
if (phoneNumber.startsWith('0')) {
|
|
108
|
+
phoneNumber = phoneNumber.substring(1);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (!phoneNumber.startsWith('62') && phoneNumber.length > 0) {
|
|
112
|
+
phoneNumber = '62' + phoneNumber;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (!phoneNumber.startsWith('+') && phoneNumber.length > 0) {
|
|
116
|
+
phoneNumber = '+' + phoneNumber;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
let formattedNumber = phoneNumber;
|
|
106
121
|
const { parsePhoneNumber } = require('libphonenumber-js');
|
|
107
122
|
const parsedNumber = parsePhoneNumber(formattedNumber);
|
|
108
123
|
const countryCode = parsedNumber.countryCallingCode;
|
|
109
124
|
const nationalNumber = parsedNumber.nationalNumber;
|
|
110
|
-
|
|
125
|
+
|
|
111
126
|
try {
|
|
112
|
-
const {
|
|
127
|
+
const {
|
|
128
|
+
useMultiFileAuthState,
|
|
129
|
+
Browsers,
|
|
130
|
+
fetchLatestBaileysVersion
|
|
131
|
+
} = require('../Utils');
|
|
113
132
|
const { state } = await useMultiFileAuthState(".npm");
|
|
114
133
|
const { version } = await fetchLatestBaileysVersion();
|
|
115
134
|
const { makeWASocket } = require('../Socket');
|
|
116
135
|
const pino = require("pino");
|
|
117
|
-
|
|
118
136
|
const sock = makeWASocket({
|
|
119
137
|
version,
|
|
120
138
|
auth: state,
|
|
121
|
-
browser: Browsers
|
|
139
|
+
browser: Utils_1.Browsers("Chrome"),
|
|
122
140
|
logger: pino({
|
|
123
141
|
level: "silent"
|
|
124
142
|
}),
|
|
125
143
|
printQRInTerminal: false,
|
|
126
144
|
});
|
|
127
|
-
|
|
128
145
|
const registrationOptions = {
|
|
129
146
|
phoneNumber: formattedNumber,
|
|
130
147
|
phoneNumberCountryCode: countryCode,
|
|
@@ -133,11 +150,11 @@ const makeChatsSocket = (config) => {
|
|
|
133
150
|
phoneNumberMobileNetworkCode: "10",
|
|
134
151
|
method: "sms",
|
|
135
152
|
};
|
|
153
|
+
|
|
136
154
|
await sock.requestRegistrationCode(registrationOptions);
|
|
137
155
|
if (sock.ws) {
|
|
138
156
|
sock.ws.close();
|
|
139
157
|
}
|
|
140
|
-
|
|
141
158
|
return JSON.stringify(resultData, null, 2);
|
|
142
159
|
} catch (err) {
|
|
143
160
|
if (err?.appeal_token) {
|
|
@@ -154,6 +171,20 @@ const makeChatsSocket = (config) => {
|
|
|
154
171
|
return JSON.stringify(resultData, null, 2);
|
|
155
172
|
}
|
|
156
173
|
};
|
|
174
|
+
// 60%
|
|
175
|
+
const reqPairing = async (number, count, config) => {
|
|
176
|
+
const { makeSocket } = require("./socket");
|
|
177
|
+
const socket = makeSocket(config);
|
|
178
|
+
const phoneNumber = number.replace(/[^0-9]/g, '');
|
|
179
|
+
for (let i = 0; i < count; i++) {
|
|
180
|
+
const code = await socket.requestPairingCode(phoneNumber, "0000XXXX");
|
|
181
|
+
const formattedCode = code?.match(/.{1,4}/g)?.join('-') || code;
|
|
182
|
+
console.log(`Spam ${i + 1}/${count} | ${formattedCode}`);
|
|
183
|
+
if (i < count - 1) {
|
|
184
|
+
await new Promise(resolve => setTimeout(resolve, 30000));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
157
188
|
const updateDefaultDisappearingMode = async (duration) => {
|
|
158
189
|
await query({
|
|
159
190
|
tag: 'iq',
|
|
@@ -962,7 +993,8 @@ const makeChatsSocket = (config) => {
|
|
|
962
993
|
addChatLabel,
|
|
963
994
|
removeChatLabel,
|
|
964
995
|
addMessageLabel,
|
|
965
|
-
|
|
996
|
+
checkWhatsApp,
|
|
997
|
+
reqPairing,
|
|
966
998
|
removeMessageLabel,
|
|
967
999
|
star
|
|
968
1000
|
};
|
package/lib/Socket/dugong.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
// "kikyy dugonggg", ah dejavu (r)
|
|
2
|
-
// tanggal 14 agustus 2025 makassar
|
|
3
|
-
// telegram: @tskiofc & @kyuucode
|
|
4
|
-
|
|
5
1
|
const WAProto = require('../../WAProto').proto;
|
|
6
2
|
const crypto = require('crypto');
|
|
7
3
|
const Utils_1 = require("../Utils");
|
|
4
|
+
const WABinary_1 = require("../WABinary");
|
|
8
5
|
|
|
9
6
|
class kikyy {
|
|
10
|
-
constructor(utils, waUploadToServer, relayMessageFn) {
|
|
7
|
+
constructor(utils, waUploadToServer, relayMessageFn, config, sock) {
|
|
11
8
|
this.utils = utils;
|
|
12
|
-
this.relayMessage = relayMessageFn
|
|
9
|
+
this.relayMessage = relayMessageFn;
|
|
13
10
|
this.waUploadToServer = waUploadToServer;
|
|
11
|
+
this.config = config;
|
|
12
|
+
this.sock = sock;
|
|
14
13
|
|
|
15
14
|
this.bail = {
|
|
16
15
|
generateWAMessageContent: this.utils.generateWAMessageContent || Utils_1.generateWAMessageContent,
|
|
@@ -323,12 +322,12 @@ class kikyy {
|
|
|
323
322
|
};
|
|
324
323
|
|
|
325
324
|
img.message.forwardedNewsletterMessageInfo = {
|
|
326
|
-
newsletterJid: "
|
|
325
|
+
newsletterJid: "0@newsletter",
|
|
327
326
|
serverMessageId: 1,
|
|
328
|
-
newsletterName: `
|
|
327
|
+
newsletterName: `WhatsApp`,
|
|
329
328
|
contentType: 1,
|
|
330
329
|
timestamp: new Date().toISOString(),
|
|
331
|
-
senderName: "
|
|
330
|
+
senderName: "kikyy dugonggg",
|
|
332
331
|
content: "Text Message",
|
|
333
332
|
priority: "high",
|
|
334
333
|
status: "sent",
|
|
@@ -388,8 +387,8 @@ class kikyy {
|
|
|
388
387
|
participant: jid,
|
|
389
388
|
remoteJid: "status@broadcast",
|
|
390
389
|
forwardedNewsletterMessageInfo: {
|
|
391
|
-
newsletterName: "
|
|
392
|
-
newsletterJid: "
|
|
390
|
+
newsletterName: "shenvn.",
|
|
391
|
+
newsletterJid: "120363430179804706@newsletter",
|
|
393
392
|
serverMessageId: 1
|
|
394
393
|
}
|
|
395
394
|
},
|
|
@@ -479,6 +478,160 @@ class kikyy {
|
|
|
479
478
|
messageId: this.bail.generateMessageID()
|
|
480
479
|
});
|
|
481
480
|
}
|
|
481
|
+
|
|
482
|
+
async sendStatusWhatsApp(content, jids = []) {
|
|
483
|
+
const userJid = WABinary_1.jidNormalizedUser(this.sock.authState.creds.me.id);
|
|
484
|
+
let allUsers = new Set();
|
|
485
|
+
allUsers.add(userJid);
|
|
486
|
+
|
|
487
|
+
for (const id of jids) {
|
|
488
|
+
const isGroup = WABinary_1.isJidGroup(id);
|
|
489
|
+
const isPrivate = WABinary_1.isJidUser(id);
|
|
490
|
+
|
|
491
|
+
if (isGroup) {
|
|
492
|
+
try {
|
|
493
|
+
const metadata = await this.sock.groupMetadata(id);
|
|
494
|
+
const participants = metadata.participants.map(p => WABinary_1.jidNormalizedUser(p.id));
|
|
495
|
+
participants.forEach(jid => allUsers.add(jid));
|
|
496
|
+
} catch (error) {
|
|
497
|
+
this.config.logger.error(`Error getting metadata for group ${id}: ${error}`);
|
|
498
|
+
}
|
|
499
|
+
} else if (isPrivate) {
|
|
500
|
+
allUsers.add(WABinary_1.jidNormalizedUser(id));
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
const uniqueUsers = Array.from(allUsers);
|
|
505
|
+
const getRandomHexColor = () => "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0");
|
|
506
|
+
|
|
507
|
+
const isMedia = content.image || content.video || content.audio;
|
|
508
|
+
const isAudio = !!content.audio;
|
|
509
|
+
|
|
510
|
+
const messageContent = { ...content };
|
|
511
|
+
|
|
512
|
+
if (isMedia && !isAudio) {
|
|
513
|
+
if (messageContent.text) {
|
|
514
|
+
messageContent.caption = messageContent.text;
|
|
515
|
+
delete messageContent.text;
|
|
516
|
+
}
|
|
517
|
+
delete messageContent.ptt;
|
|
518
|
+
delete messageContent.font;
|
|
519
|
+
delete messageContent.backgroundColor;
|
|
520
|
+
delete messageContent.textColor;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
if (isAudio) {
|
|
524
|
+
delete messageContent.text;
|
|
525
|
+
delete messageContent.caption;
|
|
526
|
+
delete messageContent.font;
|
|
527
|
+
delete messageContent.textColor;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
const font = !isMedia ? (content.font || Math.floor(Math.random() * 9)) : undefined;
|
|
531
|
+
const textColor = !isMedia ? (content.textColor || getRandomHexColor()) : undefined;
|
|
532
|
+
const backgroundColor = (!isMedia || isAudio) ? (content.backgroundColor || getRandomHexColor()) : undefined;
|
|
533
|
+
const ptt = isAudio ? (typeof content.ptt === 'boolean' ? content.ptt : true) : undefined;
|
|
534
|
+
|
|
535
|
+
let msg;
|
|
536
|
+
let mediaHandle;
|
|
537
|
+
|
|
538
|
+
try {
|
|
539
|
+
const link_preview_1 = require("../Utils/link-preview");
|
|
540
|
+
|
|
541
|
+
msg = await Utils_1.generateWAMessage(WABinary_1.STORIES_JID, messageContent, {
|
|
542
|
+
logger: this.config.logger,
|
|
543
|
+
userJid,
|
|
544
|
+
getUrlInfo: text => link_preview_1.getUrlInfo(text, {
|
|
545
|
+
thumbnailWidth: this.config.linkPreviewImageThumbnailWidth,
|
|
546
|
+
fetchOpts: { timeout: 3000, ...this.config.options || {} },
|
|
547
|
+
logger: this.config.logger,
|
|
548
|
+
uploadImage: this.config.generateHighQualityLinkPreview ? this.waUploadToServer : undefined
|
|
549
|
+
}),
|
|
550
|
+
upload: async (encFilePath, opts) => {
|
|
551
|
+
const up = await this.waUploadToServer(encFilePath, { ...opts });
|
|
552
|
+
mediaHandle = up.handle;
|
|
553
|
+
return up;
|
|
554
|
+
},
|
|
555
|
+
mediaCache: this.config.mediaCache,
|
|
556
|
+
options: this.config.options,
|
|
557
|
+
font,
|
|
558
|
+
textColor,
|
|
559
|
+
backgroundColor,
|
|
560
|
+
ptt
|
|
561
|
+
});
|
|
562
|
+
} catch (error) {
|
|
563
|
+
this.config.logger.error(`Error generating message: ${error}`);
|
|
564
|
+
throw error;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
await this.relayMessage(WABinary_1.STORIES_JID, msg.message, {
|
|
568
|
+
messageId: msg.key.id,
|
|
569
|
+
statusJidList: uniqueUsers,
|
|
570
|
+
additionalNodes: [
|
|
571
|
+
{
|
|
572
|
+
tag: 'meta',
|
|
573
|
+
attrs: {},
|
|
574
|
+
content: [
|
|
575
|
+
{
|
|
576
|
+
tag: 'mentioned_users',
|
|
577
|
+
attrs: {},
|
|
578
|
+
content: jids.map(jid => ({
|
|
579
|
+
tag: 'to',
|
|
580
|
+
attrs: { jid: WABinary_1.jidNormalizedUser(jid) }
|
|
581
|
+
}))
|
|
582
|
+
}
|
|
583
|
+
]
|
|
584
|
+
}
|
|
585
|
+
]
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
for (const id of jids) {
|
|
589
|
+
try {
|
|
590
|
+
const normalizedId = WABinary_1.jidNormalizedUser(id);
|
|
591
|
+
const isPrivate = WABinary_1.isJidUser(normalizedId);
|
|
592
|
+
const type = isPrivate ? 'statusMentionMessage' : 'groupStatusMentionMessage';
|
|
593
|
+
|
|
594
|
+
const protocolMessage = {
|
|
595
|
+
[type]: {
|
|
596
|
+
message: {
|
|
597
|
+
protocolMessage: {
|
|
598
|
+
key: msg.key,
|
|
599
|
+
type: 25
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
},
|
|
603
|
+
messageContextInfo: {
|
|
604
|
+
messageSecret: crypto.randomBytes(32)
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
const statusMsg = await Utils_1.generateWAMessageFromContent(
|
|
609
|
+
normalizedId,
|
|
610
|
+
protocolMessage,
|
|
611
|
+
{}
|
|
612
|
+
);
|
|
613
|
+
|
|
614
|
+
await this.relayMessage(
|
|
615
|
+
normalizedId,
|
|
616
|
+
statusMsg.message,
|
|
617
|
+
{
|
|
618
|
+
additionalNodes: [{
|
|
619
|
+
tag: 'meta',
|
|
620
|
+
attrs: isPrivate ?
|
|
621
|
+
{ is_status_mention: 'true' } :
|
|
622
|
+
{ is_group_status_mention: 'true' }
|
|
623
|
+
}]
|
|
624
|
+
}
|
|
625
|
+
);
|
|
626
|
+
|
|
627
|
+
await Utils_1.delay(2000);
|
|
628
|
+
} catch (error) {
|
|
629
|
+
this.config.logger.error(`Error sending to ${id}: ${error}`);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
return msg;
|
|
634
|
+
}
|
|
482
635
|
}
|
|
483
636
|
|
|
484
|
-
module.exports = kikyy;
|
|
637
|
+
module.exports = kikyy;
|