@crysnovax/baileys 2.6.0 → 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/README.md +54 -0
- package/lib/Socket/chats.js +16 -2
- package/lib/Socket/chats.js[past] +1213 -0
- package/lib/Utils/bot-planning-replay.js +57 -92
- package/lib/Utils/messages-media.js +74 -0
- package/lib/Utils/messages-media.js[past] +842 -0
- package/lib/Utils/meta-compositing.js +61 -77
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -118,6 +118,7 @@ const crysnova = {
|
|
|
118
118
|
| Image Processing | ✅ | Auto-detects `sharp`, `@napi-rs/image`, or `jimp` |
|
|
119
119
|
| Safe FFmpeg | ✅ | Uses `spawn` instead of `exec` |
|
|
120
120
|
| In-Memory Store | ✅ | Reintroduced with minimal ESM adaptation |
|
|
121
|
+
| HD Profile Picture | ✅ | Full-size upload with no crop or resize via `{ hd: true }` (max 720px) |
|
|
121
122
|
|
|
122
123
|
---
|
|
123
124
|
|
|
@@ -775,6 +776,10 @@ sock.sendMessage(jid, {
|
|
|
775
776
|
|
|
776
777
|
## Meta AI Features
|
|
777
778
|
|
|
779
|
+
Meta AI-style thinking indicators and live reasoning feeds. Works on **all WhatsApp clients** — no "Update WhatsApp" messages.
|
|
780
|
+
|
|
781
|
+
> **Note:** These use plain text placeholders with typing indicators, not native Meta AI rendering (which only works on AI-enabled WhatsApp clients). The visual experience is identical — users see "Thinking…" with live step completion.
|
|
782
|
+
|
|
778
783
|
### Meta Typing Indicator
|
|
779
784
|
|
|
780
785
|
Show a live thinking indicator that you control. Delete it manually when ready — no "edited" badge ever appears.
|
|
@@ -796,6 +801,19 @@ await sock.sendMessage(jid, { delete: placeholder.key })
|
|
|
796
801
|
await sock.sendMessage(jid, { text: 'Here is your answer!' })
|
|
797
802
|
```
|
|
798
803
|
|
|
804
|
+
**What users see:**
|
|
805
|
+
```
|
|
806
|
+
[typing… indicator]
|
|
807
|
+
|
|
808
|
+
_Thinking…_
|
|
809
|
+
○ Reading your message…
|
|
810
|
+
○ Writing response…
|
|
811
|
+
|
|
812
|
+
[auto-deletes]
|
|
813
|
+
|
|
814
|
+
Here is your answer!
|
|
815
|
+
```
|
|
816
|
+
|
|
799
817
|
### Meta Compositing
|
|
800
818
|
|
|
801
819
|
Full flow: indicator shows → auto-deletes → clean final message lands. Works with every rich content type.
|
|
@@ -874,6 +892,30 @@ await replayPlanning(
|
|
|
874
892
|
)
|
|
875
893
|
```
|
|
876
894
|
|
|
895
|
+
**What users see:**
|
|
896
|
+
```
|
|
897
|
+
_Thinking…_
|
|
898
|
+
○ Understanding your question…
|
|
899
|
+
○ Searching for data…
|
|
900
|
+
○ Writing the answer…
|
|
901
|
+
|
|
902
|
+
[step 1 completes]
|
|
903
|
+
_Thinking…_
|
|
904
|
+
✓ Understanding your question…
|
|
905
|
+
○ Searching for data…
|
|
906
|
+
○ Writing the answer…
|
|
907
|
+
|
|
908
|
+
[step 2 completes]
|
|
909
|
+
_Thinking…_
|
|
910
|
+
✓ Understanding your question…
|
|
911
|
+
✓ Searching for data…
|
|
912
|
+
○ Writing the answer…
|
|
913
|
+
|
|
914
|
+
[all done, deletes, then:]
|
|
915
|
+
|
|
916
|
+
const answer = 42
|
|
917
|
+
```
|
|
918
|
+
|
|
877
919
|
**Step type helpers:**
|
|
878
920
|
|
|
879
921
|
```javascript
|
|
@@ -1335,8 +1377,20 @@ const community = await sock.communityGetInviteInfo('ABC123456789')
|
|
|
1335
1377
|
```javascript
|
|
1336
1378
|
// Profile picture
|
|
1337
1379
|
const url = await sock.profilePictureUrl(jid, 'image')
|
|
1380
|
+
|
|
1381
|
+
// Standard — auto crop + resize to 720×720
|
|
1338
1382
|
sock.updateProfilePicture(jid, buffer)
|
|
1339
1383
|
sock.updateProfilePicture(jid, { url })
|
|
1384
|
+
|
|
1385
|
+
// Standard with custom dimensions
|
|
1386
|
+
sock.updateProfilePicture(jid, { url }, { width: 640, height: 640 })
|
|
1387
|
+
|
|
1388
|
+
// HD — preserves original aspect ratio, no crop, no padding
|
|
1389
|
+
// Images under 720px pass through unchanged.
|
|
1390
|
+
// Larger images are scaled down proportionally to fit within 720px.
|
|
1391
|
+
sock.updateProfilePicture(jid, buffer, { hd: true })
|
|
1392
|
+
sock.updateProfilePicture(jid, { url }, { hd: true })
|
|
1393
|
+
|
|
1340
1394
|
sock.removeProfilePicture(jid)
|
|
1341
1395
|
|
|
1342
1396
|
// Profile info
|
package/lib/Socket/chats.js
CHANGED
|
@@ -5,6 +5,7 @@ import { DEFAULT_CACHE_TTLS, HISTORY_SYNC_PAUSED_TIMEOUT_MS, PROCESSABLE_HISTORY
|
|
|
5
5
|
import { ALL_WA_PATCH_NAMES } 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
|
+
import { generateProfilePictureHD } from '../Utils/messages-media.js';
|
|
8
9
|
import { makeMutex } from '../Utils/make-mutex.js';
|
|
9
10
|
import processMessage from '../Utils/process-message.js';
|
|
10
11
|
import { buildTcTokenFromJid } from '../Utils/tc-token-utils.js';
|
|
@@ -207,7 +208,15 @@ export const makeChatsSocket = (config) => {
|
|
|
207
208
|
}
|
|
208
209
|
return userId;
|
|
209
210
|
};
|
|
210
|
-
/** update the profile picture for yourself or a group
|
|
211
|
+
/** update the profile picture for yourself or a group
|
|
212
|
+
*
|
|
213
|
+
* Standard (crop + resize to 720×720):
|
|
214
|
+
* sock.updateProfilePicture(jid, content)
|
|
215
|
+
* sock.updateProfilePicture(jid, content, { width: 640, height: 640 })
|
|
216
|
+
*
|
|
217
|
+
* HD (full-size, no crop, no resize):
|
|
218
|
+
* sock.updateProfilePicture(jid, content, { hd: true })
|
|
219
|
+
*/
|
|
211
220
|
const updateProfilePicture = async (jid, content, dimensions) => {
|
|
212
221
|
let targetJid;
|
|
213
222
|
if (!jid) {
|
|
@@ -219,7 +228,12 @@ export const makeChatsSocket = (config) => {
|
|
|
219
228
|
else {
|
|
220
229
|
targetJid = undefined;
|
|
221
230
|
}
|
|
222
|
-
|
|
231
|
+
// crysnovax@HD-Profile --- Dual mode:
|
|
232
|
+
// hd:true → generateProfilePictureHD (preserves aspect ratio, caps at 1920, manages file size)
|
|
233
|
+
// standard → generateProfilePicture (720×720 square crop, or custom dimensions)
|
|
234
|
+
const { img } = dimensions?.hd
|
|
235
|
+
? await generateProfilePictureHD(content)
|
|
236
|
+
: await generateProfilePicture(content, dimensions);
|
|
223
237
|
await query({
|
|
224
238
|
tag: 'iq',
|
|
225
239
|
attrs: {
|