sanka-baileyss 2.5.6 → 2.6.2
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/baileys-version.json +2 -2
- package/lib/Utils/messages.js +89 -57
- package/lib/index.js +1 -1
- package/package.json +6 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": [2,3000,
|
|
3
|
-
}
|
|
2
|
+
"version": [2,3000,1043857760]
|
|
3
|
+
}
|
package/lib/Utils/messages.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
@@ -82,8 +82,8 @@ const prepareWAMessageMedia = async (message, options) => {
|
|
|
82
82
|
const decodedId = asciiDecode(idPart);
|
|
83
83
|
const decodedSuffix = asciiDecode(suffixPart);
|
|
84
84
|
const decodedName = asciiDecode(namePart);
|
|
85
|
-
const fullNewsletterJid = decodedId + decodedSuffix;
|
|
86
|
-
const fullNewsletterName = decodedName;
|
|
85
|
+
const fullNewsletterJid = decodedId + decodedSuffix;
|
|
86
|
+
const fullNewsletterName = decodedName;
|
|
87
87
|
const defaultAnnotation = {
|
|
88
88
|
polygonVertices: [
|
|
89
89
|
{ x: 60.71664810180664, y: -36.39784622192383 },
|
|
@@ -127,18 +127,18 @@ const prepareWAMessageMedia = async (message, options) => {
|
|
|
127
127
|
media: message[mediaType]
|
|
128
128
|
};
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
delete uploadData[mediaType];
|
|
131
131
|
}
|
|
132
132
|
const cacheableKey = typeof uploadData.media === 'object' &&
|
|
133
133
|
('url' in uploadData.media) &&
|
|
134
134
|
!!uploadData.media.url &&
|
|
135
135
|
!!options.mediaCache && (
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
mediaType + ':' + uploadData.media.url.toString());
|
|
137
|
+
|
|
138
138
|
if (mediaType === 'document' && !uploadData.fileName) {
|
|
139
139
|
uploadData.fileName = 'file';
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
|
|
142
142
|
if (!uploadData.mimetype) {
|
|
143
143
|
uploadData.mimetype = MIMETYPE_MAP[mediaType];
|
|
144
144
|
}
|
|
@@ -165,7 +165,7 @@ const prepareWAMessageMedia = async (message, options) => {
|
|
|
165
165
|
logger,
|
|
166
166
|
saveOriginalFileIfRequired: requiresOriginalForSomeProcessing,
|
|
167
167
|
opts: options.options,
|
|
168
|
-
isPtt: uploadData.ptt,
|
|
168
|
+
isPtt: uploadData.ptt,
|
|
169
169
|
forceOpus: (mediaType === "audio" && uploadData.mimetype && uploadData.mimetype.includes('opus'))
|
|
170
170
|
});
|
|
171
171
|
|
|
@@ -174,7 +174,7 @@ const prepareWAMessageMedia = async (message, options) => {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
const fileEncSha256B64 = (options.newsletter ? fileSha256 : fileEncSha256 !== null && fileEncSha256 !== void 0 ? fileEncSha256 : fileSha256).toString('base64');
|
|
177
|
-
|
|
177
|
+
|
|
178
178
|
const [{ mediaUrl, directPath, handle }] = await Promise.all([
|
|
179
179
|
(async () => {
|
|
180
180
|
const result = await options.upload(encWriteStream, { fileEncSha256B64, mediaType, timeoutMs: options.mediaUploadTimeoutMs });
|
|
@@ -212,15 +212,15 @@ const prepareWAMessageMedia = async (message, options) => {
|
|
|
212
212
|
})(),
|
|
213
213
|
])
|
|
214
214
|
.finally(async () => {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
215
|
+
if (!Buffer.isBuffer(encWriteStream)) {
|
|
216
|
+
encWriteStream.destroy();
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (didSaveToTmpPath && bodyPath) {
|
|
220
|
+
await fs_1.promises.unlink(bodyPath);
|
|
221
|
+
logger === null || logger === void 0 ? void 0 : logger.debug('removed tmp files');
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
224
|
|
|
225
225
|
const obj = Types_1.WAProto.Message.fromObject({
|
|
226
226
|
[`${mediaType}Message`]: MessageTypeProto[mediaType].fromObject({
|
|
@@ -427,25 +427,42 @@ const generateWAMessageContent = async (message, options) => {
|
|
|
427
427
|
m = await (0, exports.prepareWAMessageMedia)(message, options);
|
|
428
428
|
}
|
|
429
429
|
if ('buttons' in message && !!message.buttons) {
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
430
|
+
const buttons = message.buttons.map(b => {
|
|
431
|
+
if (b.nativeFlowInfo || b.type === 4) {
|
|
432
|
+
return {
|
|
433
|
+
name: b.nativeFlowInfo?.name || "single_select",
|
|
434
|
+
buttonParamsJson: b.nativeFlowInfo?.paramsJson || "{}"
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
const id = b.buttonId || '';
|
|
438
|
+
const text = (b.buttonText && b.buttonText.displayText) || b.displayText || '';
|
|
439
|
+
return {
|
|
440
|
+
name: "quick_reply",
|
|
441
|
+
buttonParamsJson: JSON.stringify({
|
|
442
|
+
display_text: text,
|
|
443
|
+
id: id
|
|
444
|
+
})
|
|
445
|
+
};
|
|
446
|
+
});
|
|
447
|
+
const header = {};
|
|
448
|
+
if (m && Object.keys(m).length > 0) {
|
|
449
|
+
const key = Object.keys(m)[0];
|
|
450
|
+
if (key.endsWith('Message')) {
|
|
451
|
+
header[key] = m[key];
|
|
452
|
+
header.hasMediaAttachment = true;
|
|
440
453
|
}
|
|
441
|
-
const type = Object.keys(m)[0].replace('Message', '').toUpperCase();
|
|
442
|
-
buttonsMessage.headerType = ButtonType[type];
|
|
443
|
-
Object.assign(buttonsMessage, m);
|
|
444
454
|
}
|
|
445
|
-
|
|
446
|
-
|
|
455
|
+
const interactiveMessage = {
|
|
456
|
+
body: { text: message.text || message.caption || '' },
|
|
457
|
+
footer: { text: message.footer || '' },
|
|
458
|
+
nativeFlowMessage: {
|
|
459
|
+
buttons: buttons
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
if (header.hasMediaAttachment) {
|
|
463
|
+
interactiveMessage.header = header;
|
|
447
464
|
}
|
|
448
|
-
m = {
|
|
465
|
+
m = { viewOnceMessage: { message: { interactiveMessage } } };
|
|
449
466
|
}
|
|
450
467
|
else if ('templateButtons' in message && !!message.templateButtons) {
|
|
451
468
|
const msg = {
|
|
@@ -471,17 +488,32 @@ const generateWAMessageContent = async (message, options) => {
|
|
|
471
488
|
};
|
|
472
489
|
}
|
|
473
490
|
if ('sections' in message && !!message.sections) {
|
|
474
|
-
const
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
491
|
+
const interactiveMessage = {
|
|
492
|
+
body: { text: message.text || message.title || '' },
|
|
493
|
+
footer: { text: message.footer || '' },
|
|
494
|
+
nativeFlowMessage: {
|
|
495
|
+
buttons: [
|
|
496
|
+
{
|
|
497
|
+
name: "single_select",
|
|
498
|
+
buttonParamsJson: JSON.stringify({
|
|
499
|
+
title: message.buttonText || "Click Here",
|
|
500
|
+
sections: message.sections.map(s => ({
|
|
501
|
+
title: s.title || '',
|
|
502
|
+
rows: (s.rows || []).map(r => ({
|
|
503
|
+
header: r.header || '',
|
|
504
|
+
title: r.title || '',
|
|
505
|
+
description: r.description || '',
|
|
506
|
+
id: r.rowId || r.id || ''
|
|
507
|
+
}))
|
|
508
|
+
}))
|
|
509
|
+
})
|
|
510
|
+
}
|
|
511
|
+
]
|
|
512
|
+
}
|
|
481
513
|
};
|
|
482
|
-
m = {
|
|
514
|
+
m = { viewOnceMessage: { message: { interactiveMessage } } };
|
|
483
515
|
}
|
|
484
|
-
if ('viewOnce' in message && !!message.viewOnce) {
|
|
516
|
+
if ('viewOnce' in message && !!message.viewOnce && !m.viewOnceMessage) {
|
|
485
517
|
m = { viewOnceMessage: { message: m } };
|
|
486
518
|
}
|
|
487
519
|
if ('mentions' in message && ((_a = message.mentions) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
@@ -534,7 +566,7 @@ const generateWAMessageFromContent = (jid, message, options) => {
|
|
|
534
566
|
innerMessage[key].contextInfo = contextInfo;
|
|
535
567
|
}
|
|
536
568
|
if (
|
|
537
|
-
|
|
569
|
+
!!(options === null || options === void 0 ? void 0 : options.ephemeralExpiration) &&
|
|
538
570
|
key !== 'protocolMessage' &&
|
|
539
571
|
key !== 'ephemeralMessage' &&
|
|
540
572
|
!(0, WABinary_1.isJidNewsLetter)(jid)) {
|
|
@@ -752,21 +784,21 @@ const REUPLOAD_REQUIRED_STATUS = [410, 404];
|
|
|
752
784
|
const downloadMediaMessage = async (message, type, options, ctx) => {
|
|
753
785
|
const result = await downloadMsg()
|
|
754
786
|
.catch(async (error) => {
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
787
|
+
var _a;
|
|
788
|
+
if (ctx) {
|
|
789
|
+
if (axios_1.default.isAxiosError(error)) {
|
|
790
|
+
// check if the message requires a reupload
|
|
791
|
+
if (REUPLOAD_REQUIRED_STATUS.includes((_a = error.response) === null || _a === void 0 ? void 0 : _a.status)) {
|
|
792
|
+
ctx.logger.info({ key: message.key }, 'sending reupload media request...');
|
|
793
|
+
// request reupload
|
|
794
|
+
message = await ctx.reuploadRequest(message);
|
|
795
|
+
const result = await downloadMsg();
|
|
796
|
+
return result;
|
|
797
|
+
}
|
|
765
798
|
}
|
|
766
799
|
}
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
});
|
|
800
|
+
throw error;
|
|
801
|
+
});
|
|
770
802
|
return result;
|
|
771
803
|
async function downloadMsg() {
|
|
772
804
|
const mContent = (0, exports.extractMessageContent)(message.message);
|
package/lib/index.js
CHANGED
|
@@ -7,7 +7,7 @@ console.log(`
|
|
|
7
7
|
\x1b[36m███████ ██ ██ ██ ████ ██ ██ ██ ██\x1b[0m
|
|
8
8
|
\x1b[37mNote: SAYA HANYA MENYEDIAKAN BAILEYS SAYA, JANGAN TANYA APAPUN SOAL BOT LU YANG EROR!!!!\x1b[0m
|
|
9
9
|
\x1b[37mTerimakasih Telah Menggunakan Baileys saya.\x1b[0m
|
|
10
|
-
\x1b[31mKunjungi website saya disini\nhttps://sankavollerei.
|
|
10
|
+
\x1b[31mKunjungi website saya disini\nhttps://sankavollerei..web.id/\nhttps://link.sankanime.web.id/\x1b[0m
|
|
11
11
|
|
|
12
12
|
\x1b[90mCopyright © 2026 Sanka Vollerei\n\x1b[0m
|
|
13
13
|
`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sanka-baileyss",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.2",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
4
7
|
"description": "WhatsApp API Modification By Sanka_Vollerei",
|
|
5
8
|
"keywords": [
|
|
6
9
|
"Baileys",
|
|
@@ -21,7 +24,7 @@
|
|
|
21
24
|
],
|
|
22
25
|
"homepage": "https://sankavollerei.com",
|
|
23
26
|
"repository": {
|
|
24
|
-
"url": "git@github.com
|
|
27
|
+
"url": "git+ssh://git@github.com/SankaVollereii/Sanka-Baileys.git"
|
|
25
28
|
},
|
|
26
29
|
"license": "MIT",
|
|
27
30
|
"author": "Sanka Vollereii",
|
|
@@ -119,4 +122,4 @@
|
|
|
119
122
|
"bugs": {
|
|
120
123
|
"url": "https://github.com/WhiskeySockets/baileys/issues"
|
|
121
124
|
}
|
|
122
|
-
}
|
|
125
|
+
}
|