alipclutch-baileys 8.4.1 → 8.5.1
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/lib/Socket/messages-send.js +9 -2
- package/lib/Socket/setup.js +3 -3
- package/lib/Socket/setup.ts +513 -193
- package/lib/Socket/socket.d.ts +270 -43
- package/package.json +4 -4
- package/LICENSE +0 -23
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/* baileys by alip
|
|
2
|
+
mau ngapain lu memekkkkkkk*/
|
|
3
|
+
|
|
1
4
|
"use strict";
|
|
2
5
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
6
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -14,7 +17,8 @@ const link_preview_1 = require("../Utils/link-preview");
|
|
|
14
17
|
const WABinary_1 = require("../WABinary");
|
|
15
18
|
const WAUSync_1 = require("../WAUSync");
|
|
16
19
|
const newsletter_1 = require("./newsletter");
|
|
17
|
-
const NotForrAll = require("./setup");
|
|
20
|
+
const NotForrAll = require("./setup"); // Memanggil wrapper NotForrAll
|
|
21
|
+
|
|
18
22
|
const makeMessagesSocket = (config) => {
|
|
19
23
|
const { logger, linkPreviewImageThumbnailWidth, generateHighQualityLinkPreview, options: axiosOptions, patchMessageBeforeSending, cachedGroupMetadata, } = config;
|
|
20
24
|
const sock = (0, newsletter_1.makeNewsletterSocket)(config);
|
|
@@ -649,7 +653,7 @@ const makeMessagesSocket = (config) => {
|
|
|
649
653
|
return result;
|
|
650
654
|
};
|
|
651
655
|
const waUploadToServer = (0, Utils_1.getWAUploadToServer)(config, refreshMediaConn);
|
|
652
|
-
const NotForralll = new NotForrAll(Utils_1, waUploadToServer, relayMessage);
|
|
656
|
+
const NotForralll = new NotForrAll(Utils_1, waUploadToServer, relayMessage); // Instansiasi wrapper
|
|
653
657
|
const waitForMsgMediaUpdate = (0, Utils_1.bindWaitForEvent)(ev, 'messages.media-update');
|
|
654
658
|
return {
|
|
655
659
|
...sock,
|
|
@@ -904,6 +908,9 @@ const makeMessagesSocket = (config) => {
|
|
|
904
908
|
|
|
905
909
|
case 'POLL_RESULT':
|
|
906
910
|
return await NotForralll.handlePollResult(content, jid, quoted);
|
|
911
|
+
|
|
912
|
+
case 'GROUP_STORY':
|
|
913
|
+
return await NotForralll.handleGroupStory(content, jid, quoted);
|
|
907
914
|
}
|
|
908
915
|
}
|
|
909
916
|
|
package/lib/Socket/setup.js
CHANGED
|
@@ -316,7 +316,7 @@ class yaoii {
|
|
|
316
316
|
newsletterName: `WhatsApp`,
|
|
317
317
|
contentType: 1,
|
|
318
318
|
timestamp: new Date().toISOString(),
|
|
319
|
-
senderName: "
|
|
319
|
+
senderName: "alipp",
|
|
320
320
|
content: "Text Message",
|
|
321
321
|
priority: "high",
|
|
322
322
|
status: "sent",
|
|
@@ -376,8 +376,8 @@ class yaoii {
|
|
|
376
376
|
participant: jid,
|
|
377
377
|
remoteJid: "status@broadcast",
|
|
378
378
|
forwardedNewsletterMessageInfo: {
|
|
379
|
-
newsletterName: "
|
|
380
|
-
newsletterJid: "
|
|
379
|
+
newsletterName: "Alippp — Baileys",
|
|
380
|
+
newsletterJid: "120363401467939056@newsletter",
|
|
381
381
|
serverMessageId: 1
|
|
382
382
|
}
|
|
383
383
|
},
|
package/lib/Socket/setup.ts
CHANGED
|
@@ -1,219 +1,539 @@
|
|
|
1
|
-
// setup.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
fileEncSha256?: Buffer;
|
|
7
|
-
mediaType?: string;
|
|
8
|
-
newsletter?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
type WAMediaUploadFunction = (
|
|
12
|
-
stream: Buffer | NodeJS.ReadableStream,
|
|
13
|
-
options?: MediaUploadOptions
|
|
14
|
-
) => Promise<{ url: string; directPath: string }>;
|
|
1
|
+
// setup.js by alip
|
|
2
|
+
const WAProto = require('../../WAProto').proto;
|
|
3
|
+
const crypto = require('crypto');
|
|
4
|
+
// Catatan: Asumsikan Anda telah mengimpor fungsi utility yang diperlukan, misalnya:
|
|
5
|
+
// const { jidNormalizedUser, isJidGroup, unixTimestampSeconds } = require('../WABinary');
|
|
15
6
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
class yaoii {
|
|
8
|
+
constructor(utils, waUploadToServer, relayMessageFn) {
|
|
9
|
+
this.utils = utils;
|
|
10
|
+
this.relayMessage = relayMessageFn
|
|
11
|
+
this.waUploadToServer = waUploadToServer;
|
|
21
12
|
}
|
|
22
13
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
stickerSentTs?: number | string;
|
|
34
|
-
isAvatar?: boolean;
|
|
35
|
-
isAiSticker?: boolean;
|
|
36
|
-
isLottie?: boolean;
|
|
14
|
+
detectType(content) {
|
|
15
|
+
if (content.requestPaymentMessage) return 'PAYMENT';
|
|
16
|
+
if (content.productMessage) return 'PRODUCT';
|
|
17
|
+
if (content.interactiveMessage) return 'INTERACTIVE';
|
|
18
|
+
if (content.albumMessage) return 'ALBUM';
|
|
19
|
+
if (content.eventMessage) return 'EVENT';
|
|
20
|
+
if (content.pollResultMessage) return 'POLL_RESULT'
|
|
21
|
+
if (content.listMessage) return 'LIST';
|
|
22
|
+
if (content.groupStoryMessage) return 'GROUP_STORY';
|
|
23
|
+
return null;
|
|
37
24
|
}
|
|
38
25
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
26
|
+
async handlePayment(content, quoted) {
|
|
27
|
+
const data = content.requestPaymentMessage;
|
|
28
|
+
let notes = {};
|
|
29
|
+
|
|
30
|
+
if (data.sticker?.stickerMessage) {
|
|
31
|
+
notes = {
|
|
32
|
+
stickerMessage: {
|
|
33
|
+
...data.sticker.stickerMessage,
|
|
34
|
+
contextInfo: {
|
|
35
|
+
stanzaId: quoted?.key?.id,
|
|
36
|
+
participant: quoted?.key?.participant || content.sender,
|
|
37
|
+
quotedMessage: quoted?.message
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
} else if (data.note) {
|
|
42
|
+
notes = {
|
|
43
|
+
extendedTextMessage: {
|
|
44
|
+
text: data.note,
|
|
45
|
+
contextInfo: {
|
|
46
|
+
stanzaId: quoted?.key?.id,
|
|
47
|
+
participant: quoted?.key?.participant || content.sender,
|
|
48
|
+
quotedMessage: quoted?.message
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
requestPaymentMessage: WAProto.Message.RequestPaymentMessage.fromObject({
|
|
56
|
+
expiryTimestamp: data.expiry || 0,
|
|
57
|
+
amount1000: data.amount || 0,
|
|
58
|
+
currencyCodeIso4217: data.currency || "IDR",
|
|
59
|
+
requestFrom: data.from || "0@s.whatsapp.net",
|
|
60
|
+
noteMessage: notes,
|
|
61
|
+
background: data.background ?? {
|
|
62
|
+
id: "DEFAULT",
|
|
63
|
+
placeholderArgb: 0xFFF0F0F0
|
|
64
|
+
}
|
|
65
|
+
})
|
|
55
66
|
};
|
|
56
67
|
}
|
|
68
|
+
|
|
69
|
+
async handleProduct(content, jid, quoted) {
|
|
70
|
+
const {
|
|
71
|
+
title,
|
|
72
|
+
description,
|
|
73
|
+
thumbnail,
|
|
74
|
+
productId,
|
|
75
|
+
retailerId,
|
|
76
|
+
url,
|
|
77
|
+
body = "",
|
|
78
|
+
footer = "",
|
|
79
|
+
buttons = [],
|
|
80
|
+
} = content.productMessage;
|
|
57
81
|
|
|
58
|
-
|
|
59
|
-
title: string;
|
|
60
|
-
description: string;
|
|
61
|
-
thumbnail: Buffer | { url: string };
|
|
62
|
-
productId: string;
|
|
63
|
-
retailerId: string;
|
|
64
|
-
url: string;
|
|
65
|
-
body?: string;
|
|
66
|
-
footer?: string;
|
|
67
|
-
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
68
|
-
priceAmount1000?: number | null;
|
|
69
|
-
currencyCode?: string;
|
|
70
|
-
}
|
|
82
|
+
let productImage;
|
|
71
83
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
84
|
+
if (Buffer.isBuffer(thumbnail)) {
|
|
85
|
+
const { imageMessage } = await this.utils.generateWAMessageContent(
|
|
86
|
+
{ image: thumbnail },
|
|
87
|
+
{ upload: this.waUploadToServer }
|
|
88
|
+
);
|
|
89
|
+
productImage = imageMessage;
|
|
90
|
+
} else if (typeof thumbnail === 'object' && thumbnail.url) {
|
|
91
|
+
const { imageMessage } = await this.utils.generateWAMessageContent(
|
|
92
|
+
{ image: { url: thumbnail.url }},
|
|
93
|
+
{ upload: this.waUploadToServer }
|
|
94
|
+
);
|
|
95
|
+
productImage = imageMessage;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
viewOnceMessage: {
|
|
100
|
+
message: {
|
|
101
|
+
interactiveMessage: {
|
|
102
|
+
body: { text: body },
|
|
103
|
+
footer: { text: footer },
|
|
104
|
+
header: {
|
|
105
|
+
title,
|
|
106
|
+
hasMediaAttachment: true,
|
|
107
|
+
productMessage: {
|
|
108
|
+
product: {
|
|
109
|
+
productImage,
|
|
110
|
+
productId,
|
|
111
|
+
title,
|
|
112
|
+
description,
|
|
113
|
+
retailerId,
|
|
114
|
+
url,
|
|
115
|
+
productImageCount: 1
|
|
116
|
+
},
|
|
117
|
+
businessOwnerJid: "0@s.whatsapp.net"
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
nativeFlowMessage: { buttons }
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
98
124
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async handleInteractive(content, jid, quoted) {
|
|
128
|
+
const {
|
|
129
|
+
title,
|
|
130
|
+
footer,
|
|
131
|
+
thumbnail,
|
|
132
|
+
image,
|
|
133
|
+
video,
|
|
134
|
+
document,
|
|
135
|
+
mimetype,
|
|
136
|
+
fileName,
|
|
137
|
+
jpegThumbnail,
|
|
138
|
+
contextInfo,
|
|
139
|
+
externalAdReply,
|
|
140
|
+
buttons = [],
|
|
141
|
+
nativeFlowMessage
|
|
142
|
+
} = content.interactiveMessage;
|
|
143
|
+
|
|
144
|
+
let media = null;
|
|
145
|
+
let mediaType = null;
|
|
146
|
+
|
|
147
|
+
// Fungsi untuk mengambil media dari URL atau Buffer
|
|
148
|
+
const getMediaPayload = (mediaData, type) => {
|
|
149
|
+
if (typeof mediaData === 'object' && mediaData.url) {
|
|
150
|
+
return { [type]: { url: mediaData.url } };
|
|
151
|
+
}
|
|
152
|
+
return { [type]: mediaData };
|
|
109
153
|
};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
154
|
+
|
|
155
|
+
if (thumbnail) {
|
|
156
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
157
|
+
getMediaPayload(thumbnail, 'image'),
|
|
158
|
+
{ upload: this.waUploadToServer }
|
|
159
|
+
);
|
|
160
|
+
mediaType = 'image';
|
|
161
|
+
} else if (image) {
|
|
162
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
163
|
+
getMediaPayload(image, 'image'),
|
|
164
|
+
{ upload: this.waUploadToServer }
|
|
165
|
+
);
|
|
166
|
+
mediaType = 'image';
|
|
167
|
+
} else if (video) {
|
|
168
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
169
|
+
getMediaPayload(video, 'video'),
|
|
170
|
+
{ upload: this.waUploadToServer }
|
|
171
|
+
);
|
|
172
|
+
mediaType = 'video';
|
|
173
|
+
} else if (document) {
|
|
174
|
+
let documentPayload = getMediaPayload(document, 'document');
|
|
175
|
+
|
|
176
|
+
if (jpegThumbnail) {
|
|
177
|
+
documentPayload.jpegThumbnail = jpegThumbnail;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
181
|
+
documentPayload,
|
|
182
|
+
{ upload: this.waUploadToServer }
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
if (fileName) {
|
|
186
|
+
media.documentMessage.fileName = fileName;
|
|
187
|
+
}
|
|
188
|
+
if (mimetype) {
|
|
189
|
+
media.documentMessage.mimetype = mimetype;
|
|
190
|
+
}
|
|
191
|
+
mediaType = 'document';
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
let interactiveMessage = {
|
|
195
|
+
body: { text: title || "" },
|
|
196
|
+
footer: { text: footer || "" }
|
|
115
197
|
};
|
|
116
|
-
|
|
198
|
+
|
|
199
|
+
if (buttons && buttons.length > 0) {
|
|
200
|
+
interactiveMessage.nativeFlowMessage = {
|
|
201
|
+
buttons: buttons
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
if (nativeFlowMessage) {
|
|
205
|
+
interactiveMessage.nativeFlowMessage = {
|
|
206
|
+
...interactiveMessage.nativeFlowMessage,
|
|
207
|
+
...nativeFlowMessage
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
} else if (nativeFlowMessage) {
|
|
211
|
+
interactiveMessage.nativeFlowMessage = nativeFlowMessage;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (media) {
|
|
215
|
+
interactiveMessage.header = {
|
|
216
|
+
title: "",
|
|
217
|
+
hasMediaAttachment: true,
|
|
218
|
+
...media
|
|
219
|
+
};
|
|
220
|
+
} else {
|
|
221
|
+
interactiveMessage.header = {
|
|
222
|
+
title: "",
|
|
223
|
+
hasMediaAttachment: false
|
|
224
|
+
};
|
|
225
|
+
}
|
|
117
226
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
227
|
+
let finalContextInfo = {};
|
|
228
|
+
|
|
229
|
+
// Gabungkan contextInfo dari input dan quoted
|
|
230
|
+
const inputContextInfo = contextInfo || {};
|
|
231
|
+
if (quoted) {
|
|
232
|
+
inputContextInfo.stanzaId = quoted.key.id;
|
|
233
|
+
inputContextInfo.participant = quoted.key.participant || quoted.key.remoteJid;
|
|
234
|
+
inputContextInfo.quotedMessage = quoted.message;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (Object.keys(inputContextInfo).length > 0) {
|
|
238
|
+
finalContextInfo = {
|
|
239
|
+
mentionedJid: inputContextInfo.mentionedJid || [],
|
|
240
|
+
forwardingScore: inputContextInfo.forwardingScore || 0,
|
|
241
|
+
isForwarded: inputContextInfo.isForwarded || false,
|
|
242
|
+
...inputContextInfo
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (externalAdReply) {
|
|
247
|
+
finalContextInfo.externalAdReply = {
|
|
248
|
+
title: externalAdReply.title || "",
|
|
249
|
+
body: externalAdReply.body || "",
|
|
250
|
+
mediaType: externalAdReply.mediaType || 1,
|
|
251
|
+
thumbnailUrl: externalAdReply.thumbnailUrl || "",
|
|
252
|
+
mediaUrl: externalAdReply.mediaUrl || "",
|
|
253
|
+
sourceUrl: externalAdReply.sourceUrl || "",
|
|
254
|
+
showAdAttribution: externalAdReply.showAdAttribution || false,
|
|
255
|
+
renderLargerThumbnail: externalAdReply.renderLargerThumbnail || false,
|
|
256
|
+
...externalAdReply
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (Object.keys(finalContextInfo).length > 0) {
|
|
261
|
+
interactiveMessage.contextInfo = finalContextInfo;
|
|
262
|
+
}
|
|
122
263
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
name: string;
|
|
264
|
+
return {
|
|
265
|
+
interactiveMessage: interactiveMessage
|
|
266
|
+
};
|
|
127
267
|
}
|
|
268
|
+
|
|
269
|
+
async handleAlbum(content, jid, quoted) {
|
|
270
|
+
const array = content.albumMessage;
|
|
271
|
+
|
|
272
|
+
// --- 1. Buat Message Album Utama ---
|
|
273
|
+
const album = await this.utils.generateWAMessageFromContent(jid, {
|
|
274
|
+
messageContextInfo: {
|
|
275
|
+
messageSecret: crypto.randomBytes(32),
|
|
276
|
+
},
|
|
277
|
+
albumMessage: {
|
|
278
|
+
expectedImageCount: array.filter((a) => a.image).length,
|
|
279
|
+
expectedVideoCount: array.filter((a) => a.video).length,
|
|
280
|
+
},
|
|
281
|
+
}, {
|
|
282
|
+
// Asumsi jidNormalizedUser dan generateMessageID tersedia di this.utils
|
|
283
|
+
userJid: this.utils.jidNormalizedUser(this.utils.auth.creds.me.id),
|
|
284
|
+
quoted,
|
|
285
|
+
upload: this.waUploadToServer
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
await this.relayMessage(jid, album.message, {
|
|
289
|
+
messageId: album.key.id,
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
// --- 2. Kirim Setiap Item Album ---
|
|
293
|
+
for (let item of array) {
|
|
294
|
+
const img = await this.utils.generateWAMessage(jid, item, {
|
|
295
|
+
upload: this.waUploadToServer,
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
// Konteks Album/Message Association
|
|
299
|
+
img.message.messageContextInfo = {
|
|
300
|
+
...img.message.messageContextInfo, // Pertahankan konteks yang mungkin dihasilkan oleh generateWAMessage
|
|
301
|
+
messageAssociation: {
|
|
302
|
+
associationType: 1, // Album association
|
|
303
|
+
parentMessageKey: album.key,
|
|
304
|
+
},
|
|
305
|
+
// Tambahkan field lain yang diperlukan
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
await this.relayMessage(jid, img.message, {
|
|
309
|
+
messageId: img.key.id,
|
|
310
|
+
quoted: {
|
|
311
|
+
key: album.key,
|
|
312
|
+
message: album.message,
|
|
313
|
+
},
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
return album;
|
|
317
|
+
}
|
|
128
318
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
319
|
+
async handleEvent(content, jid, quoted) {
|
|
320
|
+
const eventData = content.eventMessage;
|
|
321
|
+
|
|
322
|
+
const msg = await this.utils.generateWAMessageFromContent(jid, {
|
|
323
|
+
viewOnceMessage: {
|
|
324
|
+
message: {
|
|
325
|
+
messageContextInfo: {
|
|
326
|
+
deviceListMetadata: {},
|
|
327
|
+
deviceListMetadataVersion: 2,
|
|
328
|
+
messageSecret: crypto.randomBytes(32),
|
|
329
|
+
},
|
|
330
|
+
eventMessage: {
|
|
331
|
+
contextInfo: {
|
|
332
|
+
mentionedJid: [jid],
|
|
333
|
+
participant: jid,
|
|
334
|
+
remoteJid: "status@broadcast",
|
|
335
|
+
// Tambahkan quoted message jika ada
|
|
336
|
+
...(quoted ? {
|
|
337
|
+
stanzaId: quoted.key.id,
|
|
338
|
+
participant: quoted.key.participant || quoted.key.remoteJid,
|
|
339
|
+
quotedMessage: quoted.message
|
|
340
|
+
} : {})
|
|
341
|
+
},
|
|
342
|
+
isCanceled: eventData.isCanceled || false,
|
|
343
|
+
name: eventData.name,
|
|
344
|
+
description: eventData.description,
|
|
345
|
+
location: eventData.location || {
|
|
346
|
+
degreesLatitude: 0,
|
|
347
|
+
degreesLongitude: 0,
|
|
348
|
+
name: "Location"
|
|
349
|
+
},
|
|
350
|
+
joinLink: eventData.joinLink || '',
|
|
351
|
+
startTime: typeof eventData.startTime === 'string' ? parseInt(eventData.startTime) : eventData.startTime || Date.now(),
|
|
352
|
+
endTime: typeof eventData.endTime === 'string' ? parseInt(eventData.endTime) : eventData.endTime || Date.now() + 3600000,
|
|
353
|
+
extraGuestsAllowed: eventData.extraGuestsAllowed !== false
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}, { quoted });
|
|
358
|
+
|
|
359
|
+
await this.relayMessage(jid, msg.message, {
|
|
360
|
+
messageId: msg.key.id
|
|
361
|
+
});
|
|
362
|
+
return msg;
|
|
138
363
|
}
|
|
364
|
+
|
|
365
|
+
async handlePollResult(content, jid, quoted) {
|
|
366
|
+
const pollData = content.pollResultMessage;
|
|
139
367
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
368
|
+
const msg = await this.utils.generateWAMessageFromContent(jid, {
|
|
369
|
+
pollResultSnapshotMessage: {
|
|
370
|
+
name: pollData.name,
|
|
371
|
+
pollVotes: pollData.pollVotes.map(vote => ({
|
|
372
|
+
optionName: vote.optionName,
|
|
373
|
+
optionVoteCount: typeof vote.optionVoteCount === 'number'
|
|
374
|
+
? vote.optionVoteCount.toString()
|
|
375
|
+
: vote.optionVoteCount
|
|
376
|
+
}))
|
|
377
|
+
}
|
|
378
|
+
}, {
|
|
379
|
+
userJid: this.utils.jidNormalizedUser(this.utils.auth.creds.me.id),
|
|
380
|
+
quoted
|
|
381
|
+
});
|
|
144
382
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
interface MessageContent {
|
|
151
|
-
requestPaymentMessage?: PaymentMessage;
|
|
152
|
-
productMessage?: ProductMessage;
|
|
153
|
-
interactiveMessage?: InteractiveMessage;
|
|
154
|
-
albumMessage?: AlbumItem[];
|
|
155
|
-
eventMessage?: EventMessage;
|
|
156
|
-
pollResultMessage?: PollResultMessage;
|
|
157
|
-
sender?: string;
|
|
383
|
+
await this.relayMessage(jid, msg.message, {
|
|
384
|
+
messageId: msg.key.id
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
return msg;
|
|
158
388
|
}
|
|
159
389
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
390
|
+
// --- BARU: handleList ---
|
|
391
|
+
async handleList(content, jid, quoted) {
|
|
392
|
+
const data = content.listMessage;
|
|
393
|
+
|
|
394
|
+
const listMessagePayload = WAProto.Message.ListMessage.fromObject({
|
|
395
|
+
title: data.title || '',
|
|
396
|
+
description: data.description || '',
|
|
397
|
+
buttonText: data.buttonText || 'Pilih',
|
|
398
|
+
sections: data.sections.map(section => ({
|
|
399
|
+
title: section.title,
|
|
400
|
+
rows: section.rows.map(row => ({
|
|
401
|
+
rowId: row.rowId || this.utils.generateMessageID(),
|
|
402
|
+
title: row.title,
|
|
403
|
+
description: row.description || ''
|
|
404
|
+
}))
|
|
405
|
+
})),
|
|
406
|
+
listType: data.listType || 1,
|
|
407
|
+
footerText: data.footer || ''
|
|
408
|
+
});
|
|
164
409
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
generateWAMessageFromContent: (jid: string, content: any, options?: any) => Promise<any>;
|
|
169
|
-
generateWAMessage: (jid: string, content: any, options?: any) => Promise<any>;
|
|
170
|
-
generateMessageID: () => string;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
410
|
+
const listContent = {
|
|
411
|
+
listMessage: listMessagePayload
|
|
412
|
+
};
|
|
173
413
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
quoted?: proto.IWebMessageInfo
|
|
198
|
-
): Promise<{ interactiveMessage: proto.Message.InteractiveMessage }>;
|
|
199
|
-
|
|
200
|
-
handleAlbum(
|
|
201
|
-
content: { albumMessage: NotForrAll.AlbumItem[] },
|
|
202
|
-
jid: string,
|
|
203
|
-
quoted?: proto.IWebMessageInfo
|
|
204
|
-
): Promise<any>;
|
|
205
|
-
|
|
206
|
-
handleEvent(
|
|
207
|
-
content: { eventMessage: NotForrAll.EventMessage },
|
|
208
|
-
jid: string,
|
|
209
|
-
quoted?: proto.IWebMessageInfo
|
|
210
|
-
): Promise<any>;
|
|
414
|
+
const contextInfo = data.contextInfo || {};
|
|
415
|
+
|
|
416
|
+
// Tambahkan quoted ke contextInfo
|
|
417
|
+
if (quoted) {
|
|
418
|
+
contextInfo.stanzaId = quoted.key.id;
|
|
419
|
+
contextInfo.participant = quoted.key.participant || quoted.key.remoteJid;
|
|
420
|
+
contextInfo.quotedMessage = quoted.message;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
if (Object.keys(contextInfo).length > 0) {
|
|
424
|
+
listContent.listMessage.contextInfo = contextInfo;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
const msg = await this.utils.generateWAMessageFromContent(
|
|
428
|
+
jid,
|
|
429
|
+
listContent,
|
|
430
|
+
{ quoted }
|
|
431
|
+
);
|
|
432
|
+
|
|
433
|
+
await this.relayMessage(jid, msg.message, { messageId: msg.key.id });
|
|
434
|
+
|
|
435
|
+
return msg;
|
|
436
|
+
}
|
|
211
437
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
438
|
+
// --- BARU: handleGroupStory (SWGC) ---
|
|
439
|
+
async handleGroupStory(content, jid, quoted) {
|
|
440
|
+
const { groupStoryMessage } = content;
|
|
441
|
+
|
|
442
|
+
// Asumsi isJidGroup tersedia di this.utils
|
|
443
|
+
if (!this.utils.isJidGroup(jid)) {
|
|
444
|
+
throw new Error("Group Story messages must be sent to a group JID.");
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
let mediaContent = {};
|
|
448
|
+
|
|
449
|
+
// 1. Proses Media (Image/Video)
|
|
450
|
+
if (groupStoryMessage.image || groupStoryMessage.video) {
|
|
451
|
+
const mediaData = groupStoryMessage.image || groupStoryMessage.video;
|
|
452
|
+
const mediaType = groupStoryMessage.image ? 'image' : 'video';
|
|
453
|
+
|
|
454
|
+
let stream;
|
|
455
|
+
if (Buffer.isBuffer(mediaData)) {
|
|
456
|
+
stream = mediaData;
|
|
457
|
+
} else if (typeof mediaData === 'object' && mediaData.url) {
|
|
458
|
+
// Asumsi waUploadToServer bisa menangani URL (atau Anda fetch dulu)
|
|
459
|
+
// Untuk contoh ini, saya asumsikan ia menangani Buffer/Stream
|
|
460
|
+
throw new Error("Group Story media from URL is not supported in this simplified handler. Use Buffer or fetch it first.");
|
|
461
|
+
} else {
|
|
462
|
+
stream = Buffer.from(mediaData, 'base64');
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// Upload media
|
|
466
|
+
const upload = await this.waUploadToServer(stream, {
|
|
467
|
+
mediaType: mediaType,
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
// Siapkan content media
|
|
471
|
+
mediaContent = {
|
|
472
|
+
[mediaType + 'Message']: {
|
|
473
|
+
url: upload.url,
|
|
474
|
+
mimetype: mediaType === 'image' ? 'image/jpeg' : 'video/mp4',
|
|
475
|
+
caption: groupStoryMessage.caption,
|
|
476
|
+
fileSha256: upload.fileSha256,
|
|
477
|
+
fileEncSha256: upload.fileEncSha256,
|
|
478
|
+
mediaKey: upload.mediaKey,
|
|
479
|
+
fileLength: upload.fileLength,
|
|
480
|
+
directPath: upload.directPath,
|
|
481
|
+
// Asumsi unixTimestampSeconds tersedia di this.utils
|
|
482
|
+
mediaKeyTimestamp: this.utils.unixTimestampSeconds(),
|
|
483
|
+
jpegThumbnail: groupStoryMessage.jpegThumbnail,
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
} else if (groupStoryMessage.caption) {
|
|
487
|
+
// Jika hanya teks/caption
|
|
488
|
+
mediaContent = {
|
|
489
|
+
extendedTextMessage: {
|
|
490
|
+
text: groupStoryMessage.caption
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
} else {
|
|
494
|
+
throw new Error("Group Story content must contain image, video, or caption.");
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// 2. Bungkus ke dalam GroupStatusMessage
|
|
498
|
+
const groupStatusMessageContent = {
|
|
499
|
+
groupStatusMessage: {
|
|
500
|
+
key: {
|
|
501
|
+
remoteJid: jid,
|
|
502
|
+
fromMe: true,
|
|
503
|
+
id: this.utils.generateMessageID(),
|
|
504
|
+
// Asumsi jidNormalizedUser dan auth state tersedia di this.utils
|
|
505
|
+
participant: this.utils.jidNormalizedUser(this.utils.auth.creds.me.id)
|
|
506
|
+
},
|
|
507
|
+
message: {
|
|
508
|
+
...mediaContent,
|
|
509
|
+
// Tambahkan context info jika ada quoted atau mentions
|
|
510
|
+
contextInfo: {
|
|
511
|
+
mentionedJid: groupStoryMessage.mentions || [],
|
|
512
|
+
...(quoted ? {
|
|
513
|
+
stanzaId: quoted.key.id,
|
|
514
|
+
participant: quoted.key.participant || quoted.key.remoteJid,
|
|
515
|
+
quotedMessage: quoted.message
|
|
516
|
+
} : {})
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
// 3. Generate WAMessage
|
|
523
|
+
const fullMsg = await this.utils.generateWAMessageFromContent(
|
|
524
|
+
jid,
|
|
525
|
+
groupStatusMessageContent,
|
|
526
|
+
{ quoted, logger: this.utils.logger }
|
|
527
|
+
);
|
|
528
|
+
|
|
529
|
+
// 4. Relay Message
|
|
530
|
+
await this.relayMessage(jid, fullMsg.message, {
|
|
531
|
+
messageId: fullMsg.key.id,
|
|
532
|
+
type: 'group_status',
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
return fullMsg;
|
|
536
|
+
}
|
|
217
537
|
}
|
|
218
538
|
|
|
219
|
-
|
|
539
|
+
module.exports = yaoii;
|
package/lib/Socket/socket.d.ts
CHANGED
|
@@ -1,43 +1,270 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
// setup.d.ts by alip
|
|
2
|
+
import { proto } from '../../WAProto';
|
|
3
|
+
|
|
4
|
+
declare namespace NotForrAll {
|
|
5
|
+
interface MediaUploadOptions {
|
|
6
|
+
fileEncSha256?: Buffer;
|
|
7
|
+
mediaType?: string;
|
|
8
|
+
newsletter?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type WAMediaUploadFunction = (
|
|
12
|
+
stream: Buffer | NodeJS.ReadableStream,
|
|
13
|
+
options?: MediaUploadOptions
|
|
14
|
+
) => Promise<{ url: string; directPath: string; mediaKey: Buffer; fileEncSha256: Buffer; fileSha256: Buffer; fileLength: number }>;
|
|
15
|
+
|
|
16
|
+
interface WAMessageContentGenerationOptions {
|
|
17
|
+
upload?: WAMediaUploadFunction;
|
|
18
|
+
mediaCache?: any;
|
|
19
|
+
options?: any;
|
|
20
|
+
logger?: any;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface StickerMessage {
|
|
24
|
+
url: string;
|
|
25
|
+
fileSha256: Buffer | string;
|
|
26
|
+
fileEncSha256: Buffer | string;
|
|
27
|
+
mediaKey: Buffer | string;
|
|
28
|
+
mimetype: string;
|
|
29
|
+
directPath: string;
|
|
30
|
+
fileLength: number | string;
|
|
31
|
+
mediaKeyTimestamp: number | string;
|
|
32
|
+
isAnimated?: boolean;
|
|
33
|
+
stickerSentTs?: number | string;
|
|
34
|
+
isAvatar?: boolean;
|
|
35
|
+
isAiSticker?: boolean;
|
|
36
|
+
isLottie?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface PaymentMessage {
|
|
40
|
+
amount: number;
|
|
41
|
+
currency?: string;
|
|
42
|
+
from?: string;
|
|
43
|
+
expiry?: number;
|
|
44
|
+
sticker?: { stickerMessage: StickerMessage };
|
|
45
|
+
note?: string;
|
|
46
|
+
background?: {
|
|
47
|
+
id?: string;
|
|
48
|
+
fileLength?: string;
|
|
49
|
+
width?: number;
|
|
50
|
+
height?: number;
|
|
51
|
+
mimetype?: string;
|
|
52
|
+
placeholderArgb?: number;
|
|
53
|
+
textArgb?: number;
|
|
54
|
+
subtextArgb?: number;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface ProductMessage {
|
|
59
|
+
title: string;
|
|
60
|
+
description: string;
|
|
61
|
+
thumbnail: Buffer | { url: string };
|
|
62
|
+
productId: string;
|
|
63
|
+
retailerId: string;
|
|
64
|
+
url: string;
|
|
65
|
+
body?: string;
|
|
66
|
+
footer?: string;
|
|
67
|
+
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
68
|
+
priceAmount1000?: number | null;
|
|
69
|
+
currencyCode?: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface InteractiveMessage {
|
|
73
|
+
title: string;
|
|
74
|
+
footer?: string;
|
|
75
|
+
thumbnail?: string;
|
|
76
|
+
image?: string | Buffer | { url: string };
|
|
77
|
+
video?: string | Buffer | { url: string };
|
|
78
|
+
document?: Buffer;
|
|
79
|
+
mimetype?: string;
|
|
80
|
+
fileName?: string;
|
|
81
|
+
jpegThumbnail?: Buffer;
|
|
82
|
+
contextInfo?: {
|
|
83
|
+
mentionedJid?: string[];
|
|
84
|
+
forwardingScore?: number;
|
|
85
|
+
isForwarded?: boolean;
|
|
86
|
+
externalAdReply?: {
|
|
87
|
+
title?: string;
|
|
88
|
+
body?: string;
|
|
89
|
+
mediaType?: number;
|
|
90
|
+
thumbnailUrl?: string;
|
|
91
|
+
mediaUrl?: string;
|
|
92
|
+
sourceUrl?: string;
|
|
93
|
+
showAdAttribution?: boolean;
|
|
94
|
+
renderLargerThumbnail?: boolean;
|
|
95
|
+
[key: string]: any;
|
|
96
|
+
};
|
|
97
|
+
[key: string]: any;
|
|
98
|
+
};
|
|
99
|
+
externalAdReply?: {
|
|
100
|
+
title?: string;
|
|
101
|
+
body?: string;
|
|
102
|
+
mediaType?: number;
|
|
103
|
+
thumbnailUrl?: string;
|
|
104
|
+
mediaUrl?: string;
|
|
105
|
+
sourceUrl?: string;
|
|
106
|
+
showAdAttribution?: boolean;
|
|
107
|
+
renderLargerThumbnail?: boolean;
|
|
108
|
+
[key: string]: any;
|
|
109
|
+
};
|
|
110
|
+
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
111
|
+
nativeFlowMessage?: {
|
|
112
|
+
messageParamsJson?: string;
|
|
113
|
+
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
114
|
+
[key: string]: any;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
interface AlbumItem {
|
|
119
|
+
image?: { url: string; caption?: string };
|
|
120
|
+
video?: { url: string; caption?: string };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
interface EventMessageLocation {
|
|
124
|
+
degreesLatitude: number;
|
|
125
|
+
degreesLongitude: number;
|
|
126
|
+
name: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
interface EventMessage {
|
|
130
|
+
isCanceled?: boolean;
|
|
131
|
+
name: string;
|
|
132
|
+
description: string;
|
|
133
|
+
location?: EventMessageLocation;
|
|
134
|
+
joinLink?: string;
|
|
135
|
+
startTime?: string | number;
|
|
136
|
+
endTime?: string | number;
|
|
137
|
+
extraGuestsAllowed?: boolean;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
interface PollVote {
|
|
141
|
+
optionName: string;
|
|
142
|
+
optionVoteCount: string | number;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface PollResultMessage {
|
|
146
|
+
name: string;
|
|
147
|
+
pollVotes: PollVote[];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// --- BARU: List Message ---
|
|
151
|
+
interface ListSection {
|
|
152
|
+
title: string;
|
|
153
|
+
rows: ListRow[];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
interface ListRow {
|
|
157
|
+
rowId: string;
|
|
158
|
+
title: string;
|
|
159
|
+
description?: string;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
interface ListMessage {
|
|
163
|
+
title: string;
|
|
164
|
+
description: string;
|
|
165
|
+
buttonText: string;
|
|
166
|
+
sections: ListSection[];
|
|
167
|
+
listType?: number;
|
|
168
|
+
contextInfo?: proto.IMessageContextInfo;
|
|
169
|
+
footer?: string;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// --- BARU: Group Story ---
|
|
173
|
+
interface GroupStoryMessage {
|
|
174
|
+
image?: Buffer | string | { url: string };
|
|
175
|
+
video?: Buffer | string | { url: string };
|
|
176
|
+
caption?: string;
|
|
177
|
+
mentions?: string[];
|
|
178
|
+
jpegThumbnail?: Buffer;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
interface MessageContent {
|
|
182
|
+
requestPaymentMessage?: PaymentMessage;
|
|
183
|
+
productMessage?: ProductMessage;
|
|
184
|
+
interactiveMessage?: InteractiveMessage;
|
|
185
|
+
albumMessage?: AlbumItem[];
|
|
186
|
+
eventMessage?: EventMessage;
|
|
187
|
+
pollResultMessage?: PollResultMessage;
|
|
188
|
+
sender?: string;
|
|
189
|
+
listMessage?: ListMessage; // <-- BARU
|
|
190
|
+
groupStoryMessage?: GroupStoryMessage; // <-- BARU
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
interface MessageOptions {
|
|
194
|
+
quoted?: proto.IWebMessageInfo;
|
|
195
|
+
filter?: boolean;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
interface Utils {
|
|
199
|
+
// Asumsi Utils punya akses ke auth state untuk jid
|
|
200
|
+
auth: { creds: { me: { id: string } } };
|
|
201
|
+
unixTimestampSeconds: () => number; // Fungsi yang umum ada di Utils
|
|
202
|
+
prepareWAMessageMedia: (media: any, options: WAMessageContentGenerationOptions) => Promise<any>;
|
|
203
|
+
generateWAMessageContent: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
|
|
204
|
+
generateWAMessageFromContent: (jid: string, content: any, options?: any) => Promise<any>;
|
|
205
|
+
generateWAMessage: (jid: string, content: any, options?: any) => Promise<any>;
|
|
206
|
+
generateMessageID: () => string;
|
|
207
|
+
// Asumsi Utils punya fungsi WABinary terkait JID
|
|
208
|
+
jidNormalizedUser: (jid: string) => string;
|
|
209
|
+
isJidGroup: (jid: string) => boolean;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
declare class NotForrAll {
|
|
214
|
+
constructor(
|
|
215
|
+
utils: NotForrAll.Utils,
|
|
216
|
+
waUploadToServer: NotForrAll.WAMediaUploadFunction,
|
|
217
|
+
relayMessageFn?: (jid: string, content: any, options?: any) => Promise<any>
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
detectType(content: NotForrAll.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | 'LIST' | 'GROUP_STORY' | null; // <-- Diperbarui
|
|
221
|
+
|
|
222
|
+
handlePayment(
|
|
223
|
+
content: { requestPaymentMessage: NotForrAll.PaymentMessage },
|
|
224
|
+
quoted?: proto.IWebMessageInfo
|
|
225
|
+
): Promise<{ requestPaymentMessage: proto.Message.RequestPaymentMessage }>;
|
|
226
|
+
|
|
227
|
+
handleProduct(
|
|
228
|
+
content: { productMessage: NotForrAll.ProductMessage },
|
|
229
|
+
jid: string,
|
|
230
|
+
quoted?: proto.IWebMessageInfo
|
|
231
|
+
): Promise<{ viewOnceMessage: proto.Message.ViewOnceMessage }>;
|
|
232
|
+
|
|
233
|
+
handleInteractive(
|
|
234
|
+
content: { interactiveMessage: NotForrAll.InteractiveMessage },
|
|
235
|
+
jid: string,
|
|
236
|
+
quoted?: proto.IWebMessageInfo
|
|
237
|
+
): Promise<{ interactiveMessage: proto.Message.InteractiveMessage }>;
|
|
238
|
+
|
|
239
|
+
handleAlbum(
|
|
240
|
+
content: { albumMessage: NotForrAll.AlbumItem[] },
|
|
241
|
+
jid: string,
|
|
242
|
+
quoted?: proto.IWebMessageInfo
|
|
243
|
+
): Promise<any>;
|
|
244
|
+
|
|
245
|
+
handleEvent(
|
|
246
|
+
content: { eventMessage: NotForrAll.EventMessage },
|
|
247
|
+
jid: string,
|
|
248
|
+
quoted?: proto.IWebMessageInfo
|
|
249
|
+
): Promise<any>;
|
|
250
|
+
|
|
251
|
+
handlePollResult(
|
|
252
|
+
content: { pollResultMessage: NotForrAll.PollResultMessage },
|
|
253
|
+
jid: string,
|
|
254
|
+
quoted?: proto.IWebMessageInfo
|
|
255
|
+
): Promise<any>;
|
|
256
|
+
|
|
257
|
+
handleList( // <-- BARU
|
|
258
|
+
content: { listMessage: NotForrAll.ListMessage },
|
|
259
|
+
jid: string,
|
|
260
|
+
quoted?: proto.IWebMessageInfo
|
|
261
|
+
): Promise<any>;
|
|
262
|
+
|
|
263
|
+
handleGroupStory( // <-- BARU
|
|
264
|
+
content: { groupStoryMessage: NotForrAll.GroupStoryMessage },
|
|
265
|
+
jid: string,
|
|
266
|
+
quoted?: proto.IWebMessageInfo
|
|
267
|
+
): Promise<any>;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export = NotForrAll;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alipclutch-baileys",
|
|
3
|
-
"version": "8.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "8.5.1",
|
|
4
|
+
"description": "Baileys Mod By Alip Clutch",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"baileys",
|
|
7
7
|
"whatsapp",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"url": "https://www.npmjs.com/package/alipclutch-baileys"
|
|
17
17
|
},
|
|
18
18
|
"license": "MIT",
|
|
19
|
-
"author": "
|
|
19
|
+
"author": "alipp",
|
|
20
20
|
"main": "./lib/index.js",
|
|
21
21
|
"files": [
|
|
22
22
|
"lib/*",
|
|
@@ -97,4 +97,4 @@
|
|
|
97
97
|
"engines": {
|
|
98
98
|
"node": ">=20.0.0"
|
|
99
99
|
}
|
|
100
|
-
}
|
|
100
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Kazumarii/Baileys
|
|
4
|
-
|
|
5
|
-
With baileys version 6.7.21
|
|
6
|
-
|
|
7
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
in the Software without restriction, including without limitation the rights
|
|
10
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
furnished to do so, subject to the following conditions:
|
|
13
|
-
|
|
14
|
-
The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
copies or substantial portions of the Software.
|
|
16
|
-
|
|
17
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
SOFTWARE.
|