@dilxzcode/bails 2.0.3

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.
Files changed (101) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +200 -0
  3. package/WAProto/index.js +169661 -0
  4. package/engine-requirements.js +10 -0
  5. package/lib/Defaults/baileys-version.json +3 -0
  6. package/lib/Defaults/index.js +147 -0
  7. package/lib/Defaults/phonenumber-mcc.json +223 -0
  8. package/lib/Signal/Group/ciphertext-message.js +15 -0
  9. package/lib/Signal/Group/group-session-builder.js +64 -0
  10. package/lib/Signal/Group/group_cipher.js +96 -0
  11. package/lib/Signal/Group/index.js +57 -0
  12. package/lib/Signal/Group/keyhelper.js +55 -0
  13. package/lib/Signal/Group/queue-job.js +57 -0
  14. package/lib/Signal/Group/sender-chain-key.js +34 -0
  15. package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
  16. package/lib/Signal/Group/sender-key-message.js +69 -0
  17. package/lib/Signal/Group/sender-key-name.js +51 -0
  18. package/lib/Signal/Group/sender-key-record.js +53 -0
  19. package/lib/Signal/Group/sender-key-state.js +99 -0
  20. package/lib/Signal/Group/sender-message-key.js +29 -0
  21. package/lib/Signal/libsignal.js +174 -0
  22. package/lib/Socket/Client/abstract-socket-client.js +13 -0
  23. package/lib/Socket/Client/index.js +19 -0
  24. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  25. package/lib/Socket/Client/web-socket-client.js +62 -0
  26. package/lib/Socket/business.js +260 -0
  27. package/lib/Socket/chats.js +1002 -0
  28. package/lib/Socket/groups.js +317 -0
  29. package/lib/Socket/handel.js +637 -0
  30. package/lib/Socket/index.js +11 -0
  31. package/lib/Socket/messages-recv.js +1110 -0
  32. package/lib/Socket/messages-send.js +831 -0
  33. package/lib/Socket/newsletter.js +434 -0
  34. package/lib/Socket/registration.js +166 -0
  35. package/lib/Socket/socket.js +665 -0
  36. package/lib/Socket/usync.js +70 -0
  37. package/lib/Store/index.js +10 -0
  38. package/lib/Store/make-cache-manager-store.js +83 -0
  39. package/lib/Store/make-in-memory-store.js +427 -0
  40. package/lib/Store/make-ordered-dictionary.js +81 -0
  41. package/lib/Store/object-repository.js +27 -0
  42. package/lib/Types/Auth.js +2 -0
  43. package/lib/Types/Call.js +2 -0
  44. package/lib/Types/Chat.js +4 -0
  45. package/lib/Types/Contact.js +2 -0
  46. package/lib/Types/Events.js +2 -0
  47. package/lib/Types/GroupMetadata.js +2 -0
  48. package/lib/Types/Label.js +27 -0
  49. package/lib/Types/LabelAssociation.js +9 -0
  50. package/lib/Types/Message.js +9 -0
  51. package/lib/Types/Newsletter.js +38 -0
  52. package/lib/Types/Product.js +2 -0
  53. package/lib/Types/Signal.js +2 -0
  54. package/lib/Types/Socket.js +2 -0
  55. package/lib/Types/State.js +2 -0
  56. package/lib/Types/USync.js +2 -0
  57. package/lib/Types/index.js +42 -0
  58. package/lib/Utils/auth-utils.js +206 -0
  59. package/lib/Utils/baileys-event-stream.js +63 -0
  60. package/lib/Utils/business.js +234 -0
  61. package/lib/Utils/chat-utils.js +729 -0
  62. package/lib/Utils/crypto.js +151 -0
  63. package/lib/Utils/decode-wa-message.js +198 -0
  64. package/lib/Utils/event-buffer.js +514 -0
  65. package/lib/Utils/generics.js +498 -0
  66. package/lib/Utils/history.js +96 -0
  67. package/lib/Utils/index.js +33 -0
  68. package/lib/Utils/link-preview.js +93 -0
  69. package/lib/Utils/logger.js +7 -0
  70. package/lib/Utils/lt-hash.js +51 -0
  71. package/lib/Utils/make-mutex.js +43 -0
  72. package/lib/Utils/messages-media.js +819 -0
  73. package/lib/Utils/messages.js +819 -0
  74. package/lib/Utils/noise-handler.js +155 -0
  75. package/lib/Utils/process-message.js +321 -0
  76. package/lib/Utils/signal.js +153 -0
  77. package/lib/Utils/use-multi-file-auth-state.js +119 -0
  78. package/lib/Utils/validate-connection.js +229 -0
  79. package/lib/WABinary/constants.js +40 -0
  80. package/lib/WABinary/decode.js +252 -0
  81. package/lib/WABinary/encode.js +265 -0
  82. package/lib/WABinary/generic-utils.js +198 -0
  83. package/lib/WABinary/index.js +21 -0
  84. package/lib/WABinary/jid-utils.js +62 -0
  85. package/lib/WABinary/types.js +2 -0
  86. package/lib/WAM/BinaryInfo.js +13 -0
  87. package/lib/WAM/constants.js +15350 -0
  88. package/lib/WAM/encode.js +155 -0
  89. package/lib/WAM/index.js +19 -0
  90. package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
  91. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
  92. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
  93. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
  94. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -0
  95. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -0
  96. package/lib/WAUSync/Protocols/index.js +20 -0
  97. package/lib/WAUSync/USyncQuery.js +89 -0
  98. package/lib/WAUSync/USyncUser.js +26 -0
  99. package/lib/WAUSync/index.js +19 -0
  100. package/lib/index.js +40 -0
  101. package/package.json +112 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 z4phdev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,200 @@
