@itsliaaa/baileys 0.1.20 → 0.1.21
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 +22 -22
- package/lib/Socket/messages-send.js +32 -28
- package/lib/Utils/rich-message-utils.js +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@itsliaaa/baileys)
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
|
-
|
|
6
|
+
Enhanced Baileys v7 with fixed newsletter media upload, plus support for interactive messages, albums, and more message types.
|
|
7
7
|
<br><br>
|
|
8
8
|
<a href="https://www.npmjs.com/package/@itsliaaa/baileys">
|
|
9
|
-
<img src="https://img.shields.io/npm/v/@itsliaaa/baileys?
|
|
9
|
+
<img src="https://img.shields.io/npm/v/@itsliaaa/baileys?style=for-the-badge&logo=npm"/>
|
|
10
10
|
</a>
|
|
11
11
|
<a href="https://www.npmjs.com/package/@itsliaaa/baileys">
|
|
12
|
-
<img src="https://img.shields.io/npm/dm/@itsliaaa/baileys?
|
|
12
|
+
<img src="https://img.shields.io/npm/dm/@itsliaaa/baileys?style=for-the-badge&logo=npm"/>
|
|
13
13
|
</a>
|
|
14
14
|
<a href="https://github.com/itsliaaa/baileys">
|
|
15
|
-
<img src="https://img.shields.io/github/stars/itsliaaa/baileys?
|
|
15
|
+
<img src="https://img.shields.io/github/stars/itsliaaa/baileys?style=for-the-badge&logo=github"/>
|
|
16
16
|
</a>
|
|
17
17
|
<a href="LICENSE">
|
|
18
|
-
<img src="https://img.shields.io/badge/license-MIT-blue?
|
|
18
|
+
<img src="https://img.shields.io/badge/license-MIT-blue?style=for-the-badge"/>
|
|
19
19
|
</a>
|
|
20
20
|
<a href="https://nodejs.org">
|
|
21
21
|
<img src="https://img.shields.io/badge/node-%3E%3D20-339933?logo=node.js&labelColor=green&logoColor=white&style=for-the-badge"/>
|
|
@@ -43,25 +43,25 @@ This fork designed for production use with a focus on clarity and safety:
|
|
|
43
43
|
- 🗃️ 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
44
|
|
|
45
45
|
#### 📨 Message Handling & Compatibility
|
|
46
|
-
- 👉🏻 Added support for sending [interactive messages](#-sending-interactive-messages) (buttons, lists, interactive,
|
|
46
|
+
- 👉🏻 Added support for sending [interactive messages](#-sending-interactive-messages) (buttons, lists, interactive, template, carousel).
|
|
47
47
|
- 📩 Expanded message support for:
|
|
48
|
-
- [
|
|
49
|
-
- [
|
|
50
|
-
- [
|
|
51
|
-
- [
|
|
52
|
-
- [
|
|
53
|
-
- [
|
|
54
|
-
- [
|
|
55
|
-
- [
|
|
56
|
-
- 📰 Simplified sending messages with ad
|
|
48
|
+
- 🖼️ [Album Message](#%EF%B8%8F-album-image--video)
|
|
49
|
+
- 👤 [Group Status Message](#4%EF%B8%8F⃣-group-status)
|
|
50
|
+
- 🎞️ [Status Mention Message](#%EF%B8%8F-status-mention)
|
|
51
|
+
- 📦 [Sticker Pack Message](#-sticker-pack)
|
|
52
|
+
- ✨ [Rich Response Message](#-rich-response) **[NEW]**
|
|
53
|
+
- 🧾 [Message with Code Blocks](#-message-with-code-block) **[NEW]**
|
|
54
|
+
- 📋 [Message with Table](#-message-with-table) **[NEW]**
|
|
55
|
+
- 💳 [Payment-related Message](#-sending-payment-messages) (payment requests, invites, orders, invoices).
|
|
56
|
+
- 📰 Simplified sending messages with ad thumbnail using [`externalAdReply`](#3%EF%B8%8F⃣-external-ad-reply), without requiring manual `contextInfo`.
|
|
57
57
|
|
|
58
58
|
#### 🧩 Additional Message Options
|
|
59
59
|
- 👁️ Added optional boolean flags for message handling:
|
|
60
|
-
- [`ai`](#1%EF%B8%8F⃣-ai-
|
|
61
|
-
- [`mentionAll`](#-mention) -
|
|
62
|
-
- [`ephemeral`](#2%EF%B8%8F⃣-ephemeral), [`groupStatus`](#4%EF%B8%8F⃣-group-status), [`viewOnceV2`](#8%EF%B8%8F⃣-view-once-v2), [`viewOnceV2Extension`](#9%EF%B8%8F⃣-view-once-v2-extension), [`interactiveAsTemplate`](#3%EF%B8%8F⃣-interactive) - Message wrappers
|
|
63
|
-
- [`secureMetaServiceLabel`](#6%EF%B8%8F⃣-secure-meta-service-label) - Secure meta service label on message
|
|
64
|
-
- [`raw`](#5%EF%B8%8F⃣-raw) - Build your message manually **(DO NOT USE FOR EXPLOITATION)**
|
|
60
|
+
- 🤖 [`ai`](#1%EF%B8%8F⃣-ai-icon) - AI icon on message
|
|
61
|
+
- 📣 [`mentionAll`](#-mention) - Mention all group participants without requiring their JIDs in `mentions` or `mentionedJid` **[NEW]**
|
|
62
|
+
- 🔧 [`ephemeral`](#2%EF%B8%8F⃣-ephemeral), [`groupStatus`](#4%EF%B8%8F⃣-group-status), [`viewOnceV2`](#8%EF%B8%8F⃣-view-once-v2), [`viewOnceV2Extension`](#9%EF%B8%8F⃣-view-once-v2-extension), [`interactiveAsTemplate`](#3%EF%B8%8F⃣-interactive) - Message wrappers
|
|
63
|
+
- 🔒 [`secureMetaServiceLabel`](#6%EF%B8%8F⃣-secure-meta-service-label) - Secure meta service label on message **[NEW]**
|
|
64
|
+
- 📄 [`raw`](#5%EF%B8%8F⃣-raw) - Build your message manually **(DO NOT USE FOR EXPLOITATION)**
|
|
65
65
|
|
|
66
66
|
> [!NOTE]
|
|
67
67
|
📄 This project is maintained with limited scope and is not intended to replace upstream Baileys.
|
|
@@ -872,7 +872,7 @@ sock.sendMessage(jid, {
|
|
|
872
872
|
|
|
873
873
|
#### 👁️ Other Message Options
|
|
874
874
|
|
|
875
|
-
##### 1️⃣ AI
|
|
875
|
+
##### 1️⃣ AI Icon
|
|
876
876
|
|
|
877
877
|
> [!NOTE]
|
|
878
878
|
It only works in private chat (`@s.whatsapp.net`).
|
|
@@ -882,7 +882,7 @@ sock.sendMessage(jid, {
|
|
|
882
882
|
image: {
|
|
883
883
|
url: './path/to/image.jpg'
|
|
884
884
|
},
|
|
885
|
-
caption: '🤖 AI
|
|
885
|
+
caption: '🤖 With AI icon!',
|
|
886
886
|
ai: true
|
|
887
887
|
}, {
|
|
888
888
|
quoted: message
|
|
@@ -28,36 +28,40 @@ export const makeMessagesSocket = (config) => {
|
|
|
28
28
|
const messageRetryManager = enableRecentMessageCache ? new MessageRetryManager(logger, maxMsgRetryCount) : null;
|
|
29
29
|
// Prevent race conditions in Signal session encryption by user
|
|
30
30
|
const encryptionMutex = makeKeyedMutex();
|
|
31
|
+
// Prevent race conditions in media connection refresh
|
|
32
|
+
const mediaConnMutex = makeKeyedMutex();
|
|
31
33
|
let mediaConn;
|
|
32
34
|
const refreshMediaConn = async (forceGet = false) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
35
|
+
return mediaConnMutex.mutex('media-conn', async () => {
|
|
36
|
+
const media = await mediaConn;
|
|
37
|
+
if (!media || forceGet || new Date().getTime() - media.fetchDate.getTime() > media.ttl * 1000) {
|
|
38
|
+
mediaConn = (async () => {
|
|
39
|
+
const result = await query({
|
|
40
|
+
tag: 'iq',
|
|
41
|
+
attrs: {
|
|
42
|
+
type: 'set',
|
|
43
|
+
xmlns: 'w:m',
|
|
44
|
+
to: S_WHATSAPP_NET
|
|
45
|
+
},
|
|
46
|
+
content: [{ tag: 'media_conn', attrs: {} }]
|
|
47
|
+
});
|
|
48
|
+
const mediaConnNode = getBinaryNodeChild(result, 'media_conn');
|
|
49
|
+
// TODO: explore full length of data that whatsapp provides
|
|
50
|
+
const node = {
|
|
51
|
+
hosts: getBinaryNodeChildren(mediaConnNode, 'host').map(({ attrs }) => ({
|
|
52
|
+
hostname: attrs.hostname,
|
|
53
|
+
maxContentLengthBytes: +attrs.maxContentLengthBytes
|
|
54
|
+
})),
|
|
55
|
+
auth: mediaConnNode.attrs.auth,
|
|
56
|
+
ttl: +mediaConnNode.attrs.ttl,
|
|
57
|
+
fetchDate: new Date()
|
|
58
|
+
};
|
|
59
|
+
logger.debug('fetched media conn');
|
|
60
|
+
return node;
|
|
61
|
+
})();
|
|
62
|
+
}
|
|
63
|
+
return mediaConn;
|
|
64
|
+
});
|
|
61
65
|
};
|
|
62
66
|
/**
|
|
63
67
|
* generic send receipt function
|
|
@@ -64,7 +64,7 @@ const RUST_KEYWORDS = new Set([
|
|
|
64
64
|
'where', 'while', 'async', 'await', 'dyn', 'abstract', 'become', 'box', 'do', 'final',
|
|
65
65
|
'macro', 'override', 'priv', 'typeof', 'unsized', 'virtual', 'yield'
|
|
66
66
|
]);
|
|
67
|
-
const NOOP = new Set([])
|
|
67
|
+
const NOOP = new Set([]);
|
|
68
68
|
export const LANGUAGE_KEYWORDS = {
|
|
69
69
|
css: CSS_KEYWORDS,
|
|
70
70
|
html: HTML_KEYWORDS,
|
|
@@ -154,7 +154,7 @@ const toUnified = (submessages) =>
|
|
|
154
154
|
})
|
|
155
155
|
});
|
|
156
156
|
export const prepareRichCodeBlock = ({ header, code, footer, language } = {}) => {
|
|
157
|
-
language ??= 'javascript'
|
|
157
|
+
language ??= 'javascript';
|
|
158
158
|
const submessages = [];
|
|
159
159
|
if (header) {
|
|
160
160
|
submessages.push({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itsliaaa/baileys",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.21",
|
|
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",
|
|
7
7
|
"scripts": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"p-queue": "^9.1.0",
|
|
49
49
|
"pino": "^9.6.0",
|
|
50
50
|
"protobufjs": "^7.5.4",
|
|
51
|
-
"whatsapp-rust-bridge": "
|
|
51
|
+
"whatsapp-rust-bridge": "0.5.3",
|
|
52
52
|
"ws": "^8.19.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|