savage-baileys 2.0.0 → 2.0.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 +10 -34
- package/lib/Utils/decode-wa-message.js +2 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/tysavage163/savage-baileys/main/assets/logo.jpg" alt="Savage Baileys Logo" width="250" />
|
|
2
3
|
<h1>Savage Baileys</h1>
|
|
3
4
|
<p>A WebSocket-based JavaScript library for interacting with the WhatsApp Web API</p>
|
|
5
|
+
<p>Created and maintained by <strong>Spencer (Savage Tech)</strong></p>
|
|
4
6
|
|
|
5
7
|
[](https://www.npmjs.com/package/savage-baileys)
|
|
6
8
|
[](https://www.npmjs.com/package/savage-baileys)
|
|
@@ -9,6 +11,13 @@
|
|
|
9
11
|
|
|
10
12
|
---
|
|
11
13
|
|
|
14
|
+
## Author & Credits
|
|
15
|
+
|
|
16
|
+
Created with 💻 and ☕ by **Spencer (Savage Tech)**.
|
|
17
|
+
Check out the repository at [github.com/tysavage163/savage-baileys](https://github.com/tysavage163/savage-baileys).
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
12
21
|
## Disclaimer
|
|
13
22
|
|
|
14
23
|
This project is not affiliated, associated, authorized, endorsed by, or in any way officially
|
|
@@ -24,6 +33,7 @@ Do not spam people with this. We discourage any stalkerware, bulk or automated m
|
|
|
24
33
|
- Full WhatsApp Web API support
|
|
25
34
|
- Multi-device support with QR code and pairing code authentication
|
|
26
35
|
- LID (Link ID) addressing for personal chats and groups
|
|
36
|
+
- Phone-number lookup on LID chats: message keys carry `remoteJidAlt` (DMs) and `participantAlt` (groups) with the sender's real number when known
|
|
27
37
|
- Group status / story sending
|
|
28
38
|
- View-once: send view-once text/media (V1, V2, V2Extension), detect and unwrap incoming view-once, recover blank view-once stubs, and download the media
|
|
29
39
|
- Session management and restoration
|
|
@@ -48,37 +58,3 @@ using the public API this library exposes:
|
|
|
48
58
|
```javascript
|
|
49
59
|
await sock.groupAcceptInvite(inviteCode)
|
|
50
60
|
await sock.newsletterFollow(channelJid)
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
## View-once
|
|
55
|
-
|
|
56
|
-
```javascript
|
|
57
|
-
const { downloadViewOnceMessage, extractViewOnceMedia, isViewOnceMessage } = require('savage-baileys')
|
|
58
|
-
|
|
59
|
-
// send view-once (V2 is required for view-once text)
|
|
60
|
-
await sock.sendMessage(jid, { text: 'hi', viewOnceV2: true })
|
|
61
|
-
await sock.sendMessage(jid, { image: { url: './pic.jpg' }, viewOnceV2: true })
|
|
62
|
-
// voice-note capable variant
|
|
63
|
-
await sock.sendMessage(jid, { audio: { url: './a.ogg' }, ptt: true, viewOnceV2Extension: true })
|
|
64
|
-
|
|
65
|
-
// receive + download
|
|
66
|
-
sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
67
|
-
for (const m of messages) {
|
|
68
|
-
if (extractViewOnceMedia(m.message)?.isViewOnce) {
|
|
69
|
-
const buf = await downloadViewOnceMessage(m, 'buffer', {}, {
|
|
70
|
-
logger: sock.logger,
|
|
71
|
-
reuploadRequest: sock.updateMediaMessage
|
|
72
|
-
})
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
Notes:
|
|
79
|
-
- A view-once sent from a phone can first arrive as an empty stub (`key.isViewOnce === true`).
|
|
80
|
-
The library asks your phone and the sender to resend it, and the real message follows
|
|
81
|
-
through `messages.upsert` / `messages.update`.
|
|
82
|
-
- Don't open the view-once on your phone first, or it may no longer be served.
|
|
83
|
-
- If view-onces only ever arrive as empty stubs, link with an Android browser identity
|
|
84
|
-
(`browser: Browsers.android('Chrome')`) instead of Mac/Chrome.
|
|
@@ -178,6 +178,8 @@ function decodeMessageNode(stanza, meId, meLid) {
|
|
|
178
178
|
...(senderPnValue ? { senderPn: senderPnValue } : {}),
|
|
179
179
|
...(participant ? { participant } : {}),
|
|
180
180
|
...(participantPnValue ? { participantPn: participantPnValue } : {}),
|
|
181
|
+
...(senderPnValue && (0, WABinary_1.isLidUser)(chatId) ? { remoteJidAlt: senderPnValue } : {}),
|
|
182
|
+
...(participantPnValue && participant && (0, WABinary_1.isLidUser)(participant) ? { participantAlt: participantPnValue } : {}),
|
|
181
183
|
...(participantLidValue ? { participantLid: participantLidValue } : {}),
|
|
182
184
|
...(msgType === 'newsletter' && stanza.attrs.server_id ? { server_id: stanza.attrs.server_id } : {})
|
|
183
185
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "savage-baileys",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Savage Baileys — WhatsApp Web API WebSocket library with full view-once support. No telemetry, no auto-follow, no automatic remote calls.",
|
|
5
|
+
"icon": "https://raw.githubusercontent.com/tysavage163/savage-baileys/main/assets/logo.jpg",
|
|
5
6
|
"main": "lib/index.js",
|
|
6
7
|
"types": "lib/index.d.ts",
|
|
7
8
|
"homepage": "https://github.com/tysavage163/savage-baileys#readme",
|