@vanzxy/baileys 1.2.2 → 1.2.5
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/LICENSE +1 -0
- package/README.md +5 -3
- package/WAProto/index.js +0 -45
- package/lib/Socket/chats.js +37 -1
- package/lib/Utils/history.js +2 -16
- package/lib/Utils/messages.js +254 -25
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -2,6 +2,7 @@ MIT License
|
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2025 Rajeh Taher/WhiskeySockets
|
|
4
4
|
Copyright (c) 2026 Lia Wynn
|
|
5
|
+
Copyright (c) 2026 Vanzxy🍃 / VanzxyPrst🍃
|
|
5
6
|
|
|
6
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
8
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# 🌿 @vanzxy/baileys
|
|
2
2
|
|
|
3
|
-
Enhanced Baileys fork by **Vanzxy** — built on top of `@itsliaaa/baileys` with
|
|
3
|
+
Enhanced Baileys fork by **Vanzxy🍃 (VanzxyPrst🍃)** — built on top of `@itsliaaa/baileys` with extended native flow button support, system-notification filtering, and other fixes for WhatsApp bot development.
|
|
4
4
|
|
|
5
5
|
## ✨ What's Different
|
|
6
6
|
|
|
7
|
-
### 🔧 Fixes
|
|
7
|
+
### 🔧 Fixes & Additions by Vanzxy🍃
|
|
8
8
|
|
|
9
9
|
- **Audio Group Status** — Audio in `groupStatus: true` now uses `groupStatusMessage` (v1) instead of `groupStatusMessageV2`. This fixes the black screen / *"versi WhatsApp tidak mendukung"* error on older WA versions when bots broadcast audio via `swgc`.
|
|
10
10
|
- **No "Lihat Saluran" Button** — Removed `mediaAnnotation` that auto-injected newsletter context into every image/video upload, causing an unwanted *"Lihat saluran"* button to appear on all media messages.
|
|
11
|
+
- **Extended Native Flow Buttons** — Added support for `cta_reminder`, `cta_cancel_reminder`, `address_message`, `send_location`, `catalog_message`, `mpm`, `otp_button`, `authentication_button`, `call_button`, `url_button`, `reply_button`, `card_message`, `order_details`, `order_status`, `review_and_pay`, `payment_status`, `payment_method`, `track_order`, `reorder`, `cancel_order`, `clear_chat`, `navigateToScreen`, `flow_action`, `voice_call`, `video_call_button` — fully additive, existing button types untouched.
|
|
12
|
+
- **System Notification Filtering** — Messages now carry an `isSystemNotification` flag (e.g. for E2E encryption notices, "business uses Meta service" notices) so bots can easily skip them without affecting normal message handling.
|
|
11
13
|
|
|
12
14
|
### ✅ Inherited from `@itsliaaa/baileys`
|
|
13
15
|
- Interactive messages (buttons, list, native flow, carousel)
|
|
@@ -56,4 +58,4 @@ Full credit to original maintainers:
|
|
|
56
58
|
- [purpshell](https://github.com/purpshell), [jlucaso1](https://github.com/jlucaso1), [adiwajshing](https://github.com/adiwajshing) — WhiskeySockets/Baileys
|
|
57
59
|
- [Lia Wynn (itsliaaa)](https://github.com/itsliaaa) — @itsliaaa/baileys
|
|
58
60
|
|
|
59
|
-
Fixes & fork by [
|
|
61
|
+
Fixes & fork by **Vanzxy🍃 (VanzxyPrst🍃)** — [github.com/vanzxy](https://github.com/vanzxy)
|
package/WAProto/index.js
CHANGED
|
@@ -115445,48 +115445,3 @@ export const proto = $root.proto = (() => {
|
|
|
115445
115445
|
})();
|
|
115446
115446
|
|
|
115447
115447
|
export { $root as default };
|
|
115448
|
-
|
|
115449
|
-
|
|
115450
|
-
// === VANZXY ADDED NEW FEATURES ===
|
|
115451
|
-
// Added feature: ShopStorefrontMessage
|
|
115452
|
-
// Added feature: quick_reply
|
|
115453
|
-
// Added feature: single_select
|
|
115454
|
-
// Added feature: cta_url
|
|
115455
|
-
// Added feature: cta_copy
|
|
115456
|
-
// Added feature: cta_call
|
|
115457
|
-
// Added feature: cta_reminder
|
|
115458
|
-
// Added feature: cta_cancel_reminder
|
|
115459
|
-
// Added feature: send_location
|
|
115460
|
-
// Added feature: address_message
|
|
115461
|
-
// Added feature: catalog_message
|
|
115462
|
-
// Added feature: mpm
|
|
115463
|
-
|
|
115464
|
-
// Added extra feature: copy_code
|
|
115465
|
-
// Added extra feature: clear_chat
|
|
115466
|
-
// Added extra feature: navigateToScreen
|
|
115467
|
-
// Added extra feature: card_message
|
|
115468
|
-
// Added extra feature: order_details
|
|
115469
|
-
// Added extra feature: order_status
|
|
115470
|
-
|
|
115471
|
-
|
|
115472
|
-
// === VANZXY ULTIMATE FULL BUTTONS SUPPORT ===
|
|
115473
|
-
// Supported All Button Feature: review_and_pay
|
|
115474
|
-
// Supported All Button Feature: payment_status
|
|
115475
|
-
// Supported All Button Feature: payment_method
|
|
115476
|
-
// Supported All Button Feature: track_order
|
|
115477
|
-
// Supported All Button Feature: reorder
|
|
115478
|
-
// Supported All Button Feature: cancel_order
|
|
115479
|
-
// Supported All Button Feature: otp_button
|
|
115480
|
-
// Supported All Button Feature: authentication_button
|
|
115481
|
-
// Supported All Button Feature: open_url
|
|
115482
|
-
// Supported All Button Feature: call_button
|
|
115483
|
-
// Supported All Button Feature: url_button
|
|
115484
|
-
// Supported All Button Feature: reply_button
|
|
115485
|
-
// Supported All Button Feature: list_reply
|
|
115486
|
-
// Supported All Button Feature: buttons_response
|
|
115487
|
-
// Supported All Button Feature: template_button_reply
|
|
115488
|
-
// Supported All Button Feature: interactive_response
|
|
115489
|
-
|
|
115490
|
-
// Anti-Error Component: buttonsReplyMessage
|
|
115491
|
-
// Anti-Error Component: hydratedTemplateButton
|
|
115492
|
-
// Anti-Error Component: externalAdReplyInfo
|
package/lib/Socket/chats.js
CHANGED
|
@@ -2,7 +2,7 @@ import NodeCache from '@cacheable/node-cache';
|
|
|
2
2
|
import { Boom } from '@hapi/boom';
|
|
3
3
|
import { proto } from '../../WAProto/index.js';
|
|
4
4
|
import { DEFAULT_CACHE_TTLS, HISTORY_SYNC_PAUSED_TIMEOUT_MS, PROCESSABLE_HISTORY_TYPES } from '../Defaults/index.js';
|
|
5
|
-
import { ALL_WA_PATCH_NAMES } from '../Types/index.js';
|
|
5
|
+
import { ALL_WA_PATCH_NAMES, WAMessageStubType } from '../Types/index.js';
|
|
6
6
|
import { SyncState } from '../Types/State.js';
|
|
7
7
|
import { chatModificationToAppPatch, decodePatches, decodeSyncdSnapshot, encodeSyncdPatch, ensureLTHashStateVersion, extractSyncdPatches, generateProfilePicture, getHistoryMsg, isAppStateSyncIrrecoverable, isMissingKeyError, MAX_SYNC_ATTEMPTS, newLTHashState, processSyncAction } from '../Utils/index.js';
|
|
8
8
|
import { makeMutex } from '../Utils/make-mutex.js';
|
|
@@ -929,7 +929,43 @@ export const makeChatsSocket = (config) => {
|
|
|
929
929
|
const executeInitQueries = async () => {
|
|
930
930
|
await Promise.all([fetchProps(), fetchBlocklist(), fetchPrivacySettings()]);
|
|
931
931
|
};
|
|
932
|
+
// Vanzxy@Changes --- Detect WhatsApp system/security notification messages
|
|
933
|
+
// (e.g. "Messages are end-to-end encrypted", "This business now uses a secure
|
|
934
|
+
// service from Meta") so consumers can filter them out without affecting any
|
|
935
|
+
// existing message types or behavior. This ONLY adds a flag, nothing is dropped.
|
|
936
|
+
const isWASystemNotification = (msg) => {
|
|
937
|
+
const content = msg?.message;
|
|
938
|
+
if (!content)
|
|
939
|
+
return false;
|
|
940
|
+
// E2E / business-encryption notices arrive as protocolMessage with these types
|
|
941
|
+
const protoType = content.protocolMessage?.type;
|
|
942
|
+
if (protoType === proto.Message.ProtocolMessage.Type.HISTORY_SYNC_NOTIFICATION ||
|
|
943
|
+
protoType === proto.Message.ProtocolMessage.Type.APP_STATE_SYNC_KEY_SHARE ||
|
|
944
|
+
protoType === proto.Message.ProtocolMessage.Type.PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE ||
|
|
945
|
+
protoType === proto.Message.ProtocolMessage.Type.LID_MIGRATION_MAPPING_SYNC) {
|
|
946
|
+
return true;
|
|
947
|
+
}
|
|
948
|
+
// Generic stub-type system notices (no real content, just a stub event)
|
|
949
|
+
if (msg.messageStubType && !content.conversation && !content.extendedTextMessage) {
|
|
950
|
+
const stub = msg.messageStubType;
|
|
951
|
+
const SYSTEM_STUB_TYPES = new Set([
|
|
952
|
+
WAMessageStubType.E2E_DEVICE_CHANGED,
|
|
953
|
+
WAMessageStubType.E2E_ENCRYPTED,
|
|
954
|
+
WAMessageStubType.E2E_IDENTITY_CHANGED,
|
|
955
|
+
WAMessageStubType.CIPHERTEXT,
|
|
956
|
+
WAMessageStubType.BIZ_PRIVACY_MODE_TO_BSP,
|
|
957
|
+
WAMessageStubType.BIZ_PRIVACY_MODE_TO_FB
|
|
958
|
+
]);
|
|
959
|
+
if (SYSTEM_STUB_TYPES.has(stub))
|
|
960
|
+
return true;
|
|
961
|
+
}
|
|
962
|
+
return false;
|
|
963
|
+
};
|
|
932
964
|
const upsertMessage = ev.createBufferedFunction(async (msg, type) => {
|
|
965
|
+
// Vanzxy@Changes --- Annotate msg with isSystemNotification flag (additive only)
|
|
966
|
+
if (isWASystemNotification(msg)) {
|
|
967
|
+
msg.isSystemNotification = true;
|
|
968
|
+
}
|
|
933
969
|
ev.emit('messages.upsert', { messages: [msg], type });
|
|
934
970
|
if (!!msg.pushName) {
|
|
935
971
|
let jid = msg.key.fromMe ? authState.creds.me.id : msg.key.participant || msg.key.remoteJid;
|
package/lib/Utils/history.js
CHANGED
|
@@ -23,9 +23,7 @@ const extractPnFromMessages = (messages) => {
|
|
|
23
23
|
}
|
|
24
24
|
return undefined;
|
|
25
25
|
};
|
|
26
|
-
export const
|
|
27
|
-
// Meredam duplikasi gelembung chat enkripsi sistem
|
|
28
|
-
downloadHistory = async (msg, options) => {
|
|
26
|
+
export const downloadHistory = async (msg, options) => {
|
|
29
27
|
const stream = await downloadContentFromMessage(msg, 'md-msg-hist', { options });
|
|
30
28
|
// Pipe decrypted stream directly through zlib inflate
|
|
31
29
|
// This avoids allocating an intermediate buffer for the compressed data
|
|
@@ -133,16 +131,4 @@ export const getHistoryMsg = (message) => {
|
|
|
133
131
|
const anyHistoryMsg = normalizedContent?.protocolMessage?.historySyncNotification;
|
|
134
132
|
return anyHistoryMsg;
|
|
135
133
|
};
|
|
136
|
-
//# sourceMappingURL=history.js.map
|
|
137
|
-
// === VANZXY ANTI SPAM SYSTEM NOTIFICATION ===
|
|
138
|
-
if (typeof global !== 'undefined' && !global.vanzxyPatched) {
|
|
139
|
-
global.vanzxyPatched = true;
|
|
140
|
-
// Mengamankan pemrosesan stubType sistem agar tidak spam gelembung kuning/hijau
|
|
141
|
-
const originalLog = console.log;
|
|
142
|
-
console.log = function(...args) {
|
|
143
|
-
if (args[0] && typeof args[0] === 'string' && (args[0].includes('stubType') || args[0].includes('identity key'))) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
originalLog.apply(console, args);
|
|
147
|
-
};
|
|
148
|
-
}
|
|
134
|
+
//# sourceMappingURL=history.js.map
|
package/lib/Utils/messages.js
CHANGED
|
@@ -492,43 +492,274 @@ const prepareNativeFlowButtons = (message) => {
|
|
|
492
492
|
if (hasOptionalProperty(button, 'id') && !!button.id) {
|
|
493
493
|
return {
|
|
494
494
|
name: 'quick_reply',
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
495
|
+
buttonParamsJson: JSON.stringify({
|
|
496
|
+
display_text: buttonText || '👉🏻 Click',
|
|
497
|
+
id: button.id,
|
|
498
|
+
icon: buttonIcon
|
|
499
|
+
})
|
|
498
500
|
};
|
|
499
|
-
}
|
|
501
|
+
}
|
|
502
|
+
else if (hasOptionalProperty(button, 'copy') && !!button.copy) {
|
|
500
503
|
return {
|
|
501
504
|
name: 'cta_copy',
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
+
buttonParamsJson: JSON.stringify({
|
|
506
|
+
display_text: buttonText || '📋 Copy',
|
|
507
|
+
copy_code: button.copy,
|
|
508
|
+
icon: buttonIcon
|
|
509
|
+
})
|
|
505
510
|
};
|
|
506
511
|
}
|
|
507
512
|
else if (hasOptionalProperty(button, 'url') && !!button.url) {
|
|
508
513
|
return {
|
|
509
514
|
name: 'cta_url',
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
+
buttonParamsJson: JSON.stringify({
|
|
516
|
+
display_text: buttonText || '🌐 Visit',
|
|
517
|
+
url: button.url,
|
|
518
|
+
merchant_url: button.url,
|
|
519
|
+
webview_interaction: button.useWebview,
|
|
520
|
+
icon: buttonIcon
|
|
521
|
+
})
|
|
515
522
|
};
|
|
516
523
|
}
|
|
517
524
|
else if (hasOptionalProperty(button, 'call') && !!button.call) {
|
|
518
525
|
return {
|
|
519
526
|
name: 'cta_call',
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
527
|
+
buttonParamsJson: JSON.stringify({
|
|
528
|
+
display_text: buttonText || '📞 Call',
|
|
529
|
+
phone_number: button.call,
|
|
530
|
+
icon: buttonIcon
|
|
531
|
+
})
|
|
523
532
|
};
|
|
524
533
|
}
|
|
525
|
-
// Lia@Changes 12-03-26 --- Add "single_select" shortcut
|
|
534
|
+
// Lia@Changes 12-03-26 --- Add "single_select" shortcut \(°o°)/
|
|
526
535
|
else if (hasOptionalProperty(button, 'sections') && !!button.sections) {
|
|
527
536
|
return {
|
|
528
537
|
name: 'single_select',
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
538
|
+
buttonParamsJson: JSON.stringify({
|
|
539
|
+
title: buttonText || '📋 Select',
|
|
540
|
+
sections: button.sections,
|
|
541
|
+
icon: buttonIcon
|
|
542
|
+
})
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
// Vanzxy@Changes --- Add "cta_reminder" shortcut
|
|
546
|
+
else if (hasOptionalProperty(button, 'reminder') && !!button.reminder) {
|
|
547
|
+
return {
|
|
548
|
+
name: 'cta_reminder',
|
|
549
|
+
buttonParamsJson: JSON.stringify({
|
|
550
|
+
display_text: buttonText || '⏰ Remind me',
|
|
551
|
+
id: button.id || button.reminder,
|
|
552
|
+
icon: buttonIcon
|
|
553
|
+
})
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
// Vanzxy@Changes --- Add "cta_cancel_reminder" shortcut
|
|
557
|
+
else if (hasOptionalProperty(button, 'cancelReminder') && !!button.cancelReminder) {
|
|
558
|
+
return {
|
|
559
|
+
name: 'cta_cancel_reminder',
|
|
560
|
+
buttonParamsJson: JSON.stringify({
|
|
561
|
+
display_text: buttonText || '🔕 Cancel reminder',
|
|
562
|
+
id: button.id || button.cancelReminder,
|
|
563
|
+
icon: buttonIcon
|
|
564
|
+
})
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
// Vanzxy@Changes --- Add "address_message" / send_location shortcut
|
|
568
|
+
else if (hasOptionalProperty(button, 'address') && !!button.address) {
|
|
569
|
+
return {
|
|
570
|
+
name: 'address_message',
|
|
571
|
+
buttonParamsJson: JSON.stringify({
|
|
572
|
+
display_text: buttonText || '📍 Send address',
|
|
573
|
+
id: button.id || 'address_message'
|
|
574
|
+
})
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
else if (hasOptionalProperty(button, 'location') && button.location === true) {
|
|
578
|
+
return {
|
|
579
|
+
name: 'send_location',
|
|
580
|
+
buttonParamsJson: JSON.stringify({})
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
// Vanzxy@Changes --- Add "view_catalog" / catalog_message / mpm shortcut
|
|
584
|
+
else if (hasOptionalProperty(button, 'catalog') && !!button.catalog) {
|
|
585
|
+
return {
|
|
586
|
+
name: 'catalog_message',
|
|
587
|
+
buttonParamsJson: JSON.stringify({
|
|
588
|
+
business_phone_number: button.catalog.bizJid || button.catalog,
|
|
589
|
+
display_text: buttonText || '🛍️ View catalog',
|
|
590
|
+
id: button.id || 'catalog_message'
|
|
591
|
+
})
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
else if (hasOptionalProperty(button, 'products') && !!button.products) {
|
|
595
|
+
return {
|
|
596
|
+
name: 'mpm',
|
|
597
|
+
buttonParamsJson: JSON.stringify({
|
|
598
|
+
business_phone_number: button.bizJid || button.products.bizJid,
|
|
599
|
+
product_ids: Array.isArray(button.products) ? button.products : button.products.ids
|
|
600
|
+
})
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
// Vanzxy@Changes --- Add OTP / authentication button shortcuts
|
|
604
|
+
else if (hasOptionalProperty(button, 'otp') && !!button.otp) {
|
|
605
|
+
return {
|
|
606
|
+
name: 'otp_button',
|
|
607
|
+
buttonParamsJson: JSON.stringify({
|
|
608
|
+
display_text: buttonText || 'Copy code',
|
|
609
|
+
code: button.otp
|
|
610
|
+
})
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
else if (hasOptionalProperty(button, 'oneTapOtp') && !!button.oneTapOtp) {
|
|
614
|
+
return {
|
|
615
|
+
name: 'authentication_button',
|
|
616
|
+
buttonParamsJson: JSON.stringify({
|
|
617
|
+
display_text: buttonText || 'Autofill',
|
|
618
|
+
code: button.oneTapOtp
|
|
619
|
+
})
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
// Vanzxy@Changes --- Add classic template-style button shortcuts
|
|
623
|
+
else if (hasOptionalProperty(button, 'phoneNumber') && !!button.phoneNumber) {
|
|
624
|
+
return {
|
|
625
|
+
name: 'call_button',
|
|
626
|
+
buttonParamsJson: JSON.stringify({
|
|
627
|
+
display_text: buttonText || '📞 Call',
|
|
628
|
+
phone_number: button.phoneNumber
|
|
629
|
+
})
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
else if (hasOptionalProperty(button, 'urlBtn') && !!button.urlBtn) {
|
|
633
|
+
return {
|
|
634
|
+
name: 'url_button',
|
|
635
|
+
buttonParamsJson: JSON.stringify({
|
|
636
|
+
display_text: buttonText || '🌐 Open',
|
|
637
|
+
url: button.urlBtn
|
|
638
|
+
})
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
else if (hasOptionalProperty(button, 'reply') && !!button.reply) {
|
|
642
|
+
return {
|
|
643
|
+
name: 'reply_button',
|
|
644
|
+
buttonParamsJson: JSON.stringify({
|
|
645
|
+
display_text: buttonText || button.reply,
|
|
646
|
+
id: button.id || button.reply
|
|
647
|
+
})
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
// Vanzxy@Changes --- Add order/payment lifecycle button shortcuts
|
|
651
|
+
else if (hasOptionalProperty(button, 'card') && !!button.card) {
|
|
652
|
+
return {
|
|
653
|
+
name: 'card_message',
|
|
654
|
+
buttonParamsJson: JSON.stringify(button.card)
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
else if (hasOptionalProperty(button, 'orderDetails') && !!button.orderDetails) {
|
|
658
|
+
return {
|
|
659
|
+
name: 'order_details',
|
|
660
|
+
buttonParamsJson: JSON.stringify(button.orderDetails)
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
else if (hasOptionalProperty(button, 'orderStatus') && !!button.orderStatus) {
|
|
664
|
+
return {
|
|
665
|
+
name: 'order_status',
|
|
666
|
+
buttonParamsJson: JSON.stringify(button.orderStatus)
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
else if (hasOptionalProperty(button, 'reviewAndPay') && !!button.reviewAndPay) {
|
|
670
|
+
return {
|
|
671
|
+
name: 'review_and_pay',
|
|
672
|
+
buttonParamsJson: JSON.stringify(button.reviewAndPay)
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
else if (hasOptionalProperty(button, 'paymentStatus') && !!button.paymentStatus) {
|
|
676
|
+
return {
|
|
677
|
+
name: 'payment_status',
|
|
678
|
+
buttonParamsJson: JSON.stringify(button.paymentStatus)
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
else if (hasOptionalProperty(button, 'paymentMethod') && !!button.paymentMethod) {
|
|
682
|
+
return {
|
|
683
|
+
name: 'payment_method',
|
|
684
|
+
buttonParamsJson: JSON.stringify(button.paymentMethod)
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
else if (hasOptionalProperty(button, 'trackOrder') && !!button.trackOrder) {
|
|
688
|
+
return {
|
|
689
|
+
name: 'track_order',
|
|
690
|
+
buttonParamsJson: JSON.stringify({
|
|
691
|
+
id: button.id || button.trackOrder,
|
|
692
|
+
display_text: buttonText || '🚚 Track order'
|
|
693
|
+
})
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
else if (hasOptionalProperty(button, 'reorder') && !!button.reorder) {
|
|
697
|
+
return {
|
|
698
|
+
name: 'reorder',
|
|
699
|
+
buttonParamsJson: JSON.stringify({
|
|
700
|
+
id: button.id || button.reorder,
|
|
701
|
+
display_text: buttonText || '🔁 Reorder'
|
|
702
|
+
})
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
else if (hasOptionalProperty(button, 'cancelOrder') && !!button.cancelOrder) {
|
|
706
|
+
return {
|
|
707
|
+
name: 'cancel_order',
|
|
708
|
+
buttonParamsJson: JSON.stringify({
|
|
709
|
+
id: button.id || button.cancelOrder,
|
|
710
|
+
display_text: buttonText || '❌ Cancel order'
|
|
711
|
+
})
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
// Vanzxy@Changes --- Add navigation / utility button shortcuts
|
|
715
|
+
else if (hasOptionalProperty(button, 'clearChat') && button.clearChat === true) {
|
|
716
|
+
return {
|
|
717
|
+
name: 'clear_chat',
|
|
718
|
+
buttonParamsJson: JSON.stringify({})
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
else if (hasOptionalProperty(button, 'screen') && !!button.screen) {
|
|
722
|
+
return {
|
|
723
|
+
name: 'navigateToScreen',
|
|
724
|
+
buttonParamsJson: JSON.stringify({
|
|
725
|
+
screen_name: button.screen,
|
|
726
|
+
data: button.data || {}
|
|
727
|
+
})
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
// Vanzxy@Changes --- Add "flow_action" shortcut (WhatsApp Flows form)
|
|
731
|
+
else if (hasOptionalProperty(button, 'flow') && !!button.flow) {
|
|
732
|
+
return {
|
|
733
|
+
name: 'flow_action',
|
|
734
|
+
buttonParamsJson: JSON.stringify({
|
|
735
|
+
flow_message_version: button.flow.version || '3',
|
|
736
|
+
flow_id: button.flow.id,
|
|
737
|
+
flow_cta: buttonText || button.flow.cta || 'Continue',
|
|
738
|
+
flow_action: button.flow.action || 'navigate',
|
|
739
|
+
flow_action_payload: button.flow.actionPayload || {
|
|
740
|
+
screen: button.flow.screen || 'WELCOME',
|
|
741
|
+
data: button.flow.data || {}
|
|
742
|
+
}
|
|
743
|
+
})
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
// Vanzxy@Changes --- Add "voice_call" / "video_call_button" shortcuts
|
|
747
|
+
else if (hasOptionalProperty(button, 'voiceCall') && !!button.voiceCall) {
|
|
748
|
+
return {
|
|
749
|
+
name: 'voice_call',
|
|
750
|
+
buttonParamsJson: JSON.stringify({
|
|
751
|
+
display_text: buttonText || '📞 Voice call',
|
|
752
|
+
id: button.id || button.voiceCall
|
|
753
|
+
})
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
else if (hasOptionalProperty(button, 'videoCall') && !!button.videoCall) {
|
|
757
|
+
return {
|
|
758
|
+
name: 'video_call_button',
|
|
759
|
+
buttonParamsJson: JSON.stringify({
|
|
760
|
+
display_text: buttonText || '🎥 Video call',
|
|
761
|
+
id: button.id || button.videoCall
|
|
762
|
+
})
|
|
532
763
|
};
|
|
533
764
|
}
|
|
534
765
|
return button;
|
|
@@ -1124,6 +1355,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1124
1355
|
interactiveMessage.header = {
|
|
1125
1356
|
title: message.title || '',
|
|
1126
1357
|
subtitle: message.subtitle || '',
|
|
1358
|
+
hasMediaAttachment: isValidHeader
|
|
1127
1359
|
};
|
|
1128
1360
|
interactiveMessage.body = { text: message.caption };
|
|
1129
1361
|
}
|
|
@@ -1138,6 +1370,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1138
1370
|
}, options);
|
|
1139
1371
|
interactiveMessage.footer = {
|
|
1140
1372
|
audioMessage,
|
|
1373
|
+
hasMediaAttachment: true
|
|
1141
1374
|
};
|
|
1142
1375
|
}
|
|
1143
1376
|
else if (hasOptionalProperty(message, 'footer')) {
|
|
@@ -1171,6 +1404,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1171
1404
|
carouselCard.header = {
|
|
1172
1405
|
title: card.title || '',
|
|
1173
1406
|
subtitle: card.subtitle || '',
|
|
1407
|
+
hasMediaAttachment: isValidHeader
|
|
1174
1408
|
};
|
|
1175
1409
|
carouselCard.body = { text: card.caption };
|
|
1176
1410
|
}
|
|
@@ -1185,6 +1419,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1185
1419
|
}, options);
|
|
1186
1420
|
carouselCard.footer = {
|
|
1187
1421
|
audioMessage,
|
|
1422
|
+
hasMediaAttachment: true
|
|
1188
1423
|
};
|
|
1189
1424
|
}
|
|
1190
1425
|
else if (hasOptionalProperty(card, 'footer')) {
|
|
@@ -1407,12 +1642,6 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1407
1642
|
}
|
|
1408
1643
|
return WAProto.Message.create(m);
|
|
1409
1644
|
};
|
|
1410
|
-
const processImageMessage = (message, captionText) => {
|
|
1411
|
-
if (message.imageMessage) {
|
|
1412
|
-
message.imageMessage.caption = captionText;
|
|
1413
|
-
}
|
|
1414
|
-
return message;
|
|
1415
|
-
};
|
|
1416
1645
|
export const generateWAMessageFromContent = (jid, message, options) => {
|
|
1417
1646
|
// set timestamp to now
|
|
1418
1647
|
// if not specified
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vanzxy/baileys",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Enhanced Baileys fork by Vanzxy — based on @itsliaaa/baileys + @whiskeysockets/baileys with fixes for audio group status and clean media without newsletter button.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@adiwajshing/keyed-db": "^0.2.4",
|
|
40
40
|
"@cacheable/node-cache": "^1.4.0",
|
|
41
41
|
"@hapi/boom": "^9.1.3",
|
|
42
|
-
"@vanzxy/baileys": "^1.1.
|
|
42
|
+
"@vanzxy/baileys": "^1.1.2",
|
|
43
43
|
"async-mutex": "^0.5.0",
|
|
44
44
|
"fflate": "^0.8.2",
|
|
45
45
|
"libsignal": "^6.0.0",
|