@itsliaaa/baileys 0.1.24 โ 0.1.26
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 +133 -60
- package/lib/Socket/messages-send.js +3 -4
- package/lib/Utils/rich-message-utils.js +29 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,16 +34,13 @@ This fork designed for production use with a focus on clarity and safety:
|
|
|
34
34
|
- ๐ซ No obfuscation. Easy to read and audit.
|
|
35
35
|
- ๐ซ No auto-follow channel (newsletter) behavior.
|
|
36
36
|
|
|
37
|
-
###
|
|
38
|
-
|
|
39
|
-
#### ๐ ๏ธ Internal Adjustments
|
|
37
|
+
### ๐ ๏ธ Internal Adjustments
|
|
40
38
|
- ๐ผ๏ธ Fixed an issue where media could not be sent to newsletters due to an upstream issue.
|
|
41
39
|
- ๐ Reintroduced [`makeInMemoryStore`](#%EF%B8%8F-implementing-a-data-store) with a minimal ESM adaptation and small adjustments for Baileys v7.
|
|
42
40
|
- ๐ฆ Switched FFmpeg execution from `exec` to `spawn` for safer process handling.
|
|
43
41
|
- ๐๏ธ Added [`@napi-rs/image`](https://www.npmjs.com/package/@napi-rs/image) as a supported image processing backend in [`getImageProcessingLibrary()`](#%EF%B8%8F-image-processing), offering a balance between performance and compatibility.
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
- ๐ฐ Simplified sending messages with ad thumbnail using [`externalAdReply`](#3%EF%B8%8Fโฃ-external-ad-reply), without requiring manual `contextInfo`.
|
|
43
|
+
### ๐จ Message Handling & Compatibility
|
|
47
44
|
- ๐ฉ Expanded message support for:
|
|
48
45
|
- ๐ผ๏ธ [Album Message](#%EF%B8%8F-album-image--video)
|
|
49
46
|
- ๐ค [Group Status Message](#4%EF%B8%8Fโฃ-group-status)
|
|
@@ -54,8 +51,9 @@ This fork designed for production use with a focus on clarity and safety:
|
|
|
54
51
|
- ๐งพ [Message with Code Blocks](#-message-with-code-block) **[NEW]**
|
|
55
52
|
- ๐ [Message with Table](#-message-with-table) **[NEW]**
|
|
56
53
|
- ๐ณ [Payment-related Message](#-sending-payment-messages) (payment requests, invites, orders, invoices).
|
|
54
|
+
- ๐ฐ Simplified sending messages with ad thumbnail using [`externalAdReply`](#3%EF%B8%8Fโฃ-external-ad-reply), without requiring manual `contextInfo`.
|
|
57
55
|
|
|
58
|
-
|
|
56
|
+
### ๐งฉ Additional Message Options
|
|
59
57
|
- ๐๏ธ Added optional boolean flags for message handling:
|
|
60
58
|
- ๐ค [`ai`](#1%EF%B8%8Fโฃ-ai-icon) - AI icon on message
|
|
61
59
|
- ๐ฃ [`mentionAll`](#-mention) - Mention all group participants without requiring their JIDs in `mentions` or `mentionedJid` **[NEW]**
|
|
@@ -104,9 +102,7 @@ import { makeWASocket } from '@itsliaaa/baileys'
|
|
|
104
102
|
const { makeWASocket } = require('@itsliaaa/baileys')
|
|
105
103
|
```
|
|
106
104
|
|
|
107
|
-
###
|
|
108
|
-
|
|
109
|
-
#### ๐ Connect to WhatsApp (Quick Step)
|
|
105
|
+
### ๐ Connect to WhatsApp (Quick Step)
|
|
110
106
|
|
|
111
107
|
```javascript
|
|
112
108
|
import { makeWASocket, delay, DisconnectReason, useMultiFileAuthState } from '@itsliaaa/baileys'
|
|
@@ -162,7 +158,7 @@ const connectToWhatsApp = async () => {
|
|
|
162
158
|
connectToWhatsApp()
|
|
163
159
|
```
|
|
164
160
|
|
|
165
|
-
|
|
161
|
+
### ๐๏ธ Implementing Data Store
|
|
166
162
|
|
|
167
163
|
> [!CAUTION]
|
|
168
164
|
I highly recommend building your own data store, as keeping an entire chat history in memory can lead to excessive RAM usage.
|
|
@@ -235,7 +231,7 @@ const connectToWhatsApp = async () => {
|
|
|
235
231
|
connectToWhatsApp()
|
|
236
232
|
```
|
|
237
233
|
|
|
238
|
-
|
|
234
|
+
### ๐ชช WhatsApp IDs Explain
|
|
239
235
|
|
|
240
236
|
`id` is the WhatsApp ID, called `jid` and `lid` too, of the person or group you're sending the message to.
|
|
241
237
|
- It must be in the format `[country code][phone number]@s.whatsapp.net`
|
|
@@ -245,12 +241,12 @@ connectToWhatsApp()
|
|
|
245
241
|
- For broadcast lists, it's `[timestamp of creation]@broadcast`.
|
|
246
242
|
- For stories, the ID is `status@broadcast`.
|
|
247
243
|
|
|
248
|
-
|
|
244
|
+
### โ๏ธ Sending Messages
|
|
249
245
|
|
|
250
246
|
> [!NOTE]
|
|
251
247
|
You can get the `jid` from `message.key.remoteJid` in the first example.
|
|
252
248
|
|
|
253
|
-
|
|
249
|
+
#### ๐ Text
|
|
254
250
|
|
|
255
251
|
```javascript
|
|
256
252
|
sock.sendMessage(jid, {
|
|
@@ -260,7 +256,7 @@ sock.sendMessage(jid, {
|
|
|
260
256
|
})
|
|
261
257
|
```
|
|
262
258
|
|
|
263
|
-
|
|
259
|
+
#### ๐ Mention
|
|
264
260
|
|
|
265
261
|
```javascript
|
|
266
262
|
// --- Regular mention
|
|
@@ -280,7 +276,7 @@ sock.sendMessage(jid, {
|
|
|
280
276
|
})
|
|
281
277
|
```
|
|
282
278
|
|
|
283
|
-
|
|
279
|
+
#### ๐ Reaction
|
|
284
280
|
|
|
285
281
|
```javascript
|
|
286
282
|
sock.sendMessage(jid, {
|
|
@@ -293,7 +289,7 @@ sock.sendMessage(jid, {
|
|
|
293
289
|
})
|
|
294
290
|
```
|
|
295
291
|
|
|
296
|
-
|
|
292
|
+
#### ๐ Pin Message
|
|
297
293
|
|
|
298
294
|
```javascript
|
|
299
295
|
sock.sendMessage(jid, {
|
|
@@ -305,7 +301,7 @@ sock.sendMessage(jid, {
|
|
|
305
301
|
})
|
|
306
302
|
```
|
|
307
303
|
|
|
308
|
-
|
|
304
|
+
#### ๐ค Contact
|
|
309
305
|
|
|
310
306
|
```javascript
|
|
311
307
|
const vcard = 'BEGIN:VCARD\n'
|
|
@@ -327,7 +323,7 @@ sock.sendMessage(jid, {
|
|
|
327
323
|
})
|
|
328
324
|
```
|
|
329
325
|
|
|
330
|
-
|
|
326
|
+
#### ๐ Location
|
|
331
327
|
|
|
332
328
|
```javascript
|
|
333
329
|
sock.sendMessage(jid, {
|
|
@@ -341,7 +337,31 @@ sock.sendMessage(jid, {
|
|
|
341
337
|
})
|
|
342
338
|
```
|
|
343
339
|
|
|
344
|
-
|
|
340
|
+
#### ๐๏ธ Event
|
|
341
|
+
|
|
342
|
+
```javascript
|
|
343
|
+
sock.sendMessage(jid, {
|
|
344
|
+
event: {
|
|
345
|
+
name: '๐ถ Meet & Mingle Party',
|
|
346
|
+
description: 'Meet & Mingle Party is a fun, casual gathering to connect, chat, and build new relationships within the community.',
|
|
347
|
+
call: 'audio', // --- Or "video", this field is optional
|
|
348
|
+
startDate: new Date(Date.now() + 3600000),
|
|
349
|
+
endDate: new Date(Date.now() + 28800000),
|
|
350
|
+
isCancelled: false, // --- Optional
|
|
351
|
+
isScheduleCall: false, // --- Optional
|
|
352
|
+
extraGuestsAllowed: false, // --- Optional
|
|
353
|
+
location: {
|
|
354
|
+
name: 'Jakarta',
|
|
355
|
+
degreesLatitude: -6.2,
|
|
356
|
+
degreesLongitude: 106.8
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}, {
|
|
360
|
+
quoted: message
|
|
361
|
+
})
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
#### ๐ Poll
|
|
345
365
|
|
|
346
366
|
```javascript
|
|
347
367
|
// --- Regular poll message
|
|
@@ -400,15 +420,60 @@ sock.sendMessage(jid, {
|
|
|
400
420
|
})
|
|
401
421
|
```
|
|
402
422
|
|
|
403
|
-
|
|
423
|
+
#### ๐ญ Response
|
|
404
424
|
|
|
405
425
|
```javascript
|
|
406
|
-
|
|
407
|
-
|
|
426
|
+
// --- Using buttonsResponseMessage
|
|
427
|
+
sock.sendMessage(jid, {
|
|
428
|
+
type: 'plain',
|
|
429
|
+
buttonReply: {
|
|
430
|
+
id: '#Menu',
|
|
431
|
+
displayText: 'โจ Interesting Menu'
|
|
432
|
+
}
|
|
433
|
+
}, {
|
|
434
|
+
quoted: message
|
|
435
|
+
})
|
|
436
|
+
|
|
437
|
+
// --- Using interactiveResponseMessage
|
|
438
|
+
sock.sendMessage(jid, {
|
|
439
|
+
flowReply: {
|
|
440
|
+
format: 0,
|
|
441
|
+
text: '๐ญ Response',
|
|
442
|
+
name: 'menu_options',
|
|
443
|
+
paramsJson: JSON.stringify({
|
|
444
|
+
id: '#Menu',
|
|
445
|
+
description: 'โจ Interesting Menu'
|
|
446
|
+
})
|
|
447
|
+
}
|
|
448
|
+
}, {
|
|
449
|
+
quoted: message
|
|
450
|
+
})
|
|
451
|
+
|
|
452
|
+
// --- Using listResponseMessage
|
|
453
|
+
sock.sendMessage(jid, {
|
|
454
|
+
listReply: {
|
|
455
|
+
title: '๐ See More',
|
|
456
|
+
description: 'โจ Interesting Menu',
|
|
457
|
+
id: '#Menu'
|
|
458
|
+
}
|
|
459
|
+
}, {
|
|
460
|
+
quoted: message
|
|
461
|
+
})
|
|
462
|
+
|
|
463
|
+
// --- Using templateButtonReplyMessage
|
|
464
|
+
sock.sendMessage(jid, {
|
|
465
|
+
type: 'template',
|
|
466
|
+
buttonReply: {
|
|
467
|
+
id: '#Menu',
|
|
468
|
+
displayText: 'โจ Interesting Menu',
|
|
469
|
+
index: 1
|
|
470
|
+
}
|
|
471
|
+
}, {
|
|
472
|
+
quoted: message
|
|
408
473
|
})
|
|
409
474
|
```
|
|
410
475
|
|
|
411
|
-
|
|
476
|
+
#### โจ Rich Response
|
|
412
477
|
|
|
413
478
|
> [!NOTE]
|
|
414
479
|
`richResponse[]` is a representation of [`submessages[]`](https://baileys.wiki/docs/api/namespaces/proto/interfaces/IAIRichResponseSubMessage) inside `richResponseMessage`.
|
|
@@ -449,19 +514,19 @@ sock.sendMessage(jid, {
|
|
|
449
514
|
})
|
|
450
515
|
```
|
|
451
516
|
|
|
452
|
-
|
|
517
|
+
#### ๐งพ Message with Code Block
|
|
453
518
|
|
|
454
519
|
```javascript
|
|
455
520
|
sock.sendMessage(jid, {
|
|
456
521
|
headerText: '## Example Usage',
|
|
457
|
-
contentText: '---'
|
|
522
|
+
contentText: '---',
|
|
458
523
|
code: 'console.log("Hello, World!")',
|
|
459
524
|
language: 'javascript',
|
|
460
525
|
footerText: 'Pretty simple, right?'
|
|
461
526
|
})
|
|
462
527
|
```
|
|
463
528
|
|
|
464
|
-
|
|
529
|
+
#### ๐ Message with Table
|
|
465
530
|
|
|
466
531
|
```javascript
|
|
467
532
|
sock.sendMessage(jid, {
|
|
@@ -477,12 +542,20 @@ sock.sendMessage(jid, {
|
|
|
477
542
|
})
|
|
478
543
|
```
|
|
479
544
|
|
|
480
|
-
####
|
|
545
|
+
#### ๐๏ธ Status Mention
|
|
546
|
+
|
|
547
|
+
```javascript
|
|
548
|
+
sock.sendMessage([jidA, jidB, jidC], {
|
|
549
|
+
text: 'Hello! ๐๐ป'
|
|
550
|
+
})
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
### ๐ Sending Media Messages
|
|
481
554
|
|
|
482
555
|
> [!NOTE]
|
|
483
556
|
For media messages, you can pass a `Buffer` directly, or an object with either `{ stream: Readable }` or `{ url: string }` (local file path or HTTP/HTTPS URL).
|
|
484
557
|
|
|
485
|
-
|
|
558
|
+
#### ๐ผ๏ธ Image
|
|
486
559
|
|
|
487
560
|
```javascript
|
|
488
561
|
sock.sendMessage(jid, {
|
|
@@ -495,7 +568,7 @@ sock.sendMessage(jid, {
|
|
|
495
568
|
})
|
|
496
569
|
```
|
|
497
570
|
|
|
498
|
-
|
|
571
|
+
#### ๐ฅ Video
|
|
499
572
|
|
|
500
573
|
```javascript
|
|
501
574
|
sock.sendMessage(jid, {
|
|
@@ -510,7 +583,7 @@ sock.sendMessage(jid, {
|
|
|
510
583
|
})
|
|
511
584
|
```
|
|
512
585
|
|
|
513
|
-
|
|
586
|
+
#### ๐ Sticker
|
|
514
587
|
|
|
515
588
|
```javascript
|
|
516
589
|
sock.sendMessage(jid, {
|
|
@@ -522,7 +595,7 @@ sock.sendMessage(jid, {
|
|
|
522
595
|
})
|
|
523
596
|
```
|
|
524
597
|
|
|
525
|
-
|
|
598
|
+
#### ๐ฝ Audio
|
|
526
599
|
|
|
527
600
|
```javascript
|
|
528
601
|
sock.sendMessage(jid, {
|
|
@@ -535,7 +608,7 @@ sock.sendMessage(jid, {
|
|
|
535
608
|
})
|
|
536
609
|
```
|
|
537
610
|
|
|
538
|
-
|
|
611
|
+
#### ๐ผ๏ธ Album (Image & Video)
|
|
539
612
|
|
|
540
613
|
```javascript
|
|
541
614
|
sock.sendMessage(jid, {
|
|
@@ -565,7 +638,7 @@ sock.sendMessage(jid, {
|
|
|
565
638
|
})
|
|
566
639
|
```
|
|
567
640
|
|
|
568
|
-
|
|
641
|
+
#### ๐ฆ Sticker Pack
|
|
569
642
|
|
|
570
643
|
> [!IMPORTANT]
|
|
571
644
|
If `sharp` or `@napi-rs/image` is not installed, the `cover` and `stickers` must already be in WebP format.
|
|
@@ -596,9 +669,9 @@ sock.sendMessage(jid, {
|
|
|
596
669
|
})
|
|
597
670
|
```
|
|
598
671
|
|
|
599
|
-
|
|
672
|
+
### ๐๐ป Sending Interactive Messages
|
|
600
673
|
|
|
601
|
-
|
|
674
|
+
#### 1๏ธโฃ Buttons
|
|
602
675
|
|
|
603
676
|
```javascript
|
|
604
677
|
// --- Regular buttons message
|
|
@@ -649,7 +722,7 @@ sock.sendMessage(jid, {
|
|
|
649
722
|
})
|
|
650
723
|
```
|
|
651
724
|
|
|
652
|
-
|
|
725
|
+
#### 2๏ธโฃ List
|
|
653
726
|
|
|
654
727
|
> [!NOTE]
|
|
655
728
|
It only works in private chat (`@s.whatsapp.net`).
|
|
@@ -680,7 +753,7 @@ sock.sendMessage(jid, {
|
|
|
680
753
|
})
|
|
681
754
|
```
|
|
682
755
|
|
|
683
|
-
|
|
756
|
+
#### 3๏ธโฃ Interactive
|
|
684
757
|
|
|
685
758
|
```javascript
|
|
686
759
|
// --- Native Flow
|
|
@@ -787,7 +860,7 @@ sock.sendMessage(jid, {
|
|
|
787
860
|
})
|
|
788
861
|
```
|
|
789
862
|
|
|
790
|
-
|
|
863
|
+
#### 4๏ธโฃ Hydrated Template
|
|
791
864
|
|
|
792
865
|
```javascript
|
|
793
866
|
sock.sendMessage(jid, {
|
|
@@ -812,9 +885,9 @@ sock.sendMessage(jid, {
|
|
|
812
885
|
})
|
|
813
886
|
```
|
|
814
887
|
|
|
815
|
-
|
|
888
|
+
### ๐ณ Sending Payment Messages
|
|
816
889
|
|
|
817
|
-
|
|
890
|
+
#### 1๏ธโฃ Invite Payment
|
|
818
891
|
|
|
819
892
|
```javascript
|
|
820
893
|
sock.sendMessage(jid, {
|
|
@@ -822,7 +895,7 @@ sock.sendMessage(jid, {
|
|
|
822
895
|
})
|
|
823
896
|
```
|
|
824
897
|
|
|
825
|
-
|
|
898
|
+
#### 2๏ธโฃ Invoice
|
|
826
899
|
|
|
827
900
|
> [!NOTE]
|
|
828
901
|
Invoice message are not supported yet.
|
|
@@ -836,7 +909,7 @@ sock.sendMessage(jid, {
|
|
|
836
909
|
})
|
|
837
910
|
```
|
|
838
911
|
|
|
839
|
-
|
|
912
|
+
#### 3๏ธโฃ Order
|
|
840
913
|
|
|
841
914
|
```javascript
|
|
842
915
|
sock.sendMessage(chat, {
|
|
@@ -847,7 +920,7 @@ sock.sendMessage(chat, {
|
|
|
847
920
|
})
|
|
848
921
|
```
|
|
849
922
|
|
|
850
|
-
|
|
923
|
+
#### 4๏ธโฃ Product
|
|
851
924
|
|
|
852
925
|
```javascript
|
|
853
926
|
sock.sendMessage(jid, {
|
|
@@ -863,7 +936,7 @@ sock.sendMessage(jid, {
|
|
|
863
936
|
})
|
|
864
937
|
```
|
|
865
938
|
|
|
866
|
-
|
|
939
|
+
#### 5๏ธโฃ Request Payment
|
|
867
940
|
|
|
868
941
|
```javascript
|
|
869
942
|
sock.sendMessage(jid, {
|
|
@@ -872,9 +945,9 @@ sock.sendMessage(jid, {
|
|
|
872
945
|
})
|
|
873
946
|
```
|
|
874
947
|
|
|
875
|
-
|
|
948
|
+
### ๐๏ธ Other Message Options
|
|
876
949
|
|
|
877
|
-
|
|
950
|
+
#### 1๏ธโฃ AI Icon
|
|
878
951
|
|
|
879
952
|
> [!NOTE]
|
|
880
953
|
It only works in private chat (`@s.whatsapp.net`).
|
|
@@ -891,7 +964,7 @@ sock.sendMessage(jid, {
|
|
|
891
964
|
})
|
|
892
965
|
```
|
|
893
966
|
|
|
894
|
-
|
|
967
|
+
#### 2๏ธโฃ Ephemeral
|
|
895
968
|
|
|
896
969
|
> [!NOTE]
|
|
897
970
|
Wrap message into `ephemeralMessage`
|
|
@@ -906,7 +979,7 @@ sock.sendMessage(jid, {
|
|
|
906
979
|
})
|
|
907
980
|
```
|
|
908
981
|
|
|
909
|
-
|
|
982
|
+
#### 3๏ธโฃ External Ad Reply
|
|
910
983
|
|
|
911
984
|
> [!NOTE]
|
|
912
985
|
Add an ad thumbnail to messages (may not be displayed on some WhatsApp versions).
|
|
@@ -926,7 +999,7 @@ sock.sendMessage(jid, {
|
|
|
926
999
|
})
|
|
927
1000
|
```
|
|
928
1001
|
|
|
929
|
-
|
|
1002
|
+
#### 4๏ธโฃ Group Status
|
|
930
1003
|
|
|
931
1004
|
> [!NOTE]
|
|
932
1005
|
It only works in group chat (`@g.us`)
|
|
@@ -941,7 +1014,7 @@ sock.sendMessage(jid, {
|
|
|
941
1014
|
})
|
|
942
1015
|
```
|
|
943
1016
|
|
|
944
|
-
|
|
1017
|
+
#### 5๏ธโฃ Raw
|
|
945
1018
|
|
|
946
1019
|
```javascript
|
|
947
1020
|
sock.sendMessage(jid, {
|
|
@@ -963,7 +1036,7 @@ sock.sendMessage(jid, {
|
|
|
963
1036
|
})
|
|
964
1037
|
```
|
|
965
1038
|
|
|
966
|
-
|
|
1039
|
+
#### 6๏ธโฃ Secure Meta Service Label
|
|
967
1040
|
|
|
968
1041
|
```javascript
|
|
969
1042
|
sock.sendMessage(jid, {
|
|
@@ -972,7 +1045,7 @@ sock.sendMessage(jid, {
|
|
|
972
1045
|
})
|
|
973
1046
|
```
|
|
974
1047
|
|
|
975
|
-
|
|
1048
|
+
#### 7๏ธโฃ View Once
|
|
976
1049
|
|
|
977
1050
|
> [!NOTE]
|
|
978
1051
|
Wrap message into `viewOnceMessage`
|
|
@@ -987,7 +1060,7 @@ sock.sendMessage(jid, {
|
|
|
987
1060
|
})
|
|
988
1061
|
```
|
|
989
1062
|
|
|
990
|
-
|
|
1063
|
+
#### 8๏ธโฃ View Once V2
|
|
991
1064
|
|
|
992
1065
|
> [!NOTE]
|
|
993
1066
|
Wrap message into `viewOnceMessageV2`
|
|
@@ -1002,7 +1075,7 @@ sock.sendMessage(jid, {
|
|
|
1002
1075
|
})
|
|
1003
1076
|
```
|
|
1004
1077
|
|
|
1005
|
-
|
|
1078
|
+
#### 9๏ธโฃ View Once V2 Extension
|
|
1006
1079
|
|
|
1007
1080
|
> [!NOTE]
|
|
1008
1081
|
Wrap message into `viewOnceMessageV2Extension`
|
|
@@ -1017,9 +1090,9 @@ sock.sendMessage(jid, {
|
|
|
1017
1090
|
})
|
|
1018
1091
|
```
|
|
1019
1092
|
|
|
1020
|
-
|
|
1093
|
+
### ๐งฐ Additional Contents
|
|
1021
1094
|
|
|
1022
|
-
|
|
1095
|
+
#### ๐ท๏ธ Find User ID (JID|PN/LID)
|
|
1023
1096
|
|
|
1024
1097
|
> [!NOTE]
|
|
1025
1098
|
The ID must contain numbers only (no +, (), or -) and must include the country code with WhatsApp ID format.
|
|
@@ -1052,7 +1125,7 @@ console.log('๐ท๏ธ Got user ID', ':', ids)
|
|
|
1052
1125
|
// --- Same output shape regardless of input type
|
|
1053
1126
|
```
|
|
1054
1127
|
|
|
1055
|
-
|
|
1128
|
+
#### ๐ Request Custom Pairing Code
|
|
1056
1129
|
|
|
1057
1130
|
> [!NOTE]
|
|
1058
1131
|
The phone number must contain numbers only (no +, (), or -) and must include the country code.
|
|
@@ -1066,7 +1139,7 @@ await sock.requestPairingCode(phoneNumber, customPairingCode)
|
|
|
1066
1139
|
console.log('๐ Pairing code', ':', customPairingCode)
|
|
1067
1140
|
```
|
|
1068
1141
|
|
|
1069
|
-
|
|
1142
|
+
#### ๐ผ๏ธ Image Processing
|
|
1070
1143
|
|
|
1071
1144
|
> [!NOTE]
|
|
1072
1145
|
Automatically use available image processing library: `sharp`, `@napi-rs/image`, or `jimp`
|
|
@@ -1122,7 +1195,7 @@ console.log('โ
Process completed!')
|
|
|
1122
1195
|
console.dir(output, { depth: null })
|
|
1123
1196
|
```
|
|
1124
1197
|
|
|
1125
|
-
|
|
1198
|
+
#### ๐ฃ Newsletter Management
|
|
1126
1199
|
|
|
1127
1200
|
```javascript
|
|
1128
1201
|
// --- Create a new one
|
|
@@ -1160,7 +1233,7 @@ const newsletters = await sock.newsletterSubscribed()
|
|
|
1160
1233
|
console.dir(newsletters, { depth: null })
|
|
1161
1234
|
```
|
|
1162
1235
|
|
|
1163
|
-
|
|
1236
|
+
#### ๐ฅ Group Management
|
|
1164
1237
|
|
|
1165
1238
|
```javascript
|
|
1166
1239
|
// --- Create a new one and add participants using their JIDs
|
|
@@ -811,15 +811,14 @@ export const makeMessagesSocket = (config) => {
|
|
|
811
811
|
content: tcTokenBuffer
|
|
812
812
|
});
|
|
813
813
|
}
|
|
814
|
+
let alreadyHasBizNode = false;
|
|
814
815
|
if (additionalNodes && additionalNodes.length > 0) {
|
|
815
816
|
;
|
|
816
817
|
stanza.content.push(...additionalNodes);
|
|
818
|
+
alreadyHasBizNode = !addBizAttributes &&
|
|
819
|
+
additionalNodes.some(node => node.tag === 'biz');
|
|
817
820
|
}
|
|
818
821
|
// Lia@Changes 30-01-26 --- Add Biz Binary Node to support button messages
|
|
819
|
-
let alreadyHasBizNode = false;
|
|
820
|
-
if (!addBizAttributes) {
|
|
821
|
-
alreadyHasBizNode = additionalNodes.some(node => node.tag === 'biz');
|
|
822
|
-
}
|
|
823
822
|
if ((!alreadyHasBizNode && shouldIncludeBizBinaryNode(innerMessage)) || addBizAttributes) {
|
|
824
823
|
const bizNode = getBizBinaryNode(innerMessage, addBizAttributes);
|
|
825
824
|
stanza.content.push(bizNode);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* If you use or copy this code, please credit my name or project.
|
|
6
6
|
*/
|
|
7
7
|
import { getRandomValues, randomUUID, randomBytes } from 'crypto';
|
|
8
|
-
import { BOT_RENDERING_CONFIG_METADATA, LEXER_REGEX } from '../Defaults/index.js';
|
|
8
|
+
import { BOT_RENDERING_CONFIG_METADATA, DONATE_URL, LEXER_REGEX } from '../Defaults/index.js';
|
|
9
9
|
import { LANGUAGE_KEYWORDS } from '../WABinary/constants.js';
|
|
10
10
|
import { CodeHighlightType, RichSubMessageType } from '../Types/RichType.js';
|
|
11
11
|
import { proto } from '../../WAProto/index.js';
|
|
@@ -49,7 +49,7 @@ export const tokenizeCode = (code, language = 'javascript') => {
|
|
|
49
49
|
export const toUnified = (submessages) =>
|
|
50
50
|
({
|
|
51
51
|
response_id: randomUUID(),
|
|
52
|
-
sections: submessages.map((submessage) => {
|
|
52
|
+
sections: submessages.map((submessage, index) => {
|
|
53
53
|
switch (submessage.messageType) {
|
|
54
54
|
case RichSubMessageType.CODE:
|
|
55
55
|
const codeMetadata = submessage.codeMetadata;
|
|
@@ -63,7 +63,6 @@ export const toUnified = (submessages) =>
|
|
|
63
63
|
__typename: 'GenAISingleLayoutViewModel'
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
|
-
break;
|
|
67
66
|
case RichSubMessageType.CONTENT_ITEMS:
|
|
68
67
|
return {
|
|
69
68
|
view_model: {
|
|
@@ -86,7 +85,6 @@ export const toUnified = (submessages) =>
|
|
|
86
85
|
__typename: 'GenAIHScrollLayoutViewModel'
|
|
87
86
|
}
|
|
88
87
|
};
|
|
89
|
-
break;
|
|
90
88
|
case RichSubMessageType.LATEX:
|
|
91
89
|
const latexMetadata = submessage.latexMetadata;
|
|
92
90
|
const item = {
|
|
@@ -109,7 +107,6 @@ export const toUnified = (submessages) =>
|
|
|
109
107
|
__typename: 'GenAISingleLayoutViewModel'
|
|
110
108
|
}
|
|
111
109
|
};
|
|
112
|
-
break;
|
|
113
110
|
case RichSubMessageType.TABLE:
|
|
114
111
|
const tableMetadata = submessage.tableMetadata;
|
|
115
112
|
return {
|
|
@@ -122,15 +119,39 @@ export const toUnified = (submessages) =>
|
|
|
122
119
|
__typename: 'GenAISingleLayoutViewModel'
|
|
123
120
|
}
|
|
124
121
|
};
|
|
125
|
-
break;
|
|
126
122
|
case RichSubMessageType.TEXT:
|
|
123
|
+
const shouldAddInlineEntity = index == 0;
|
|
124
|
+
const inlineEntity = [{
|
|
125
|
+
key: 'Starseed',
|
|
126
|
+
metadata: {
|
|
127
|
+
reference_id: 1,
|
|
128
|
+
reference_url: DONATE_URL,
|
|
129
|
+
reference_title: 'For Donation via Saweria',
|
|
130
|
+
reference_display_name: 'Donate',
|
|
131
|
+
sources: [{
|
|
132
|
+
source_type: 'THIRD_PARTY',
|
|
133
|
+
source_display_name: 'Donate',
|
|
134
|
+
source_subtitle: '',
|
|
135
|
+
source_url: DONATE_URL
|
|
136
|
+
}],
|
|
137
|
+
__typename: 'GenAISearchCitationItem'
|
|
138
|
+
}
|
|
139
|
+
}];
|
|
140
|
+
const textEntity = shouldAddInlineEntity ?
|
|
141
|
+
'{{Starseed}}ยน{{/Starseed}}' :
|
|
142
|
+
'';
|
|
127
143
|
return {
|
|
128
144
|
view_model: {
|
|
129
|
-
primitive: {
|
|
145
|
+
primitive: {
|
|
146
|
+
text: submessage.messageText + textEntity,
|
|
147
|
+
inline_entities: shouldAddInlineEntity ?
|
|
148
|
+
inlineEntity :
|
|
149
|
+
[],
|
|
150
|
+
__typename: 'GenAIMarkdownTextUXPrimitive'
|
|
151
|
+
},
|
|
130
152
|
__typename: 'GenAISingleLayoutViewModel'
|
|
131
153
|
}
|
|
132
154
|
};
|
|
133
|
-
break;
|
|
134
155
|
}
|
|
135
156
|
return submessage;
|
|
136
157
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itsliaaa/baileys",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26",
|
|
4
4
|
"description": "Enhanced Baileys v7 with fixed newsletter media upload, plus support for interactive messages, albums, and more message types.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|