dtec-bail 1.0.7 → 1.0.9
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/LICENSE +1 -1
- package/README.md +454 -29
- package/engine-requirements.js +4 -13
- 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 → luxu.d.ts} +51 -37
- package/lib/Socket/luxu.js +591 -0
- package/lib/Socket/messages-send.js +121 -100
- package/lib/Socket/newsletter.js +132 -96
- package/lib/Socket/socket.js +10 -16
- 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 +4 -10
- package/lib/temp +1 -0
- package/package.json +12 -21
- package/lib/@Danu'Zz +0 -1
- package/lib/Socket/dugong.js +0 -484
- package/lib/WAUSync/index.d.ts +0 -3
|
@@ -49,6 +49,9 @@ exports.isJidGroup = isJidGroup;
|
|
|
49
49
|
const isJidStatusBroadcast = (jid) => jid === 'status@broadcast';
|
|
50
50
|
exports.isJidStatusBroadcast = isJidStatusBroadcast;
|
|
51
51
|
/** is the jid the newsletter */
|
|
52
|
+
const isJidNewsletter = (jid) => jid?.endsWith('@newsletter')
|
|
53
|
+
exports.isJidNewsletter = isJidNewsletter;
|
|
54
|
+
|
|
52
55
|
const isJidNewsLetter = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('newsletter'));
|
|
53
56
|
exports.isJidNewsLetter = isJidNewsLetter;
|
|
54
57
|
const jidNormalizedUser = (jid) => {
|
package/lib/index.js
CHANGED
|
@@ -2,15 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
const chalk = require("chalk");
|
|
4
4
|
|
|
5
|
-
console.log(chalk.
|
|
6
|
-
console.log(chalk.
|
|
7
|
-
console.log(chalk.
|
|
8
|
-
console.log(chalk.whiteBright(" Hi, thank you for using my modified Baileys ^-^ "));
|
|
9
|
-
console.log(chalk.cyan("Developer: ") + chalk.greenBright("@DanuZz"));
|
|
10
|
-
console.log(chalk.gray("═" + "═".repeat(50) + "═\n"));
|
|
11
|
-
const latestUpdate = new Date("2026-01-23");
|
|
12
|
-
console.log(chalk.yellowBright("🆕 Latest update: ") + chalk.whiteBright(latestUpdate.toLocaleDateString()));
|
|
13
|
-
console.log(chalk.gray("═" + "═".repeat(50) + "═\n"));
|
|
5
|
+
console.log(chalk.whiteBright("\n• Modified Baileys by Yasas Dileepa"));
|
|
6
|
+
console.log(chalk.cyan("• Author: ") + chalk.greenBright("@Dileepa"));
|
|
7
|
+
console.log(chalk.gray("------------------------------\n"));
|
|
14
8
|
|
|
15
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
10
|
if (k2 === undefined) k2 = k;
|
|
@@ -42,4 +36,4 @@ __exportStar(require("./WABinary"), exports);
|
|
|
42
36
|
__exportStar(require("./WAM"), exports);
|
|
43
37
|
__exportStar(require("./WAUSync"), exports);
|
|
44
38
|
|
|
45
|
-
exports.default = Socket_1.default;
|
|
39
|
+
exports.default = Socket_1.default;
|
package/lib/temp
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
DEW CODERS OFC
|
package/package.json
CHANGED
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtec-bail",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "WhatsApp
|
|
3
|
+
"version": "1.0.9",
|
|
4
|
+
"description": "WhatsApp Modified By yasas",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"whatsapp",
|
|
7
|
-
"dtec",
|
|
8
|
-
"baileys",
|
|
9
|
-
"whatsapp-web",
|
|
10
|
-
"whatsapp-chat",
|
|
11
|
-
"whatsapp-group",
|
|
12
|
-
"whatsapp-bot",
|
|
13
|
-
"automation",
|
|
14
|
-
"js-whatsapp",
|
|
15
|
-
"whatsapp-api",
|
|
16
|
-
"baileys-mod",
|
|
17
|
-
"botwa",
|
|
18
|
-
"danuzz"
|
|
6
|
+
"whatsapp-baileys","baileys","Yasas", "Dileepa"
|
|
19
7
|
],
|
|
20
|
-
"homepage": "https://
|
|
8
|
+
"homepage": "https://yasasdileepa.site",
|
|
21
9
|
"repository": {
|
|
22
|
-
"url": "https://
|
|
10
|
+
"url": "https://yasasdileepa.site"
|
|
23
11
|
},
|
|
24
12
|
"license": "MIT",
|
|
25
|
-
"author": "Yasas
|
|
13
|
+
"author": "Yasas",
|
|
26
14
|
"main": "lib/index.js",
|
|
27
15
|
"types": "lib/index.d.ts",
|
|
28
16
|
"files": [
|
|
@@ -57,7 +45,7 @@
|
|
|
57
45
|
"futoin-hkdf": "^1.5.1",
|
|
58
46
|
"libphonenumber-js": "^1.10.20",
|
|
59
47
|
"lodash": "^4.17.21",
|
|
60
|
-
"libsignal": "
|
|
48
|
+
"libsignal": "github:tenka-san/libsignal-node",
|
|
61
49
|
"music-metadata": "^7.12.3",
|
|
62
50
|
"node-cache": "^5.1.2",
|
|
63
51
|
"node-fetch": "^2.6.1",
|
|
@@ -81,7 +69,7 @@
|
|
|
81
69
|
"open": "^8.4.2",
|
|
82
70
|
"qrcode-terminal": "^0.12.0",
|
|
83
71
|
"release-it": "^15.10.3",
|
|
84
|
-
"sharp": "^0.
|
|
72
|
+
"sharp": "^0.30.5",
|
|
85
73
|
"ts-jest": "^27.0.3",
|
|
86
74
|
"ts-node": "^10.8.1",
|
|
87
75
|
"typedoc": "^0.24.7",
|
|
@@ -92,7 +80,7 @@
|
|
|
92
80
|
"jimp": "^0.16.1",
|
|
93
81
|
"link-preview-js": "^3.0.0",
|
|
94
82
|
"qrcode-terminal": "^0.12.0",
|
|
95
|
-
"sharp": "^0.
|
|
83
|
+
"sharp": "^0.32.2"
|
|
96
84
|
},
|
|
97
85
|
"peerDependenciesMeta": {
|
|
98
86
|
"jimp": {
|
|
@@ -111,5 +99,8 @@
|
|
|
111
99
|
"packageManager": "yarn@1.22.19",
|
|
112
100
|
"engines": {
|
|
113
101
|
"node": ">=20.0.0"
|
|
102
|
+
},
|
|
103
|
+
"bugs": {
|
|
104
|
+
"url": "https://github.com/dew-coders/Dew-Baileys/issues"
|
|
114
105
|
}
|
|
115
106
|
}
|
package/lib/@Danu'Zz
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/lib/Socket/dugong.js
DELETED
|
@@ -1,484 +0,0 @@
|
|
|
1
|
-
// "kikyy dugonggg", ah dejavu (r)
|
|
2
|
-
// tanggal 14 agustus 2025 makassar
|
|
3
|
-
// telegram: @tskiofc & @kyuucode
|
|
4
|
-
|
|
5
|
-
const WAProto = require('../../WAProto').proto;
|
|
6
|
-
const crypto = require('crypto');
|
|
7
|
-
const Utils_1 = require("../Utils");
|
|
8
|
-
|
|
9
|
-
class kikyy {
|
|
10
|
-
constructor(utils, waUploadToServer, relayMessageFn) {
|
|
11
|
-
this.utils = utils;
|
|
12
|
-
this.relayMessage = relayMessageFn
|
|
13
|
-
this.waUploadToServer = waUploadToServer;
|
|
14
|
-
|
|
15
|
-
this.bail = {
|
|
16
|
-
generateWAMessageContent: this.utils.generateWAMessageContent || Utils_1.generateWAMessageContent,
|
|
17
|
-
generateMessageID: Utils_1.generateMessageID,
|
|
18
|
-
getContentType: (msg) => Object.keys(msg.message || {})[0]
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
detectType(content) {
|
|
23
|
-
if (content.requestPaymentMessage) return 'PAYMENT';
|
|
24
|
-
if (content.productMessage) return 'PRODUCT';
|
|
25
|
-
if (content.interactiveMessage) return 'INTERACTIVE';
|
|
26
|
-
if (content.albumMessage) return 'ALBUM';
|
|
27
|
-
if (content.eventMessage) return 'EVENT';
|
|
28
|
-
if (content.pollResultMessage) return 'POLL_RESULT';
|
|
29
|
-
if (content.groupStatusMessage) return 'GROUP_STORY';
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async handlePayment(content, quoted) {
|
|
34
|
-
const data = content.requestPaymentMessage;
|
|
35
|
-
let notes = {};
|
|
36
|
-
|
|
37
|
-
if (data.sticker?.stickerMessage) {
|
|
38
|
-
notes = {
|
|
39
|
-
stickerMessage: {
|
|
40
|
-
...data.sticker.stickerMessage,
|
|
41
|
-
contextInfo: {
|
|
42
|
-
stanzaId: quoted?.key?.id,
|
|
43
|
-
participant: quoted?.key?.participant || content.sender,
|
|
44
|
-
quotedMessage: quoted?.message
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
} else if (data.note) {
|
|
49
|
-
notes = {
|
|
50
|
-
extendedTextMessage: {
|
|
51
|
-
text: data.note,
|
|
52
|
-
contextInfo: {
|
|
53
|
-
stanzaId: quoted?.key?.id,
|
|
54
|
-
participant: quoted?.key?.participant || content.sender,
|
|
55
|
-
quotedMessage: quoted?.message
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
requestPaymentMessage: WAProto.Message.RequestPaymentMessage.fromObject({
|
|
63
|
-
expiryTimestamp: data.expiry || 0,
|
|
64
|
-
amount1000: data.amount || 0,
|
|
65
|
-
currencyCodeIso4217: data.currency || "IDR",
|
|
66
|
-
requestFrom: data.from || "0@s.whatsapp.net",
|
|
67
|
-
noteMessage: notes,
|
|
68
|
-
background: data.background ?? {
|
|
69
|
-
id: "DEFAULT",
|
|
70
|
-
placeholderArgb: 0xFFF0F0F0
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
async handleProduct(content, jid, quoted) {
|
|
77
|
-
const {
|
|
78
|
-
title,
|
|
79
|
-
description,
|
|
80
|
-
thumbnail,
|
|
81
|
-
productId,
|
|
82
|
-
retailerId,
|
|
83
|
-
url,
|
|
84
|
-
body = "",
|
|
85
|
-
footer = "",
|
|
86
|
-
buttons = [],
|
|
87
|
-
priceAmount1000 = null,
|
|
88
|
-
currencyCode = "IDR"
|
|
89
|
-
} = content.productMessage;
|
|
90
|
-
|
|
91
|
-
let productImage;
|
|
92
|
-
|
|
93
|
-
if (Buffer.isBuffer(thumbnail)) {
|
|
94
|
-
const { imageMessage } = await this.utils.generateWAMessageContent(
|
|
95
|
-
{ image: thumbnail },
|
|
96
|
-
{ upload: this.waUploadToServer }
|
|
97
|
-
);
|
|
98
|
-
productImage = imageMessage;
|
|
99
|
-
} else if (typeof thumbnail === 'object' && thumbnail.url) {
|
|
100
|
-
const { imageMessage } = await this.utils.generateWAMessageContent(
|
|
101
|
-
{ image: { url: thumbnail.url }},
|
|
102
|
-
{ upload: this.waUploadToServer }
|
|
103
|
-
);
|
|
104
|
-
productImage = imageMessage;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return {
|
|
108
|
-
viewOnceMessage: {
|
|
109
|
-
message: {
|
|
110
|
-
interactiveMessage: {
|
|
111
|
-
body: { text: body },
|
|
112
|
-
footer: { text: footer },
|
|
113
|
-
header: {
|
|
114
|
-
title,
|
|
115
|
-
hasMediaAttachment: true,
|
|
116
|
-
productMessage: {
|
|
117
|
-
product: {
|
|
118
|
-
productImage,
|
|
119
|
-
productId,
|
|
120
|
-
title,
|
|
121
|
-
description,
|
|
122
|
-
currencyCode,
|
|
123
|
-
priceAmount1000,
|
|
124
|
-
retailerId,
|
|
125
|
-
url,
|
|
126
|
-
productImageCount: 1
|
|
127
|
-
},
|
|
128
|
-
businessOwnerJid: "0@s.whatsapp.net"
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
nativeFlowMessage: { buttons }
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
async handleInteractive(content, jid, quoted) {
|
|
139
|
-
const {
|
|
140
|
-
title,
|
|
141
|
-
footer,
|
|
142
|
-
thumbnail,
|
|
143
|
-
image,
|
|
144
|
-
video,
|
|
145
|
-
document,
|
|
146
|
-
mimetype,
|
|
147
|
-
fileName,
|
|
148
|
-
jpegThumbnail,
|
|
149
|
-
contextInfo,
|
|
150
|
-
externalAdReply,
|
|
151
|
-
buttons = [],
|
|
152
|
-
nativeFlowMessage,
|
|
153
|
-
header
|
|
154
|
-
} = content.interactiveMessage;
|
|
155
|
-
|
|
156
|
-
let media = null;
|
|
157
|
-
let mediaType = null;
|
|
158
|
-
|
|
159
|
-
if (thumbnail) {
|
|
160
|
-
media = await this.utils.prepareWAMessageMedia(
|
|
161
|
-
{ image: { url: thumbnail } },
|
|
162
|
-
{ upload: this.waUploadToServer }
|
|
163
|
-
);
|
|
164
|
-
mediaType = 'image';
|
|
165
|
-
} else if (image) {
|
|
166
|
-
if (typeof image === 'object' && image.url) {
|
|
167
|
-
media = await this.utils.prepareWAMessageMedia(
|
|
168
|
-
{ image: { url: image.url } },
|
|
169
|
-
{ upload: this.waUploadToServer }
|
|
170
|
-
);
|
|
171
|
-
} else {
|
|
172
|
-
media = await this.utils.prepareWAMessageMedia(
|
|
173
|
-
{ image: image },
|
|
174
|
-
{ upload: this.waUploadToServer }
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
mediaType = 'image';
|
|
178
|
-
} else if (video) {
|
|
179
|
-
if (typeof video === 'object' && video.url) {
|
|
180
|
-
media = await this.utils.prepareWAMessageMedia(
|
|
181
|
-
{ video: { url: video.url } },
|
|
182
|
-
{ upload: this.waUploadToServer }
|
|
183
|
-
);
|
|
184
|
-
} else {
|
|
185
|
-
media = await this.utils.prepareWAMessageMedia(
|
|
186
|
-
{ video: video },
|
|
187
|
-
{ upload: this.waUploadToServer }
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
mediaType = 'video';
|
|
191
|
-
} else if (document) {
|
|
192
|
-
let documentPayload = {
|
|
193
|
-
document: document
|
|
194
|
-
};
|
|
195
|
-
if (jpegThumbnail) {
|
|
196
|
-
if (typeof jpegThumbnail === 'object' && jpegThumbnail.url) {
|
|
197
|
-
documentPayload.jpegThumbnail = { url: jpegThumbnail.url };
|
|
198
|
-
} else {
|
|
199
|
-
documentPayload.jpegThumbnail = jpegThumbnail;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
media = await this.utils.prepareWAMessageMedia(
|
|
204
|
-
documentPayload,
|
|
205
|
-
{ upload: this.waUploadToServer }
|
|
206
|
-
);
|
|
207
|
-
if (fileName) {
|
|
208
|
-
media.documentMessage.fileName = fileName;
|
|
209
|
-
}
|
|
210
|
-
if (mimetype) {
|
|
211
|
-
media.documentMessage.mimetype = mimetype;
|
|
212
|
-
}
|
|
213
|
-
mediaType = 'document';
|
|
214
|
-
}
|
|
215
|
-
let interactiveMessage = {
|
|
216
|
-
body: { text: title || "" },
|
|
217
|
-
footer: { text: footer || "" }
|
|
218
|
-
};
|
|
219
|
-
if (buttons && buttons.length > 0) {
|
|
220
|
-
interactiveMessage.nativeFlowMessage = {
|
|
221
|
-
buttons: buttons
|
|
222
|
-
};
|
|
223
|
-
if (nativeFlowMessage) {
|
|
224
|
-
interactiveMessage.nativeFlowMessage = {
|
|
225
|
-
...interactiveMessage.nativeFlowMessage,
|
|
226
|
-
...nativeFlowMessage
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
} else if (nativeFlowMessage) {
|
|
230
|
-
interactiveMessage.nativeFlowMessage = nativeFlowMessage;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
if (media) {
|
|
234
|
-
interactiveMessage.header = {
|
|
235
|
-
title: header || "",
|
|
236
|
-
hasMediaAttachment: true,
|
|
237
|
-
...media
|
|
238
|
-
};
|
|
239
|
-
} else {
|
|
240
|
-
interactiveMessage.header = {
|
|
241
|
-
title: header || "",
|
|
242
|
-
hasMediaAttachment: false
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
let finalContextInfo = {};
|
|
247
|
-
if (contextInfo) {
|
|
248
|
-
finalContextInfo = {
|
|
249
|
-
mentionedJid: contextInfo.mentionedJid || [],
|
|
250
|
-
forwardingScore: contextInfo.forwardingScore || 0,
|
|
251
|
-
isForwarded: contextInfo.isForwarded || false,
|
|
252
|
-
...contextInfo
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
if (externalAdReply) {
|
|
257
|
-
finalContextInfo.externalAdReply = {
|
|
258
|
-
title: externalAdReply.title || "",
|
|
259
|
-
body: externalAdReply.body || "",
|
|
260
|
-
mediaType: externalAdReply.mediaType || 1,
|
|
261
|
-
thumbnailUrl: externalAdReply.thumbnailUrl || "",
|
|
262
|
-
mediaUrl: externalAdReply.mediaUrl || "",
|
|
263
|
-
sourceUrl: externalAdReply.sourceUrl || "",
|
|
264
|
-
showAdAttribution: externalAdReply.showAdAttribution || false,
|
|
265
|
-
renderLargerThumbnail: externalAdReply.renderLargerThumbnail || false,
|
|
266
|
-
...externalAdReply
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
if (Object.keys(finalContextInfo).length > 0) {
|
|
271
|
-
interactiveMessage.contextInfo = finalContextInfo;
|
|
272
|
-
}
|
|
273
|
-
return {
|
|
274
|
-
interactiveMessage: interactiveMessage
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
async handleAlbum(content, jid, quoted) {
|
|
279
|
-
const array = content.albumMessage;
|
|
280
|
-
const album = await this.utils.generateWAMessageFromContent(jid, {
|
|
281
|
-
messageContextInfo: {
|
|
282
|
-
messageSecret: crypto.randomBytes(32),
|
|
283
|
-
},
|
|
284
|
-
albumMessage: {
|
|
285
|
-
expectedImageCount: array.filter((a) => a.hasOwnProperty("image")).length,
|
|
286
|
-
expectedVideoCount: array.filter((a) => a.hasOwnProperty("video")).length,
|
|
287
|
-
},
|
|
288
|
-
}, {
|
|
289
|
-
userJid: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
|
|
290
|
-
quoted,
|
|
291
|
-
upload: this.waUploadToServer
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
await this.relayMessage(jid, album.message, {
|
|
295
|
-
messageId: album.key.id,
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
for (let content of array) {
|
|
299
|
-
const img = await this.utils.generateWAMessage(jid, content, {
|
|
300
|
-
upload: this.waUploadToServer,
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
img.message.messageContextInfo = {
|
|
304
|
-
messageSecret: crypto.randomBytes(32),
|
|
305
|
-
messageAssociation: {
|
|
306
|
-
associationType: 1,
|
|
307
|
-
parentMessageKey: album.key,
|
|
308
|
-
},
|
|
309
|
-
participant: "0@s.whatsapp.net",
|
|
310
|
-
remoteJid: "status@broadcast",
|
|
311
|
-
forwardingScore: 99999,
|
|
312
|
-
isForwarded: true,
|
|
313
|
-
mentionedJid: [jid],
|
|
314
|
-
starred: true,
|
|
315
|
-
labels: ["Y", "Important"],
|
|
316
|
-
isHighlighted: true,
|
|
317
|
-
businessMessageForwardInfo: {
|
|
318
|
-
businessOwnerJid: jid,
|
|
319
|
-
},
|
|
320
|
-
dataSharingContext: {
|
|
321
|
-
showMmDisclosure: true,
|
|
322
|
-
},
|
|
323
|
-
};
|
|
324
|
-
|
|
325
|
-
img.message.forwardedNewsletterMessageInfo = {
|
|
326
|
-
newsletterJid: "0@newsletter",
|
|
327
|
-
serverMessageId: 1,
|
|
328
|
-
newsletterName: `WhatsApp`,
|
|
329
|
-
contentType: 1,
|
|
330
|
-
timestamp: new Date().toISOString(),
|
|
331
|
-
senderName: "kikyy dugonggg",
|
|
332
|
-
content: "Text Message",
|
|
333
|
-
priority: "high",
|
|
334
|
-
status: "sent",
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
img.message.disappearingMode = {
|
|
338
|
-
initiator: 3,
|
|
339
|
-
trigger: 4,
|
|
340
|
-
initiatorDeviceJid: jid,
|
|
341
|
-
initiatedByExternalService: true,
|
|
342
|
-
initiatedByUserDevice: true,
|
|
343
|
-
initiatedBySystem: true,
|
|
344
|
-
initiatedByServer: true,
|
|
345
|
-
initiatedByAdmin: true,
|
|
346
|
-
initiatedByUser: true,
|
|
347
|
-
initiatedByApp: true,
|
|
348
|
-
initiatedByBot: true,
|
|
349
|
-
initiatedByMe: true,
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
await this.relayMessage(jid, img.message, {
|
|
353
|
-
messageId: img.key.id,
|
|
354
|
-
quoted: {
|
|
355
|
-
key: {
|
|
356
|
-
remoteJid: album.key.remoteJid,
|
|
357
|
-
id: album.key.id,
|
|
358
|
-
fromMe: true,
|
|
359
|
-
participant: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
|
|
360
|
-
},
|
|
361
|
-
message: album.message,
|
|
362
|
-
},
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
return album;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
async handleEvent(content, jid, quoted) {
|
|
369
|
-
const eventData = content.eventMessage;
|
|
370
|
-
|
|
371
|
-
const msg = await this.utils.generateWAMessageFromContent(jid, {
|
|
372
|
-
viewOnceMessage: {
|
|
373
|
-
message: {
|
|
374
|
-
messageContextInfo: {
|
|
375
|
-
deviceListMetadata: {},
|
|
376
|
-
deviceListMetadataVersion: 2,
|
|
377
|
-
messageSecret: crypto.randomBytes(32),
|
|
378
|
-
supportPayload: JSON.stringify({
|
|
379
|
-
version: 2,
|
|
380
|
-
is_ai_message: true,
|
|
381
|
-
should_show_system_message: true,
|
|
382
|
-
ticket_id: crypto.randomBytes(16).toString('hex')
|
|
383
|
-
})
|
|
384
|
-
},
|
|
385
|
-
eventMessage: {
|
|
386
|
-
contextInfo: {
|
|
387
|
-
mentionedJid: [jid],
|
|
388
|
-
participant: jid,
|
|
389
|
-
remoteJid: "status@broadcast",
|
|
390
|
-
forwardedNewsletterMessageInfo: {
|
|
391
|
-
newsletterName: "shenvn.",
|
|
392
|
-
newsletterJid: "120363297591152843@newsletter",
|
|
393
|
-
serverMessageId: 1
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
isCanceled: eventData.isCanceled || false,
|
|
397
|
-
name: eventData.name,
|
|
398
|
-
description: eventData.description,
|
|
399
|
-
location: eventData.location || {
|
|
400
|
-
degreesLatitude: 0,
|
|
401
|
-
degreesLongitude: 0,
|
|
402
|
-
name: "Location"
|
|
403
|
-
},
|
|
404
|
-
joinLink: eventData.joinLink || '',
|
|
405
|
-
startTime: typeof eventData.startTime === 'string' ? parseInt(eventData.startTime) : eventData.startTime || Date.now(),
|
|
406
|
-
endTime: typeof eventData.endTime === 'string' ? parseInt(eventData.endTime) : eventData.endTime || Date.now() + 3600000,
|
|
407
|
-
extraGuestsAllowed: eventData.extraGuestsAllowed !== false
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
}, { quoted });
|
|
412
|
-
|
|
413
|
-
await this.relayMessage(jid, msg.message, {
|
|
414
|
-
messageId: msg.key.id
|
|
415
|
-
});
|
|
416
|
-
return msg;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
async handlePollResult(content, jid, quoted) {
|
|
420
|
-
const pollData = content.pollResultMessage;
|
|
421
|
-
|
|
422
|
-
const msg = await this.utils.generateWAMessageFromContent(jid, {
|
|
423
|
-
pollResultSnapshotMessage: {
|
|
424
|
-
name: pollData.name,
|
|
425
|
-
pollVotes: pollData.pollVotes.map(vote => ({
|
|
426
|
-
optionName: vote.optionName,
|
|
427
|
-
optionVoteCount: typeof vote.optionVoteCount === 'number'
|
|
428
|
-
? vote.optionVoteCount.toString()
|
|
429
|
-
: vote.optionVoteCount
|
|
430
|
-
}))
|
|
431
|
-
}
|
|
432
|
-
}, {
|
|
433
|
-
userJid: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
|
|
434
|
-
quoted
|
|
435
|
-
});
|
|
436
|
-
|
|
437
|
-
await this.relayMessage(jid, msg.message, {
|
|
438
|
-
messageId: msg.key.id
|
|
439
|
-
});
|
|
440
|
-
|
|
441
|
-
return msg;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
async handleGroupStory(content, jid, quoted) {
|
|
445
|
-
const storyData = content.groupStatusMessage;
|
|
446
|
-
let waMsgContent;
|
|
447
|
-
|
|
448
|
-
if (storyData.message) {
|
|
449
|
-
waMsgContent = storyData;
|
|
450
|
-
} else {
|
|
451
|
-
if (typeof this.bail?.generateWAMessageContent === "function") {
|
|
452
|
-
waMsgContent = await this.bail.generateWAMessageContent(storyData, {
|
|
453
|
-
upload: this.waUploadToServer
|
|
454
|
-
});
|
|
455
|
-
} else if (typeof this.utils?.generateWAMessageContent === "function") {
|
|
456
|
-
waMsgContent = await this.utils.generateWAMessageContent(storyData, {
|
|
457
|
-
upload: this.waUploadToServer
|
|
458
|
-
});
|
|
459
|
-
} else if (typeof this.utils?.prepareMessageContent === "function") {
|
|
460
|
-
waMsgContent = await this.utils.prepareMessageContent(storyData, {
|
|
461
|
-
upload: this.waUploadToServer
|
|
462
|
-
});
|
|
463
|
-
} else {
|
|
464
|
-
waMsgContent = await Utils_1.generateWAMessageContent(storyData, {
|
|
465
|
-
upload: this.waUploadToServer
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
let msg = {
|
|
471
|
-
message: {
|
|
472
|
-
groupStatusMessageV2: {
|
|
473
|
-
message: waMsgContent.message || waMsgContent
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
};
|
|
477
|
-
|
|
478
|
-
return await this.relayMessage(jid, msg.message, {
|
|
479
|
-
messageId: this.bail.generateMessageID()
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
module.exports = kikyy;
|
package/lib/WAUSync/index.d.ts
DELETED