@nuiisweety/baileys 0.1.18 → 0.1.20
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/README.md +1 -1
- package/README.md.bak +327 -191
- package/lib/Utils/messages-media.js +17 -2
- package/lib/Utils/messages-media.js.bak +786 -0
- package/lib/Utils/messages.js +3 -2
- package/lib/Utils/rich-message-utils.js +11 -2
- package/package.json +1 -1
package/lib/Utils/messages.js
CHANGED
|
@@ -523,7 +523,7 @@ const prepareNativeFlowButtons = (message) => {
|
|
|
523
523
|
Object.assign(messageParamsJson, {
|
|
524
524
|
limited_time_offer: {
|
|
525
525
|
text: message.offerText || LIBRARY_NAME,
|
|
526
|
-
url: message.offerUrl
|
|
526
|
+
url: (message.offerUrl && /^https?:\/\//i.test(message.offerUrl)) ? message.offerUrl : DONATE_URL,
|
|
527
527
|
copy_code: message.offerCode,
|
|
528
528
|
expiration_time: message.offerExpiration
|
|
529
529
|
}
|
|
@@ -1239,7 +1239,8 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1239
1239
|
if ('thumbnail' in content && !Buffer.isBuffer(content.thumbnail)) {
|
|
1240
1240
|
throw new Boom('Thumbnail must in buffer type', { statusCode: 400 });
|
|
1241
1241
|
}
|
|
1242
|
-
if (!content.url || typeof content.url !== 'string') {
|
|
1242
|
+
if (!content.url || typeof content.url !== 'string' || !/^https?:\/\//i.test(content.url)) {
|
|
1243
|
+
options.logger?.warn({ givenUrl: content.url }, 'externalAdReply: field "url" kosong/tidak valid (harus diawali http:// atau https://) — fallback ke DONATE_URL, link produk asli TIDAK terkirim. Cek kode yang mengisi `url` di externalAdReply.');
|
|
1243
1244
|
content.url = DONATE_URL;
|
|
1244
1245
|
}
|
|
1245
1246
|
const externalAdReply = {
|
|
@@ -667,7 +667,13 @@ const makeProductSection = (data) => {
|
|
|
667
667
|
brand: item.brand ?? '',
|
|
668
668
|
price: item.price ?? '',
|
|
669
669
|
sale_price: item.sale_price ?? item.salePrice ?? '',
|
|
670
|
-
product_url:
|
|
670
|
+
product_url: (() => {
|
|
671
|
+
const u = item.product_url ?? item.url ?? '';
|
|
672
|
+
if (!u || !/^https?:\/\//i.test(u)) {
|
|
673
|
+
console.warn('[baileys] richProduct: product_url/url kosong atau tidak diawali http(s):// — tautan produk ini kemungkinan besar tidak akan bisa dibuka di WhatsApp. Nilai yang diterima:', u || '(kosong)');
|
|
674
|
+
}
|
|
675
|
+
return u;
|
|
676
|
+
})(),
|
|
671
677
|
image: { url: item.image_url ?? item.image ?? '' },
|
|
672
678
|
additional_images: [{ url: item.icon_url ?? item.icon ?? '' }],
|
|
673
679
|
__typename: 'GenAIProductItemCardPrimitive'
|
|
@@ -850,7 +856,10 @@ export const prepareRichResponseMessage = (content) => {
|
|
|
850
856
|
if (links && Array.isArray(links)) {
|
|
851
857
|
links.forEach((linkField, index) => {
|
|
852
858
|
const prefix = 'SS_' + index;
|
|
853
|
-
const url = linkField.url
|
|
859
|
+
const url = (linkField.url && /^https?:\/\//i.test(linkField.url)) ? linkField.url : DONATE_URL;
|
|
860
|
+
if (url === DONATE_URL) {
|
|
861
|
+
console.warn('[baileys] links[].url kosong/tidak valid (harus http:// atau https://) — dipakai DONATE_URL sebagai gantinya. Cek nilai url yang dikirim ke field "links".');
|
|
862
|
+
}
|
|
854
863
|
const sources = (linkField.sources || []).map(s => ({
|
|
855
864
|
source_type: 'THIRD_PARTY',
|
|
856
865
|
source_display_name: s.displayName || 'Source',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuiisweety/baileys",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.20",
|
|
5
5
|
"description": "A WebSockets library for interacting with WhatsApp Web — forked STRICTLY from @whiskeysockets/baileys only, NOT from any other baileys fork. Modified by NuiiS4TORU.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"whatsapp",
|