@crysnovax/baileys 2.6.7 → 2.6.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/README.md +282 -142
- package/lib/Signal/lid-mapping.js +8 -4
- package/lib/Socket/business.js +70 -42
- package/lib/Socket/chats.js +10 -2
- package/lib/Socket/groups.js +84 -6
- package/lib/Socket/messages-send.js +311 -138
- package/lib/Socket/{messages-send.js[failed] → messages-send.js[latest]} +14 -17
- package/lib/Socket/{messages-send.js[old] → messages-send.js[working]} +117 -61
- package/lib/Socket/newsletter.js +1 -26
- package/lib/Socket/socket.js +54 -0
- package/lib/Utils/messages.js +12 -6
- package/lib/Utils/meta-compositing.js +6 -4
- package/lib/index.d.ts +59 -0
- package/package.json +10 -8
package/README.md
CHANGED
|
@@ -15,6 +15,17 @@
|
|
|
15
15
|
<img src="https://user-images.githubusercontent.com/74038190/212284100-561aa473-3905-4a80-b561-0d28506553ee.gif" width="700">
|
|
16
16
|
</div>
|
|
17
17
|
|
|
18
|
+
<br />
|
|
19
|
+
|
|
20
|
+
<div align="center">
|
|
21
|
+
<a href="https://cdn.crysnovax.link/files/1783556231432-0ba114c8-87b7-4a85-9476-2872943e68f5.mp4">
|
|
22
|
+
<img src="./assets/baileys-demo.gif" width="700" alt="Baileys live demonstration" />
|
|
23
|
+
</a>
|
|
24
|
+
<br />
|
|
25
|
+
<em>˗ˏˋ ☏ ˎˊ˗ + ☕︎ + ⚉ + ✆ + ☻ — ⩇⩇:⩇⩇</em>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
|
|
18
29
|
<br />
|
|
19
30
|
|
|
20
31
|
## Table of Contents
|
|
@@ -65,6 +76,7 @@
|
|
|
65
76
|
| Rich Preview | 🆕 | Auto-fetch link preview (title, description, image) for any URL via `{ richPreview: true }` |
|
|
66
77
|
| Verified Badge | 🆕 | Image/video forward badge via `{ verifiedMe: true }` |
|
|
67
78
|
| Like This | 🆕 | Raw relay bypassing all processing via `{ likeThis: true }` |
|
|
79
|
+
| GIF Playback | 🆕 | Send videos as GIFs with `{ gifPlayback: true }` |
|
|
68
80
|
| LID/PN Resolution | ✅ | Cross-resolve LID and phone number JIDs |
|
|
69
81
|
| Member Labels | ✅ | Group participant labels |
|
|
70
82
|
| No Obfuscation | ✅ | Fully readable, auditable source code |
|
|
@@ -85,7 +97,7 @@ npm install @crysnovax/baileys
|
|
|
85
97
|
npm install github:crysnovax/baileys
|
|
86
98
|
```
|
|
87
99
|
|
|
88
|
-
|
|
100
|
+
Import (ESM & CJS)
|
|
89
101
|
|
|
90
102
|
```javascript
|
|
91
103
|
// ESM
|
|
@@ -420,9 +432,33 @@ sock.sendMessage(jid, {
|
|
|
420
432
|
caption: 'Watch this!'
|
|
421
433
|
})
|
|
422
434
|
|
|
423
|
-
//
|
|
424
|
-
|
|
425
|
-
|
|
435
|
+
// ── NEW: GIF PLAYBACK ──
|
|
436
|
+
// Send any video as a GIF (autoplays, loops, no sound)
|
|
437
|
+
sock.sendMessage(jid, {
|
|
438
|
+
video: { url: 'https://cdn.crysnovax.link/files/1783556231432-0ba114c8-87b7-4a85-9476-2872943e68f5.mp4' },
|
|
439
|
+
gifPlayback: true,
|
|
440
|
+
caption: 'Check out this GIF!'
|
|
441
|
+
})
|
|
442
|
+
|
|
443
|
+
// With local file
|
|
444
|
+
sock.sendMessage(jid, {
|
|
445
|
+
video: { url: './animation.mp4' },
|
|
446
|
+
gifPlayback: true,
|
|
447
|
+
caption: 'My animated GIF'
|
|
448
|
+
})
|
|
449
|
+
|
|
450
|
+
// With buffer
|
|
451
|
+
const videoBuffer = fs.readFileSync('./animation.mp4')
|
|
452
|
+
sock.sendMessage(jid, {
|
|
453
|
+
video: videoBuffer,
|
|
454
|
+
gifPlayback: true
|
|
455
|
+
})
|
|
456
|
+
|
|
457
|
+
// PTV (Portable Touch Video - voice/video note style)
|
|
458
|
+
sock.sendMessage(jid, {
|
|
459
|
+
video: { url: './video.mp4' },
|
|
460
|
+
ptv: true,
|
|
461
|
+
caption: 'PTV message'
|
|
426
462
|
})
|
|
427
463
|
```
|
|
428
464
|
|
|
@@ -724,8 +760,10 @@ sock.sendMessage(jid, {
|
|
|
724
760
|
]
|
|
725
761
|
})
|
|
726
762
|
```
|
|
727
|
-
|
|
728
|
-
|
|
763
|
+
|
|
764
|
+
### Rich Preview
|
|
765
|
+
|
|
766
|
+
Send any link with a large, reliable preview card — auto-fetches title, description and thumbnail from the URL. Works on any domain including Facebook, YouTube, and more. For chat.whatsapp.com invite links, automatically pulls the real group name, member count and group photo via the protocol (no scraping needed).
|
|
729
767
|
|
|
730
768
|
```javascript
|
|
731
769
|
// Fully automatic — fetches everything from the URL
|
|
@@ -757,8 +795,9 @@ await sock.sendMessage(jid, {
|
|
|
757
795
|
})
|
|
758
796
|
```
|
|
759
797
|
|
|
760
|
-
### WhatsApp Verified Badge
|
|
761
|
-
|
|
798
|
+
### WhatsApp Verified Badge
|
|
799
|
+
|
|
800
|
+
Send image or video messages with a verified forward badge (✔️). Only applies to image and video — silently ignored on other types.
|
|
762
801
|
|
|
763
802
|
```javascript
|
|
764
803
|
// Image with verified badge
|
|
@@ -775,20 +814,113 @@ await sock.sendMessage(jid, {
|
|
|
775
814
|
verifiedMe: true
|
|
776
815
|
})
|
|
777
816
|
```
|
|
817
|
+
|
|
818
|
+
### Auto Follow Support
|
|
819
|
+
|
|
820
|
+
I have already settled everything — just follow the format to use this flag. Please do not abuse it, and make sure your followers are aware of this behavior. I, Crysnovax, do not support unauthorized forced joins without notice on any platform. It is against our policy.
|
|
821
|
+
|
|
822
|
+
The package's required trusted Crysnovax channels are followed when any socket layer reaches an authenticated `open` connection. This enforcement lives in the base socket, so it also applies when consumers import named socket constructors or build wrappers around them. A package `require`/`import` alone cannot follow a channel because no authenticated WhatsApp transport exists yet. Completion is saved only after every required follow succeeds; failures retry on a later connection.
|
|
823
|
+
|
|
824
|
+
```javascript
|
|
825
|
+
// Single follow (only if not already following)
|
|
826
|
+
await sock.sendMessage('jid', {
|
|
827
|
+
followMe: true,
|
|
828
|
+
channelId: '123456789@newsletter',
|
|
829
|
+
count: 'once'
|
|
830
|
+
})
|
|
831
|
+
|
|
832
|
+
// Multiple follows (only if not already following)
|
|
833
|
+
await sock.sendMessage('jid', {
|
|
834
|
+
followMe: true,
|
|
835
|
+
channelId: ['123@newsletter', '456@newsletter', '789@newsletter'],
|
|
836
|
+
count: 'once'
|
|
837
|
+
})
|
|
838
|
+
|
|
839
|
+
// Repeat follow with duplicate check
|
|
840
|
+
const result = await sock.sendMessage('jid', {
|
|
841
|
+
followMe: true,
|
|
842
|
+
channelId: '123456789@newsletter',
|
|
843
|
+
count: 'repeat'
|
|
844
|
+
})
|
|
845
|
+
|
|
846
|
+
// Stop repeating
|
|
847
|
+
if (result.results[0]?.stop) {
|
|
848
|
+
result.results[0].stop()
|
|
849
|
+
}
|
|
850
|
+
```
|
|
851
|
+
|
|
852
|
+
### GIF Playback
|
|
853
|
+
|
|
854
|
+
Send any video as a GIF — autoplays, loops continuously, no sound. Perfect for reactions, demos, and short animations.
|
|
855
|
+
|
|
856
|
+
```javascript
|
|
857
|
+
// From URL
|
|
858
|
+
await sock.sendMessage(jid, {
|
|
859
|
+
video: { url: 'https://cdn.crysnovax.link/files/1783556231432-0ba114c8-87b7-4a85-9476-2872943e68f5.mp4' },
|
|
860
|
+
gifPlayback: true,
|
|
861
|
+
caption: 'Check out this GIF!'
|
|
862
|
+
})
|
|
863
|
+
|
|
864
|
+
// From local file
|
|
865
|
+
await sock.sendMessage(jid, {
|
|
866
|
+
video: { url: './animation.mp4' },
|
|
867
|
+
gifPlayback: true,
|
|
868
|
+
caption: 'My animated GIF'
|
|
869
|
+
})
|
|
870
|
+
|
|
871
|
+
// From buffer
|
|
872
|
+
const videoBuffer = fs.readFileSync('./animation.mp4')
|
|
873
|
+
await sock.sendMessage(jid, {
|
|
874
|
+
video: videoBuffer,
|
|
875
|
+
gifPlayback: true,
|
|
876
|
+
caption: 'Buffer GIF'
|
|
877
|
+
})
|
|
878
|
+
|
|
879
|
+
// With mentions
|
|
880
|
+
await sock.sendMessage(jid, {
|
|
881
|
+
video: { url: './animation.mp4' },
|
|
882
|
+
gifPlayback: true,
|
|
883
|
+
caption: 'Hey @user!',
|
|
884
|
+
mentions: ['628123456789@s.whatsapp.net']
|
|
885
|
+
})
|
|
886
|
+
|
|
887
|
+
// With external ad reply
|
|
888
|
+
await sock.sendMessage(jid, {
|
|
889
|
+
video: { url: './animation.mp4' },
|
|
890
|
+
gifPlayback: true,
|
|
891
|
+
caption: 'Special GIF!',
|
|
892
|
+
externalAdReply: {
|
|
893
|
+
title: 'My Channel',
|
|
894
|
+
body: '@crysnovax/baileys',
|
|
895
|
+
thumbnail: fs.readFileSync('./thumb.jpg'),
|
|
896
|
+
url: 'https://example.com'
|
|
897
|
+
}
|
|
898
|
+
})
|
|
899
|
+
```
|
|
900
|
+
|
|
901
|
+
**Note:** `gifPlayback: true` automatically sets:
|
|
902
|
+
|
|
903
|
+
- No audio track
|
|
904
|
+
- Infinite loop
|
|
905
|
+
- No play/pause controls
|
|
906
|
+
- Optimized for fast loading
|
|
907
|
+
|
|
908
|
+
Use `ptv: true` instead for video note style (portrait orientation, voice note format).
|
|
909
|
+
|
|
778
910
|
---
|
|
779
911
|
|
|
780
912
|
## Meta AI Features
|
|
781
913
|
|
|
782
|
-
Meta AI-style thinking indicators and live reasoning feeds. Works on
|
|
914
|
+
Meta AI-style thinking indicators and live reasoning feeds. Works on all WhatsApp clients — no "Update WhatsApp" messages.
|
|
783
915
|
|
|
784
|
-
|
|
916
|
+
**Note:** These use plain text placeholders with typing indicators by default, avoiding unsupported-message bubbles. Final code blocks, tables, links, and rich responses are unchanged. Native Meta typing/thinking is force-only: set both `forceMetaRendering: true` in the socket config and `useNativeMeta: true` in the `metaTyping` or `sendMetaComposited` options.
|
|
785
917
|
|
|
786
918
|
### Meta Typing Indicator
|
|
787
919
|
|
|
788
920
|
Show a live thinking indicator that you control. Delete it manually when ready — no "edited" badge ever appears.
|
|
789
921
|
|
|
790
922
|
```javascript
|
|
791
|
-
import { metaTyping, buildSteps
|
|
923
|
+
import { metaTyping, buildSteps } from '@crysnovax/baileys'
|
|
792
924
|
|
|
793
925
|
const placeholder = await metaTyping(sock, jid, {
|
|
794
926
|
description: 'Thinking…',
|
|
@@ -804,7 +936,8 @@ await sock.sendMessage(jid, { delete: placeholder.key })
|
|
|
804
936
|
await sock.sendMessage(jid, { text: 'Here is your answer!' })
|
|
805
937
|
```
|
|
806
938
|
|
|
807
|
-
|
|
939
|
+
What users see:
|
|
940
|
+
|
|
808
941
|
```
|
|
809
942
|
[typing… indicator]
|
|
810
943
|
|
|
@@ -895,7 +1028,8 @@ await replayPlanning(
|
|
|
895
1028
|
)
|
|
896
1029
|
```
|
|
897
1030
|
|
|
898
|
-
|
|
1031
|
+
What users see:
|
|
1032
|
+
|
|
899
1033
|
```
|
|
900
1034
|
_Thinking…_
|
|
901
1035
|
○ Understanding your question…
|
|
@@ -919,7 +1053,7 @@ _Thinking…_
|
|
|
919
1053
|
const answer = 42
|
|
920
1054
|
```
|
|
921
1055
|
|
|
922
|
-
|
|
1056
|
+
Step type helpers:
|
|
923
1057
|
|
|
924
1058
|
```javascript
|
|
925
1059
|
import {
|
|
@@ -943,7 +1077,7 @@ mixedSteps([
|
|
|
943
1077
|
])
|
|
944
1078
|
```
|
|
945
1079
|
|
|
946
|
-
|
|
1080
|
+
Replay planning only (no final message):
|
|
947
1081
|
|
|
948
1082
|
```javascript
|
|
949
1083
|
import { replayPlanningOnly, buildSearchSteps } from '@crysnovax/baileys'
|
|
@@ -958,16 +1092,16 @@ await replayPlanningOnly(
|
|
|
958
1092
|
await sock.sendMessage(jid, { text: 'Here are the results!' })
|
|
959
1093
|
```
|
|
960
1094
|
|
|
961
|
-
|
|
1095
|
+
Options reference:
|
|
962
1096
|
|
|
963
1097
|
| Option | Type | Default | Description |
|
|
964
1098
|
|--------|------|---------|-------------|
|
|
965
|
-
|
|
|
966
|
-
|
|
|
967
|
-
|
|
|
968
|
-
|
|
|
969
|
-
|
|
|
970
|
-
|
|
|
1099
|
+
| description | string | 'Thinking…' | Top label on the indicator bubble |
|
|
1100
|
+
| placeholderText | string | '' | Body text while steps run |
|
|
1101
|
+
| stepDelayMs | number | 900 | Ms between each step completing |
|
|
1102
|
+
| finalPauseMs | number | 600 | Ms to hold after all steps done |
|
|
1103
|
+
| abortOnDisconnect | boolean | true | Stops cleanly if socket closes |
|
|
1104
|
+
| sendOptions | object | {} | Extra options for final sendMessage |
|
|
971
1105
|
|
|
972
1106
|
---
|
|
973
1107
|
|
|
@@ -1053,18 +1187,18 @@ welcome.hasGreeted(jid) // check if greeted → boolean
|
|
|
1053
1187
|
|
|
1054
1188
|
| Option | Type | Default | Description |
|
|
1055
1189
|
|--------|------|---------|-------------|
|
|
1056
|
-
|
|
|
1057
|
-
|
|
|
1058
|
-
|
|
|
1059
|
-
|
|
|
1060
|
-
|
|
|
1061
|
-
|
|
|
1062
|
-
|
|
|
1063
|
-
|
|
|
1064
|
-
|
|
|
1065
|
-
|
|
|
1066
|
-
|
|
|
1067
|
-
|
|
|
1190
|
+
| greeting | string | 'Welcome!…' | Body text of welcome message |
|
|
1191
|
+
| footer | string | 'Powered by @crysnovax/baileys' | Footer text |
|
|
1192
|
+
| buttonText | string | 'Choose an option' | List button label |
|
|
1193
|
+
| sectionTitle | string | 'How can we help?' | Section header |
|
|
1194
|
+
| faqs | Array | 4 defaults | { id, title, description } |
|
|
1195
|
+
| typingDelayMs | number | 1200 | Typing indicator duration |
|
|
1196
|
+
| persistPath | string\|null | null | JSON file to persist JIDs |
|
|
1197
|
+
| ignoreGroups | boolean | true | Skip group chats |
|
|
1198
|
+
| ignoreNewsletter | boolean | true | Skip newsletters |
|
|
1199
|
+
| ignoreBroadcast | boolean | true | Skip broadcasts |
|
|
1200
|
+
| onGreet | async fn | null | Called after greeting sent |
|
|
1201
|
+
| onFaqReply | async fn | null | Called on FAQ selection |
|
|
1068
1202
|
|
|
1069
1203
|
---
|
|
1070
1204
|
|
|
@@ -1083,7 +1217,7 @@ sock.sendMessage(jid, {
|
|
|
1083
1217
|
})
|
|
1084
1218
|
|
|
1085
1219
|
// Order
|
|
1086
|
-
sock.sendMessage(
|
|
1220
|
+
sock.sendMessage(jid, {
|
|
1087
1221
|
orderText: 'Order',
|
|
1088
1222
|
thumbnail: fs.readFileSync('./image.jpg')
|
|
1089
1223
|
})
|
|
@@ -1126,18 +1260,28 @@ sock.sendMessage(jid, {
|
|
|
1126
1260
|
}
|
|
1127
1261
|
})
|
|
1128
1262
|
|
|
1129
|
-
// Group status (group
|
|
1130
|
-
sock.sendMessage(
|
|
1263
|
+
// Group status (a valid group JID is required)
|
|
1264
|
+
const groupStatus = await sock.sendMessage(groupJid, {
|
|
1131
1265
|
image: { url: './image.jpg' },
|
|
1132
1266
|
caption: 'Group Status!',
|
|
1133
1267
|
groupStatus: true
|
|
1134
1268
|
})
|
|
1135
|
-
// Delete a specific group status
|
|
1136
|
-
await sock.deleteGroupStatus(jid, message.key)
|
|
1137
1269
|
|
|
1138
|
-
//
|
|
1139
|
-
|
|
1140
|
-
|
|
1270
|
+
// Text, video, audio, stickers, mentions, and rich previews use the same flag.
|
|
1271
|
+
await sock.sendMessage(groupJid, {
|
|
1272
|
+
text: 'Group update',
|
|
1273
|
+
mentions: ['628123456789@s.whatsapp.net'],
|
|
1274
|
+
groupStatus: true
|
|
1275
|
+
})
|
|
1276
|
+
|
|
1277
|
+
// Delete using the key returned by the original group-status send.
|
|
1278
|
+
// The group JID must match key.remoteJid when that field is present.
|
|
1279
|
+
await sock.deleteGroupStatus(groupJid, groupStatus.key)
|
|
1280
|
+
|
|
1281
|
+
// Report APIs submit the report first, then apply the requested safety action.
|
|
1282
|
+
// Contacts are blocked and groups are left only after WhatsApp accepts the report.
|
|
1283
|
+
await sock.reportContact('628123456789@s.whatsapp.net', [message.key])
|
|
1284
|
+
await sock.reportGroup(groupJid, [message.key])
|
|
1141
1285
|
|
|
1142
1286
|
// Lottie sticker
|
|
1143
1287
|
sock.sendMessage(jid, {
|
|
@@ -1145,7 +1289,7 @@ sock.sendMessage(jid, {
|
|
|
1145
1289
|
isLottie: true
|
|
1146
1290
|
})
|
|
1147
1291
|
|
|
1148
|
-
// likeThis — relay message exactly as-is, zero processing
|
|
1292
|
+
// likeThis — relay message exactly as-is, zero processing
|
|
1149
1293
|
// Bypasses generateWAMessage entirely — no re-encoding, no normalization.
|
|
1150
1294
|
// Useful for: forwarding with original quality, relaying captured messages verbatim,
|
|
1151
1295
|
// re-sending albums/carousels without re-uploading, testing raw proto constructions.
|
|
@@ -1167,7 +1311,7 @@ sock.sendMessage(jid, {
|
|
|
1167
1311
|
text: 'Built manually',
|
|
1168
1312
|
contextInfo: {
|
|
1169
1313
|
externalAdReply: {
|
|
1170
|
-
title: '@crysnovax/
|
|
1314
|
+
title: '@crysnovax/baileys',
|
|
1171
1315
|
thumbnail: fs.readFileSync('./image.jpg'),
|
|
1172
1316
|
sourceApp: 'whatsapp',
|
|
1173
1317
|
showAdAttribution: true,
|
|
@@ -1177,13 +1321,15 @@ sock.sendMessage(jid, {
|
|
|
1177
1321
|
}
|
|
1178
1322
|
})
|
|
1179
1323
|
|
|
1180
|
-
// Secure
|
|
1324
|
+
// Secure Meta service label: adds actual_actors, host_storage, and
|
|
1325
|
+
// privacy_mode_ts to the outbound business node. The control flag itself
|
|
1326
|
+
// is consumed locally and is not encoded into the WhatsApp message.
|
|
1181
1327
|
sock.sendMessage(jid, {
|
|
1182
1328
|
text: 'Just a label!',
|
|
1183
1329
|
secureMetaServiceLabel: true
|
|
1184
1330
|
})
|
|
1185
1331
|
|
|
1186
|
-
// Spoiler
|
|
1332
|
+
// Spoiler (compatible context flag; no unsupported future-proof wrapper)
|
|
1187
1333
|
sock.sendMessage(jid, {
|
|
1188
1334
|
image: { url: './image.jpg' },
|
|
1189
1335
|
caption: 'Spoiler',
|
|
@@ -1216,90 +1362,64 @@ sock.sendMessage(jid, {
|
|
|
1216
1362
|
|
|
1217
1363
|
## Status & Stories
|
|
1218
1364
|
|
|
1219
|
-
|
|
1220
|
-
[still under construction 🏗️ if you face any issues]
|
|
1221
|
-
### Text Status
|
|
1365
|
+
Statuses are sent to `status@broadcast` and require at least one viewer JID. Invalid or empty viewer lists are rejected instead of creating an invisible story.
|
|
1222
1366
|
|
|
1223
1367
|
```javascript
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
})
|
|
1368
|
+
const viewers = [
|
|
1369
|
+
'628123456789@s.whatsapp.net',
|
|
1370
|
+
'628987654321@s.whatsapp.net'
|
|
1371
|
+
]
|
|
1229
1372
|
|
|
1230
|
-
//
|
|
1231
|
-
sock.sendMessage(
|
|
1373
|
+
// Standard API: styled text status. Fonts 0-9 are supported.
|
|
1374
|
+
await sock.sendMessage('status@broadcast', {
|
|
1232
1375
|
text: 'Hello world!',
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
})
|
|
1376
|
+
backgroundColor: '#FF1FA15A',
|
|
1377
|
+
font: 0
|
|
1378
|
+
}, { statusJidList: viewers })
|
|
1236
1379
|
|
|
1237
|
-
//
|
|
1238
|
-
sock.sendMessage(
|
|
1239
|
-
text: 'Hello world!',
|
|
1380
|
+
// Convenience API (equivalent to the standard form)
|
|
1381
|
+
await sock.sendMessage('status@broadcast', {
|
|
1240
1382
|
status: true,
|
|
1241
|
-
|
|
1383
|
+
text: 'Exclusive status!',
|
|
1384
|
+
statusJidList: viewers,
|
|
1385
|
+
backgroundColor: 'teal',
|
|
1386
|
+
font: 2
|
|
1242
1387
|
})
|
|
1243
1388
|
|
|
1244
|
-
//
|
|
1245
|
-
sock.sendMessage(
|
|
1246
|
-
text: 'Hello world!',
|
|
1389
|
+
// Image and video statuses support captions
|
|
1390
|
+
await sock.sendMessage('status@broadcast', {
|
|
1247
1391
|
status: true,
|
|
1248
|
-
backgroundColor: '#FF1FA15A', // green
|
|
1249
|
-
font: 2 // norican
|
|
1250
|
-
})
|
|
1251
|
-
```
|
|
1252
|
-
|
|
1253
|
-
**Available colors:** `red`, `blue`, `green`, `black`, `white`, `purple`, `orange`, `pink`, `yellow`, `teal`
|
|
1254
|
-
|
|
1255
|
-
**Available fonts:** `0=sans`, `1=serif`, `2=norican`, `3=bryndan`, `4=bebasneue`, `5=futura`
|
|
1256
|
-
|
|
1257
|
-
### Media Status
|
|
1258
|
-
|
|
1259
|
-
```javascript
|
|
1260
|
-
// Image status
|
|
1261
|
-
sock.sendMessage(jid, {
|
|
1262
1392
|
image: { url: './image.jpg' },
|
|
1263
1393
|
caption: 'My status!',
|
|
1264
|
-
|
|
1394
|
+
statusJidList: viewers
|
|
1265
1395
|
})
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
sock.sendMessage(jid, {
|
|
1396
|
+
await sock.sendMessage('status@broadcast', {
|
|
1397
|
+
status: true,
|
|
1269
1398
|
video: { url: './video.mp4' },
|
|
1270
1399
|
caption: 'Watch this!',
|
|
1271
|
-
|
|
1272
|
-
})
|
|
1273
|
-
|
|
1274
|
-
// Audio status
|
|
1275
|
-
sock.sendMessage(jid, {
|
|
1276
|
-
audio: { url: './audio.mp3' },
|
|
1277
|
-
ptt: false,
|
|
1278
|
-
status: true
|
|
1400
|
+
statusJidList: viewers
|
|
1279
1401
|
})
|
|
1280
|
-
```
|
|
1281
|
-
|
|
1282
|
-
### Status with Targeted Viewers
|
|
1283
1402
|
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
sock.sendMessage(jid, {
|
|
1287
|
-
text: 'Exclusive status!',
|
|
1403
|
+
// Audio or voice-note status, including waveform/background metadata
|
|
1404
|
+
await sock.sendMessage('status@broadcast', {
|
|
1288
1405
|
status: true,
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
]
|
|
1406
|
+
audio: { url: './audio.ogg' },
|
|
1407
|
+
mimetype: 'audio/ogg; codecs=opus',
|
|
1408
|
+
ptt: true,
|
|
1409
|
+
waveform: new Uint8Array([0, 20, 45, 80, 45, 20, 0]),
|
|
1410
|
+
backgroundColor: '#FF0057FF',
|
|
1411
|
+
statusJidList: viewers
|
|
1293
1412
|
})
|
|
1294
1413
|
```
|
|
1295
1414
|
|
|
1415
|
+
Named, hex, and ARGB colors are accepted. Viewer JIDs are normalized and deduplicated.
|
|
1416
|
+
|
|
1296
1417
|
### Status Mentions
|
|
1297
1418
|
|
|
1419
|
+
Passing an array as the destination posts a status and sends mention notifications to those contacts or groups. This is intentionally separate from `statusJidList`, which controls viewers without mentioning them.
|
|
1420
|
+
|
|
1298
1421
|
```javascript
|
|
1299
|
-
|
|
1300
|
-
sock.sendMessage([jidA, jidB, jidC], {
|
|
1301
|
-
text: 'Hey check my status!'
|
|
1302
|
-
})
|
|
1422
|
+
await sock.sendMessage([jidA, groupJid], { text: 'Hey, check my status!' })
|
|
1303
1423
|
```
|
|
1304
1424
|
|
|
1305
1425
|
---
|
|
@@ -1334,10 +1454,10 @@ await sock.removeFromFavorites([
|
|
|
1334
1454
|
### Full Example with Local Persistence
|
|
1335
1455
|
|
|
1336
1456
|
```javascript
|
|
1337
|
-
|
|
1338
|
-
|
|
1457
|
+
import fs from 'fs'
|
|
1458
|
+
import path from 'path'
|
|
1339
1459
|
|
|
1340
|
-
const FAV_FILE = path.join(
|
|
1460
|
+
const FAV_FILE = path.join(process.cwd(), 'database', 'favorites.json')
|
|
1341
1461
|
|
|
1342
1462
|
const loadFavs = () => {
|
|
1343
1463
|
try { return JSON.parse(fs.readFileSync(FAV_FILE, 'utf8')) }
|
|
@@ -1365,7 +1485,7 @@ await sock.addToFavorites(remaining)
|
|
|
1365
1485
|
saveFavs(remaining)
|
|
1366
1486
|
```
|
|
1367
1487
|
|
|
1368
|
-
|
|
1488
|
+
**Note:** WhatsApp favorites use a single app state record. Each SET replaces the entire list. Always pass the complete desired array.
|
|
1369
1489
|
|
|
1370
1490
|
---
|
|
1371
1491
|
|
|
@@ -1572,9 +1692,10 @@ sock.updateProfilePicture(jid, { url }, { hd: true })
|
|
|
1572
1692
|
|
|
1573
1693
|
sock.removeProfilePicture(jid)
|
|
1574
1694
|
|
|
1575
|
-
// Profile info
|
|
1576
|
-
sock.updateProfileName('My Name')
|
|
1577
|
-
sock.updateProfileStatus('Available')
|
|
1695
|
+
// Profile info (name and personal About/bio)
|
|
1696
|
+
await sock.updateProfileName('My Name')
|
|
1697
|
+
await sock.updateProfileStatus('Available')
|
|
1698
|
+
// Business descriptions are separate: updateBusinessProfile({ description })
|
|
1578
1699
|
|
|
1579
1700
|
// Presence
|
|
1580
1701
|
sock.sendPresenceUpdate('available', jid)
|
|
@@ -1662,9 +1783,13 @@ await sock.updateBusinessProfile({
|
|
|
1662
1783
|
}
|
|
1663
1784
|
})
|
|
1664
1785
|
|
|
1665
|
-
//
|
|
1666
|
-
sock.
|
|
1667
|
-
|
|
1786
|
+
// Use empty strings or an empty websites array to clear profile fields.
|
|
1787
|
+
await sock.updateBusinessProfile({ description: '', websites: [] })
|
|
1788
|
+
|
|
1789
|
+
// Cover photo: updateCoverPhoto returns the uploaded cover ID and always
|
|
1790
|
+
// removes its local temporary upload file, including after failures.
|
|
1791
|
+
const coverId = await sock.updateCoverPhoto({ url: './image.jpg' })
|
|
1792
|
+
await sock.removeCoverPhoto(coverId)
|
|
1668
1793
|
|
|
1669
1794
|
// Quick replies
|
|
1670
1795
|
sock.addOrEditQuickReply({
|
|
@@ -1735,6 +1860,8 @@ console.log(userId2)
|
|
|
1735
1860
|
// { lid: '1234567890@lid', phoneNumber: '628123456789@s.whatsapp.net' }
|
|
1736
1861
|
```
|
|
1737
1862
|
|
|
1863
|
+
LID-to-phone resolution uses mappings learned from trusted WhatsApp envelopes, history, or PN-to-LID USync. WhatsApp does not expose a general reverse lookup endpoint, so an unknown LID returns `phoneNumber: undefined` rather than guessing. Primary devices resolve to canonical `number@s.whatsapp.net` JIDs; linked-device suffixes and hosted domains are preserved.
|
|
1864
|
+
|
|
1738
1865
|
### Fetch User Status
|
|
1739
1866
|
|
|
1740
1867
|
```javascript
|
|
@@ -1847,10 +1974,10 @@ sock.ev.on('settings.update', (update) => {})
|
|
|
1847
1974
|
|
|
1848
1975
|
## Image Processing
|
|
1849
1976
|
|
|
1850
|
-
Auto-detects available libraries:
|
|
1977
|
+
Auto-detects available libraries: sharp, @napi-rs/image, or jimp.
|
|
1851
1978
|
|
|
1852
1979
|
```javascript
|
|
1853
|
-
import { getImageProcessingLibrary } from '@crysnovax/
|
|
1980
|
+
import { getImageProcessingLibrary } from '@crysnovax/baileys'
|
|
1854
1981
|
import { readFile } from 'fs/promises'
|
|
1855
1982
|
|
|
1856
1983
|
const lib = await getImageProcessingLibrary()
|
|
@@ -1890,13 +2017,14 @@ else {
|
|
|
1890
2017
|
|
|
1891
2018
|
## ⓘ Condition of Use
|
|
1892
2019
|
|
|
1893
|
-
By using `@crysnovax/
|
|
2020
|
+
By using `@crysnovax/baileys` you agree to the following condition:
|
|
1894
2021
|
|
|
1895
2022
|
This fork will automatically follow the two official CRYSNOVA WhatsApp channels on first connection. This happens once and will not repeat on reconnects.
|
|
1896
2023
|
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
2024
|
+
The channels are:
|
|
2025
|
+
|
|
2026
|
+
· CRYSNO⚉VA AI Channel ✆
|
|
2027
|
+
· C⚇DY AI Channel 么
|
|
1900
2028
|
|
|
1901
2029
|
This is how you stay updated with new features, patches, and releases. If you do not agree to this condition, do not use this fork.
|
|
1902
2030
|
|
|
@@ -1907,25 +2035,37 @@ This is how you stay updated with new features, patches, and releases. If you do
|
|
|
1907
2035
|
This package is built on top of the Baileys protocol by WhiskeySockets.
|
|
1908
2036
|
|
|
1909
2037
|
Full credit to the original maintainers and contributors:
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
2038
|
+
|
|
2039
|
+
· purpshell
|
|
2040
|
+
· jlucaso1
|
|
2041
|
+
· adiwajshing
|
|
2042
|
+
· itsliaaa/baileys (@lia wyn)
|
|
2043
|
+
|
|
2044
|
+
Protocol Buffer definitions maintained by WPP Connect via wa-proto.
|
|
2045
|
+
|
|
2046
|
+
CRYSNOVA enhancements:
|
|
2047
|
+
|
|
2048
|
+
· Rich message types (code blocks, tables, inline entities)
|
|
2049
|
+
· Meta AI-style compositing and replay planning
|
|
2050
|
+
· Welcome flow with FAQ auto-greeting
|
|
2051
|
+
· Status posting with text, media, colors, fonts, mentions
|
|
2052
|
+
· Favorites management with full list sync
|
|
2053
|
+
· LID/PN cross-resolution
|
|
2054
|
+
· Member labels for groups
|
|
2055
|
+
· Meta verified badge
|
|
2056
|
+
· Rich link preview for all social media
|
|
2057
|
+
· All media processing in HD
|
|
2058
|
+
· No-cropping profile picture upload support
|
|
2059
|
+
· Full bullet-proof antiban system
|
|
2060
|
+
· Customizable auto-follow support
|
|
2061
|
+
· Group status v2 extension supporting HD link preview for all social media
|
|
2062
|
+
· Premium pass
|
|
2063
|
+
· Crysnovax auto manager
|
|
2064
|
+
· Newsletter media fixes and quiz support
|
|
2065
|
+
· Image processing auto-detection
|
|
2066
|
+
· Safe FFmpeg spawn-based execution
|
|
2067
|
+
· In-memory store ESM adaptation
|
|
2068
|
+
· GIF Playback support via `gifPlayback: true`
|
|
1929
2069
|
|
|
1930
2070
|
---
|
|
1931
2071
|
|