1
+ <p align="center">
2
+ <img src="https://a.top4top.io/p_37287xrhs1.jpg" width="250"/>
3
+ </p>
4
+
5
+ <h1 align="center">WhatsApp Baileys</h1>
6
+
7
+ ---
8
+
9
+ WhatsApp Baileys is an open-source library designed to help developers build automation solutions and integrations with WhatsApp efficiently and directly. Using websocket technology without the need for a browser, this library supports a wide range of features such as message management, chat handling, group administration, as well as interactive messages and action buttons for a more dynamic user experience.
10
+
11
+ Actively developed and maintained, baileys continuously receives updates to enhance stability and performance. One of the main focuses is to improve the pairing and authentication processes to be more stable and secure. Pairing features can be customized with your own codes, making the process more reliable and less prone to interruptions.
12
+
13
+ This library is highly suitable for building business bots, chat automation systems, customer service solutions, and various other communication automation applications that require high stability and comprehensive features. With a lightweight and modular design, baileys is easy to integrate into different systems and platforms.
14
+
15
+ ---
16
+
17
+ ### Main Features and Advantages
18
+
19
+ - Supports automatic and custom pairing processes
20
+ - Fixes previous pairing issues that often caused failures or disconnections
21
+ - Supports interactive messages, action buttons, and dynamic menus
22
+ - Efficient automatic session management for reliable operation
23
+ - Compatible with the latest multi-device features from WhatsApp
24
+ - Lightweight, stable, and easy to integrate into various systems
25
+ - Suitable for developing bots, automation, and complete communication solutions
26
+ - Comprehensive documentation and example codes to facilitate development
27
+
28
+ ---
29
+
30
+ ## Development Status
31
+
32
+ This repository is under active development.
33
+ Updates are focused on maintaining compatibility with recent WhatsApp changes, improving connection stability, and refining internal logic related to pairing and session persistence.
34
+
35
+ Most changes are incremental and aimed at long-running stability rather than experimental features.
36
+
37
+ ---
38
+
39
+ ## Getting Started
40
+
41
+ Begin by installing the library via your preferred package manager, then follow the provided configuration guide. You can also utilize the ready-made example codes to understand how the features work. Use session storage and interactive messaging features to build complete, stable solutions tailored to your business or project needs.
42
+
43
+ ---
44
+
45
+ ### Contact Creator
46
+
47
+ For questions, support, or collaboration inquiries, feel free to contact the developer through the following platforms:
48
+
49
+ - **Telegram**: [Telegram Contact](https://t.me/dilxzcode)
50
+ - **Channel**: [Channel WhatsApp](https://whatsapp.com/channel/0029VanRJcU7NoaADR1oyb2v)
51
+
52
+ We aim to provide timely responses and professional assistance for all inquiries. Your support and interest are highly appreciated.
53
+
54
+ ---
55
+
56
+ ### Contributors Outside The Baileys Code
57
+ We would like to express our sincere appreciation to all contributors who have supported and helped improve this project.
58
+
59
+ <table>
60
+ <tr>
61
+ <td align="center">
62
+ <a href="https://github.com/dilxzcode">
63
+ <img src="https://github.com/dilxzcode.png" width="80px;" style="border-radius:50%;" alt="Contributor"/>
64
+ <br />
65
+ <sub><b>DilxzCode</b></sub>
66
+ </a>
67
+ </td>
68
+ <td align="center">
69
+ <a href="https://github.com/z4phdev">
70
+ <img src="https://github.com/z4phdev.png" width="80px;" style="border-radius:50%;" alt="Developer"/>
71
+ <br />
72
+ <sub><b>z4phdev</b></sub>
73
+ </a>
74
+ </td>
75
+ <td align="center">
76
+ <a href="https://github.com/kiuur">
77
+ <img src="https://github.com/kiuur.png" width="80px;" style="border-radius:50%;" alt="Contributor"/>
78
+ <br />
79
+ <sub><b>KyuuRzy</b></sub>
80
+ </a>
81
+ </td>
82
+ </tr>
83
+ </table>
84
+
85
+
86
+ ---
87
+
88
+ ## How To Usage?
89
+ ```json
90
+ "dependencies": {
91
+ "@whiskeysockets/baileys": "github:dilxzcode/bails"
92
+ }
93
+ ```
94
+ ## Import
95
+ ```javascript
96
+ const {
97
+ default: makeWASocket
98
+ } = require("@whiskeysockets/baileys");
99
+ ```
100
+
101
+ ---
102
+ # How To Connect To Whatsapp
103
+ ## With QR Code
104
+ ```javascript
105
+ const client = makeWASocket({
106
+ browser: ["Ubuntu", "Chrome", "20.0.0"],
107
+ printQRInTerminal: true
108
+ });
109
+ ```
110
+
111
+ ## Connect With Number
112
+ ```javascript
113
+ const {
114
+ default: makeWASocket,
115
+ fetchLatestWAWebVersion
116
+ } = require("@whiskeysockets/baileys");
117
+
118
+ const client = makeWASocket({
119
+ browser: ["Ubuntu", "Chrome", "20.0.0"],
120
+ printQRInTerminal: false,
121
+ version: fetchLatestWAWebVersion()
122
+ });
123
+
124
+ const number = "628XXXXXXXXX";
125
+ const code = await client.requestPairingCode(number.trim());
126
+
127
+ console.log("Pairing Code:", code);
128
+ ```
129
+
130
+ # Sending messages
131
+
132
+ ## send orderMessage
133
+ ```javascript
134
+ const fs = require('fs');
135
+ const nameImg = fs.readFileSync('./Image');
136
+
137
+ await client.sendMessage(m.chat, {
138
+ thumbnail: nameImg,
139
+ message: "Example order message",
140
+ orderTitle: "Example Order",
141
+ totalAmount1000: 8888,
142
+ totalCurrencyCode: "IDR"
143
+ }, { quoted: m });
144
+ ```
145
+
146
+ ## send pollResultSnapshotMessage
147
+ ```javascript
148
+ await client.sendMessage(m.chat, {
149
+ pollResultMessage: {
150
+ name: "Example Poll Result",
151
+ options: [
152
+ { optionName: "Option A" },
153
+ { optionName: "Option B" }
154
+ ],
155
+ newsletter: {
156
+ newsletterName: "Example Newsletter",
157
+ newsletterJid: "1@newsletter"
158
+ }
159
+ }
160
+ });
161
+ ```
162
+
163
+ ## send productMessage
164
+ ```javascript
165
+ await client.relayMessage(m.chat, {
166
+ productMessage: {
167
+ title: "Example Product",
168
+ description: "Product description example",
169
+ thumbnail: { url: "./example.jpg" },
170
+ productId: "PRODUCT_ID",
171
+ retailerId: "RETAILER_ID",
172
+ url: "https://example.com",
173
+ body: "Product body text",
174
+ footer: "Example footer",
175
+ buttons: [
176
+ {
177
+ name: "cta_url",
178
+ buttonParamsJson: JSON.stringify({
179
+ display_text: "Open Link",
180
+ url: "https://example.com"
181
+ })
182
+ }
183
+ ],
184
+ priceAmount1000: 50000,
185
+ currencyCode: "IDR"
186
+ }
187
+ });
188
+ ```
189
+
190
+ ## Thanks For Support
191
+ ```javascript
192
+ const credits = {
193
+ creator: "dilxzcode",
194
+ reference: "kiuur",
195
+ reference: "yuukey"
196
+ };
197
+
198
+ module.exports = credits;
199
+ ```
200
+