baileyz 1.0.4 → 1.0.6
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 +134 -0
- package/lib/@Danu'Zz +1 -0
- package/lib/Defaults/constants.js +74 -0
- package/lib/Defaults/media.js +48 -0
- package/lib/Socket/chats.js +15 -28
- package/lib/Socket/{dugong.d.ts → dxz.d.ts} +51 -37
- package/lib/Socket/dxz.js +591 -0
- package/lib/Socket/messages-send.js +16 -12
- package/lib/Socket/socket.js +115 -160
- package/lib/Utils/generics.js +1 -1
- package/lib/Utils/messages-media.js +835 -545
- package/lib/Utils/messages.js +1571 -497
- package/lib/WABinary/jid-utils.js +3 -0
- package/lib/index.js +1 -1
- package/package.json +1 -3
- package/lib/Socket/dugong.js +0 -484
- package/lib/WAUSync/index.d.ts +0 -3
package/README.md
CHANGED
|
@@ -94,10 +94,142 @@ pnpm add baileyz
|
|
|
94
94
|
|
|
95
95
|
---
|
|
96
96
|
|
|
97
|
+
| Category | Description |
|
|
98
|
+
|---|---|
|
|
99
|
+
|channels | Seamlessly send messages to WhatsApp Channels. |
|
|
100
|
+
| 🖱️ Buttons | Create interactive messages with button options and quick replies. |
|
|
101
|
+
| 🖼️ Albums | Send grouped images or videos as an album (carousel-like format). |
|
|
102
|
+
| 👤 LID Grouping | Handle group operations using the latest @lid addressing style. |
|
|
103
|
+
| 🤖 AI Message Style | Add a stylized “AI” icon to messages. |
|
|
104
|
+
| 📷 HD Profile Pics | Upload full-size profile pictures without cropping. |
|
|
105
|
+
| 🔐 Pairing Code | Generate custom alphanumeric pairing codes. |
|
|
106
|
+
| 🛠️ Dev Experience | Reduced noise from logs with optimized libsignal printouts. |
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
97
110
|
## 🔧 API Reference
|
|
98
111
|
|
|
99
112
|
### Utility Functions
|
|
100
113
|
|
|
114
|
+
## 🚀 Features & Usage
|
|
115
|
+
|
|
116
|
+
### 📬 Newsletter Control
|
|
117
|
+
Manage WhatsApp Newsletters (Channels), from creation to message interactions.
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
// Create a newsletter
|
|
121
|
+
await sock.newsletterCreate("Mova Update");
|
|
122
|
+
|
|
123
|
+
// Update description
|
|
124
|
+
await sock.newsletterUpdateDescription(
|
|
125
|
+
"1234XXXX@newsletter",
|
|
126
|
+
"YOO updates come daily"
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
// React to a channel message
|
|
130
|
+
await sock.newsletterReactMessage(
|
|
131
|
+
"1234XXXX@newsletter",
|
|
132
|
+
"192",
|
|
133
|
+
"💜"
|
|
134
|
+
);
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
### 📌 Interactive Messaging
|
|
140
|
+
Send interactive messages using buttons to increase user engagement.
|
|
141
|
+
|
|
142
|
+
```js
|
|
143
|
+
const buttons = [
|
|
144
|
+
{ buttonId: "btn1", buttonText: { displayText: "Click Me" }, type: 1 },
|
|
145
|
+
{ buttonId: "btn2", buttonText: { displayText: "Visit Site" }, type: 1 }
|
|
146
|
+
];
|
|
147
|
+
|
|
148
|
+
await sock.sendMessage(id, {
|
|
149
|
+
text: "Choose one:",
|
|
150
|
+
footer: "Mova - Nest | Lk",
|
|
151
|
+
buttons,
|
|
152
|
+
headerType: 1
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
### 🖼️ Send Album
|
|
159
|
+
Send multiple media (images or videos) in a single album message.
|
|
160
|
+
|
|
161
|
+
```js
|
|
162
|
+
const media = [
|
|
163
|
+
{ image: { url: "https://example.com/pic1.jpg" } },
|
|
164
|
+
{ video: { url: "https://example.com/clip.mp4" } }
|
|
165
|
+
];
|
|
166
|
+
|
|
167
|
+
await sock.sendMessage(
|
|
168
|
+
id,
|
|
169
|
+
{ album: media, caption: "Memories 💫" }
|
|
170
|
+
);
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### 🔐 Custom Pairing Code
|
|
176
|
+
Pair a WhatsApp device using a custom code.
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
const code = await sock.requestPairingCode("94XXXXXXXX","THANKUU1");
|
|
180
|
+
|
|
181
|
+
console.log("Pairing Code:", code);
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
### 📊 Poll Creation
|
|
187
|
+
Create polls for quick voting in chats or groups.
|
|
188
|
+
|
|
189
|
+
```js
|
|
190
|
+
await sock.sendMessage(id, {
|
|
191
|
+
poll: {
|
|
192
|
+
name: "Favorite Color?",
|
|
193
|
+
values: ["Red", "Blue", "Green"],
|
|
194
|
+
selectableCount: 1
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
### 📍 Location Sharing
|
|
202
|
+
Share a location complete with coordinates and address.
|
|
203
|
+
|
|
204
|
+
```js
|
|
205
|
+
await sock.sendMessage(id, {
|
|
206
|
+
location: {
|
|
207
|
+
degreesLatitude: 37.422,
|
|
208
|
+
degreesLongitude: -122.084,
|
|
209
|
+
name: "Googleplex",
|
|
210
|
+
address: "1600 Amphitheatre Pkwy, Mountain View"
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
### 👥 Group Management
|
|
218
|
+
Manage WhatsApp groups: create groups, add members, and update descriptions.
|
|
219
|
+
|
|
220
|
+
```js
|
|
221
|
+
const group = await sock.groupCreate(
|
|
222
|
+
"My New Group",
|
|
223
|
+
[number1, number2]
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
await sock.groupAdd(group.id, [number3]);
|
|
227
|
+
await sock.groupUpdateDescription(
|
|
228
|
+
group.id,
|
|
229
|
+
"This is our awesome group!"
|
|
230
|
+
);
|
|
231
|
+
```
|
|
232
|
+
|
|
101
233
|
#### Get Newsletter/Channel ID
|
|
102
234
|
Extracts the ID from a WhatsApp channel URL.
|
|
103
235
|
|
|
@@ -106,6 +238,8 @@ const channelId = await sock.newsletterId('https://whatsapp.com/channel/CHANNEL_
|
|
|
106
238
|
console.log(channelId); // Outputs: CHANNEL_ID
|
|
107
239
|
```
|
|
108
240
|
|
|
241
|
+
---
|
|
242
|
+
|
|
109
243
|
#### Check Banned Number
|
|
110
244
|
Verifies if a JID (phone number) is banned.
|
|
111
245
|
|
package/lib/@Danu'Zz
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict"
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true })
|
|
4
|
+
|
|
5
|
+
const UNAUTHORIZED_CODES = [401, 403, 419]
|
|
6
|
+
|
|
7
|
+
const PHONENUMBER_MCC = require("./phonenumber-mcc.json")
|
|
8
|
+
|
|
9
|
+
const DEFAULT_ORIGIN = 'https://web.whatsapp.com'
|
|
10
|
+
|
|
11
|
+
const PHONE_CONNECTION_CB = 'CB:Pong'
|
|
12
|
+
|
|
13
|
+
const WA_ADV_ACCOUNT_SIG_PREFIX = Buffer.from([6, 0])
|
|
14
|
+
|
|
15
|
+
const WA_ADV_DEVICE_SIG_PREFIX = Buffer.from([6, 1])
|
|
16
|
+
|
|
17
|
+
const WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX = Buffer.from([6, 5])
|
|
18
|
+
|
|
19
|
+
const WA_ADV_HOSTED_DEVICE_SIG_PREFIX = Buffer.from([6, 6])
|
|
20
|
+
|
|
21
|
+
const WA_DEFAULT_EPHEMERAL = 7 * 24 * 60 * 60
|
|
22
|
+
|
|
23
|
+
const NOISE_MODE = 'Noise_XX_25519_AESGCM_SHA256\0\0\0\0'
|
|
24
|
+
|
|
25
|
+
const DICT_VERSION = 3
|
|
26
|
+
|
|
27
|
+
const KEY_BUNDLE_TYPE = Buffer.from([5])
|
|
28
|
+
|
|
29
|
+
const NOISE_WA_HEADER = Buffer.from([87, 65, 6, DICT_VERSION]) // last is "DICT_VERSION"
|
|
30
|
+
|
|
31
|
+
/** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */
|
|
32
|
+
const URL_REGEX = /https:\/\/(?![^:@\/\s]+:[^:@\/\s]+@)[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(:\d+)?(\/[^\s]*)?/g
|
|
33
|
+
|
|
34
|
+
const MIN_PREKEY_COUNT = 5
|
|
35
|
+
|
|
36
|
+
const INITIAL_PREKEY_COUNT = 812
|
|
37
|
+
|
|
38
|
+
const UPLOAD_TIMEOUT = 30000 // 30 seconds
|
|
39
|
+
|
|
40
|
+
const MIN_UPLOAD_INTERVAL = 5000 // seconds minimum between uploads
|
|
41
|
+
|
|
42
|
+
const WA_CERT_DETAILS = {
|
|
43
|
+
SERIAL: 0
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const DEFAULT_CACHE_TTLS = {
|
|
47
|
+
SIGNAL_STORE: 5 * 60,
|
|
48
|
+
MSG_RETRY: 60 * 60,
|
|
49
|
+
CALL_OFFER: 5 * 60,
|
|
50
|
+
USER_DEVICES: 5 * 60, // 5 minutes
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.exports = {
|
|
54
|
+
UNAUTHORIZED_CODES,
|
|
55
|
+
PHONENUMBER_MCC,
|
|
56
|
+
DEFAULT_ORIGIN,
|
|
57
|
+
PHONE_CONNECTION_CB,
|
|
58
|
+
WA_ADV_ACCOUNT_SIG_PREFIX,
|
|
59
|
+
WA_ADV_DEVICE_SIG_PREFIX,
|
|
60
|
+
WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX,
|
|
61
|
+
WA_ADV_HOSTED_DEVICE_SIG_PREFIX,
|
|
62
|
+
WA_DEFAULT_EPHEMERAL,
|
|
63
|
+
NOISE_MODE,
|
|
64
|
+
DICT_VERSION,
|
|
65
|
+
KEY_BUNDLE_TYPE,
|
|
66
|
+
NOISE_WA_HEADER,
|
|
67
|
+
URL_REGEX,
|
|
68
|
+
MIN_PREKEY_COUNT,
|
|
69
|
+
MIN_UPLOAD_INTERVAL,
|
|
70
|
+
INITIAL_PREKEY_COUNT,
|
|
71
|
+
UPLOAD_TIMEOUT,
|
|
72
|
+
WA_CERT_DETAILS,
|
|
73
|
+
DEFAULT_CACHE_TTLS
|
|
74
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict"
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true })
|
|
4
|
+
|
|
5
|
+
const MEDIA_PATH_MAP = {
|
|
6
|
+
image: '/mms/image',
|
|
7
|
+
video: '/mms/video',
|
|
8
|
+
document: '/mms/document',
|
|
9
|
+
audio: '/mms/audio',
|
|
10
|
+
sticker: '/mms/image',
|
|
11
|
+
'sticker-pack': '/mms/sticker',
|
|
12
|
+
'thumbnail-link': '/mms/image',
|
|
13
|
+
'product-catalog-image': '/product/image',
|
|
14
|
+
'md-app-state': '',
|
|
15
|
+
'md-msg-hist': '/mms/md-app-state',
|
|
16
|
+
'biz-cover-photo': '/pps/biz-cover-photo'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const MEDIA_HKDF_KEY_MAPPING = {
|
|
20
|
+
'audio': 'Audio',
|
|
21
|
+
'document': 'Document',
|
|
22
|
+
'gif': 'Video',
|
|
23
|
+
'image': 'Image',
|
|
24
|
+
'ppic': '',
|
|
25
|
+
'product': 'Image',
|
|
26
|
+
'ptt': 'Audio',
|
|
27
|
+
'video': 'Video',
|
|
28
|
+
'sticker': 'Image',
|
|
29
|
+
'sticker-pack': 'Sticker Pack',
|
|
30
|
+
'thumbnail-document': 'Document Thumbnail',
|
|
31
|
+
'thumbnail-image': 'Image Thumbnail',
|
|
32
|
+
'thumbnail-video': 'Video Thumbnail',
|
|
33
|
+
'thumbnail-link': 'Link Thumbnail',
|
|
34
|
+
'md-msg-hist': 'History',
|
|
35
|
+
'md-app-state': 'App State',
|
|
36
|
+
'product-catalog-image': '',
|
|
37
|
+
'payment-bg-image': 'Payment Background',
|
|
38
|
+
'ptv': 'Video',
|
|
39
|
+
'biz-cover-photo': 'Image'
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const MEDIA_KEYS = Object.keys(MEDIA_PATH_MAP)
|
|
43
|
+
|
|
44
|
+
module.exports = {
|
|
45
|
+
MEDIA_KEYS,
|
|
46
|
+
MEDIA_PATH_MAP,
|
|
47
|
+
MEDIA_HKDF_KEY_MAPPING
|
|
48
|
+
}
|
package/lib/Socket/chats.js
CHANGED
|
@@ -87,57 +87,44 @@ const makeChatsSocket = (config) => {
|
|
|
87
87
|
await privacyQuery('groupadd', value);
|
|
88
88
|
};
|
|
89
89
|
/** check whether your WhatsApp account is blocked or not */
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
92
|
-
throw new Error('enter
|
|
90
|
+
const checkStatusWA = async (phoneNumber) => {
|
|
91
|
+
if (!phoneNumber) {
|
|
92
|
+
throw new Error('enter number');
|
|
93
93
|
}
|
|
94
|
+
|
|
94
95
|
let resultData = {
|
|
95
96
|
isBanned: false,
|
|
96
97
|
isNeedOfficialWa: false,
|
|
97
|
-
number:
|
|
98
|
+
number: phoneNumber
|
|
98
99
|
};
|
|
99
|
-
|
|
100
|
-
let phoneNumber = jid;
|
|
101
|
-
if (phoneNumber.includes('@')) {
|
|
102
|
-
phoneNumber = phoneNumber.split('@')[0];
|
|
103
|
-
}
|
|
104
100
|
|
|
105
|
-
phoneNumber = phoneNumber.replace(/[^\d+]/g, '');
|
|
106
|
-
if (!phoneNumber.startsWith('+')) {
|
|
107
|
-
if (phoneNumber.startsWith('0')) {
|
|
108
|
-
phoneNumber = phoneNumber.substring(1);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (!phoneNumber.startsWith('62') && phoneNumber.length > 0) {
|
|
112
|
-
phoneNumber = '62' + phoneNumber;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (!phoneNumber.startsWith('+') && phoneNumber.length > 0) {
|
|
116
|
-
phoneNumber = '+' + phoneNumber;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
101
|
let formattedNumber = phoneNumber;
|
|
102
|
+
if (!formattedNumber.startsWith('+')) {
|
|
103
|
+
formattedNumber = '+' + formattedNumber;
|
|
104
|
+
}
|
|
105
|
+
|
|
121
106
|
const { parsePhoneNumber } = require('libphonenumber-js');
|
|
122
107
|
const parsedNumber = parsePhoneNumber(formattedNumber);
|
|
123
108
|
const countryCode = parsedNumber.countryCallingCode;
|
|
124
109
|
const nationalNumber = parsedNumber.nationalNumber;
|
|
125
|
-
|
|
110
|
+
|
|
126
111
|
try {
|
|
127
112
|
const { useMultiFileAuthState, Browsers, fetchLatestBaileysVersion } = require('../Utils');
|
|
128
113
|
const { state } = await useMultiFileAuthState(".npm");
|
|
129
114
|
const { version } = await fetchLatestBaileysVersion();
|
|
130
115
|
const { makeWASocket } = require('../Socket');
|
|
131
116
|
const pino = require("pino");
|
|
117
|
+
|
|
132
118
|
const sock = makeWASocket({
|
|
133
119
|
version,
|
|
134
120
|
auth: state,
|
|
135
|
-
browser:
|
|
121
|
+
browser: Browsers.ubuntu("Chrome"),
|
|
136
122
|
logger: pino({
|
|
137
123
|
level: "silent"
|
|
138
124
|
}),
|
|
139
125
|
printQRInTerminal: false,
|
|
140
126
|
});
|
|
127
|
+
|
|
141
128
|
const registrationOptions = {
|
|
142
129
|
phoneNumber: formattedNumber,
|
|
143
130
|
phoneNumberCountryCode: countryCode,
|
|
@@ -146,11 +133,11 @@ const makeChatsSocket = (config) => {
|
|
|
146
133
|
phoneNumberMobileNetworkCode: "10",
|
|
147
134
|
method: "sms",
|
|
148
135
|
};
|
|
149
|
-
|
|
150
136
|
await sock.requestRegistrationCode(registrationOptions);
|
|
151
137
|
if (sock.ws) {
|
|
152
138
|
sock.ws.close();
|
|
153
139
|
}
|
|
140
|
+
|
|
154
141
|
return JSON.stringify(resultData, null, 2);
|
|
155
142
|
} catch (err) {
|
|
156
143
|
if (err?.appeal_token) {
|
|
@@ -975,7 +962,7 @@ const makeChatsSocket = (config) => {
|
|
|
975
962
|
addChatLabel,
|
|
976
963
|
removeChatLabel,
|
|
977
964
|
addMessageLabel,
|
|
978
|
-
|
|
965
|
+
checkStatusWA,
|
|
979
966
|
removeMessageLabel,
|
|
980
967
|
star
|
|
981
968
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
// dugong.d.ts
|
|
2
1
|
import { proto } from '../../WAProto';
|
|
3
2
|
|
|
4
|
-
declare namespace
|
|
3
|
+
declare namespace imup {
|
|
5
4
|
interface MediaUploadOptions {
|
|
6
5
|
fileEncSha256?: Buffer;
|
|
7
6
|
mediaType?: string;
|
|
@@ -70,20 +69,20 @@ declare namespace kikyy {
|
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
interface InteractiveMessage {
|
|
73
|
-
header?: string;
|
|
74
72
|
title: string;
|
|
75
73
|
footer?: string;
|
|
76
74
|
thumbnail?: string;
|
|
77
75
|
image?: string | Buffer | { url: string };
|
|
78
76
|
video?: string | Buffer | { url: string };
|
|
79
|
-
document?:
|
|
77
|
+
document?: Buffer;
|
|
80
78
|
mimetype?: string;
|
|
81
79
|
fileName?: string;
|
|
82
|
-
jpegThumbnail?:
|
|
80
|
+
jpegThumbnail?: Buffer;
|
|
83
81
|
contextInfo?: {
|
|
84
82
|
mentionedJid?: string[];
|
|
85
83
|
forwardingScore?: number;
|
|
86
84
|
isForwarded?: boolean;
|
|
85
|
+
forwardedNewsletterMessageInfo?: proto.Message.ContextInfo.ForwardedNewsletterMessageInfo;
|
|
87
86
|
externalAdReply?: {
|
|
88
87
|
title?: string;
|
|
89
88
|
body?: string;
|
|
@@ -117,8 +116,8 @@ declare namespace kikyy {
|
|
|
117
116
|
}
|
|
118
117
|
|
|
119
118
|
interface AlbumItem {
|
|
120
|
-
image?:
|
|
121
|
-
video?:
|
|
119
|
+
image?: { url: string; caption?: string };
|
|
120
|
+
video?: { url: string; caption?: string };
|
|
122
121
|
}
|
|
123
122
|
|
|
124
123
|
interface EventMessageLocation {
|
|
@@ -146,9 +145,28 @@ declare namespace kikyy {
|
|
|
146
145
|
interface PollResultMessage {
|
|
147
146
|
name: string;
|
|
148
147
|
pollVotes: PollVote[];
|
|
148
|
+
newsletter?: {
|
|
149
|
+
newsletterName: string;
|
|
150
|
+
newsletterJid: string;
|
|
151
|
+
};
|
|
149
152
|
}
|
|
150
153
|
|
|
151
|
-
interface
|
|
154
|
+
interface StatusMentionMessage {
|
|
155
|
+
image?: { url: string } | string;
|
|
156
|
+
video?: { url: string } | string;
|
|
157
|
+
mentions: string[];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
interface OrderMessage {
|
|
161
|
+
thumbnail?: Buffer | string,
|
|
162
|
+
itemCount?: string | number,
|
|
163
|
+
message: string,
|
|
164
|
+
orderTitle: string,
|
|
165
|
+
totalAmount1000?: string | number,
|
|
166
|
+
totalCurrencyCode?: string
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
interface GroupStatus {
|
|
152
170
|
message?: any;
|
|
153
171
|
image?: string | Buffer | { url: string };
|
|
154
172
|
video?: string | Buffer | { url: string };
|
|
@@ -165,7 +183,8 @@ declare namespace kikyy {
|
|
|
165
183
|
albumMessage?: AlbumItem[];
|
|
166
184
|
eventMessage?: EventMessage;
|
|
167
185
|
pollResultMessage?: PollResultMessage;
|
|
168
|
-
|
|
186
|
+
statusMentionMessage?: StatusMentionMessage;
|
|
187
|
+
orderMessage?: OrderMessage;
|
|
169
188
|
sender?: string;
|
|
170
189
|
}
|
|
171
190
|
|
|
@@ -180,75 +199,70 @@ declare namespace kikyy {
|
|
|
180
199
|
generateWAMessageFromContent: (jid: string, content: any, options?: any) => Promise<any>;
|
|
181
200
|
generateWAMessage: (jid: string, content: any, options?: any) => Promise<any>;
|
|
182
201
|
generateMessageID: () => string;
|
|
183
|
-
prepareMessageContent?: (content: any, options?: any) => Promise<any>;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
interface BailUtils {
|
|
187
|
-
generateWAMessageContent?: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
|
|
188
|
-
generateMessageID: () => string;
|
|
189
|
-
getContentType: (msg: any) => string;
|
|
190
202
|
}
|
|
191
203
|
}
|
|
192
204
|
|
|
193
|
-
declare class
|
|
205
|
+
declare class imup {
|
|
194
206
|
constructor(
|
|
195
|
-
utils:
|
|
196
|
-
waUploadToServer:
|
|
207
|
+
utils: imup.Utils,
|
|
208
|
+
waUploadToServer: imup.WAMediaUploadFunction,
|
|
197
209
|
relayMessageFn?: (jid: string, content: any, options?: any) => Promise<any>
|
|
198
210
|
);
|
|
199
211
|
|
|
200
|
-
detectType(content:
|
|
212
|
+
detectType(content: imup.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | 'STATUS_MENTION' | 'ORDER' | null;
|
|
201
213
|
|
|
202
214
|
handlePayment(
|
|
203
|
-
content: { requestPaymentMessage:
|
|
215
|
+
content: { requestPaymentMessage: imup.PaymentMessage },
|
|
204
216
|
quoted?: proto.IWebMessageInfo
|
|
205
217
|
): Promise<{ requestPaymentMessage: proto.Message.RequestPaymentMessage }>;
|
|
206
218
|
|
|
207
219
|
handleProduct(
|
|
208
|
-
content: { productMessage:
|
|
220
|
+
content: { productMessage: imup.ProductMessage },
|
|
209
221
|
jid: string,
|
|
210
222
|
quoted?: proto.IWebMessageInfo
|
|
211
223
|
): Promise<{ viewOnceMessage: proto.Message.ViewOnceMessage }>;
|
|
212
224
|
|
|
213
225
|
handleInteractive(
|
|
214
|
-
content: { interactiveMessage:
|
|
226
|
+
content: { interactiveMessage: imup.InteractiveMessage },
|
|
215
227
|
jid: string,
|
|
216
228
|
quoted?: proto.IWebMessageInfo
|
|
217
229
|
): Promise<{ interactiveMessage: proto.Message.InteractiveMessage }>;
|
|
218
230
|
|
|
219
231
|
handleAlbum(
|
|
220
|
-
content: { albumMessage:
|
|
232
|
+
content: { albumMessage: imup.AlbumItem[] },
|
|
221
233
|
jid: string,
|
|
222
234
|
quoted?: proto.IWebMessageInfo
|
|
223
235
|
): Promise<any>;
|
|
224
236
|
|
|
225
237
|
handleEvent(
|
|
226
|
-
content: { eventMessage:
|
|
238
|
+
content: { eventMessage: imup.EventMessage },
|
|
227
239
|
jid: string,
|
|
228
240
|
quoted?: proto.IWebMessageInfo
|
|
229
241
|
): Promise<any>;
|
|
230
242
|
|
|
231
243
|
handlePollResult(
|
|
232
|
-
content: { pollResultMessage:
|
|
244
|
+
content: { pollResultMessage: imup.PollResultMessage },
|
|
233
245
|
jid: string,
|
|
234
246
|
quoted?: proto.IWebMessageInfo
|
|
235
247
|
): Promise<any>;
|
|
236
248
|
|
|
237
|
-
|
|
238
|
-
content: {
|
|
249
|
+
handleStMention(
|
|
250
|
+
content: { statusMentionMessage: imup.StatusMentionMessage },
|
|
239
251
|
jid: string,
|
|
240
252
|
quoted?: proto.IWebMessageInfo
|
|
241
253
|
): Promise<any>;
|
|
242
254
|
|
|
243
|
-
|
|
244
|
-
content:
|
|
245
|
-
|
|
255
|
+
handleOrderMessage(
|
|
256
|
+
content: { orderMessage: imup.OrderMessage },
|
|
257
|
+
jid: string,
|
|
258
|
+
quoted?: proto.IWebMessageInfo
|
|
259
|
+
): Promise<any>;
|
|
260
|
+
|
|
261
|
+
handleGroupStory(
|
|
262
|
+
content: { orderMessage: imup.GroupStatus },
|
|
263
|
+
jid: string,
|
|
264
|
+
quoted?: proto.IWebMessageInfo
|
|
246
265
|
): Promise<any>;
|
|
247
|
-
|
|
248
|
-
utils: kikyy.Utils;
|
|
249
|
-
relayMessage: (jid: string, content: any, options?: any) => Promise<any>;
|
|
250
|
-
waUploadToServer: kikyy.WAMediaUploadFunction;
|
|
251
|
-
bail: kikyy.BailUtils;
|
|
252
266
|
}
|
|
253
267
|
|
|
254
|
-
export =
|
|
268
|
+
export = imup;
|