@alannxd/baileys 2.1.3 → 2.1.4
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 +80 -11
- package/lib/Defaults/index.js +16 -0
- package/lib/Socket/chats.d.ts +215 -28
- package/lib/Socket/chats.js +70 -1
- package/lib/Socket/dugong.d.ts +53 -9
- package/lib/Socket/dugong.js +345 -246
- package/lib/Socket/groups.js +1 -0
- package/lib/Socket/index.js +1 -0
- package/lib/Socket/messages-send.js +13 -4
- package/lib/Utils/generics.js +53 -27
- package/lib/index.js +5 -3
- package/package.json +4 -3
package/lib/Socket/dugong.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// "kikyy dugonggg",
|
|
1
|
+
// "kikyy dugonggg", ah dejavu (r)
|
|
2
2
|
// tanggal 14 agustus 2025 makassar
|
|
3
|
-
// telegram: @
|
|
3
|
+
// telegram: @tskiofc & @kyuucode
|
|
4
4
|
|
|
5
5
|
const WAProto = require('../../WAProto').proto;
|
|
6
6
|
const crypto = require('crypto');
|
|
@@ -64,279 +64,378 @@ class kikyy {
|
|
|
64
64
|
})
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
productImage: imageMessage,
|
|
98
|
-
productId,
|
|
99
|
-
title,
|
|
100
|
-
description,
|
|
101
|
-
currencyCode: "IDR",
|
|
102
|
-
priceAmount1000: null,
|
|
103
|
-
retailerId,
|
|
104
|
-
url,
|
|
105
|
-
productImageCount: 1
|
|
106
|
-
},
|
|
107
|
-
businessOwnerJid: "0@s.whatsapp.net"
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
nativeFlowMessage: { buttons }
|
|
111
|
-
}
|
|
112
|
-
}
|
|
67
|
+
|
|
68
|
+
async handleProduct(content, jid, quoted) {
|
|
69
|
+
const {
|
|
70
|
+
title,
|
|
71
|
+
description,
|
|
72
|
+
thumbnail,
|
|
73
|
+
productId,
|
|
74
|
+
retailerId,
|
|
75
|
+
url,
|
|
76
|
+
body = "",
|
|
77
|
+
footer = "",
|
|
78
|
+
buttons = [],
|
|
79
|
+
priceAmount1000 = null,
|
|
80
|
+
currencyCode = "IDR"
|
|
81
|
+
} = content.productMessage;
|
|
82
|
+
|
|
83
|
+
let productImage;
|
|
84
|
+
|
|
85
|
+
if (Buffer.isBuffer(thumbnail)) {
|
|
86
|
+
const { imageMessage } = await this.utils.generateWAMessageContent(
|
|
87
|
+
{ image: thumbnail },
|
|
88
|
+
{ upload: this.waUploadToServer }
|
|
89
|
+
);
|
|
90
|
+
productImage = imageMessage;
|
|
91
|
+
} else if (typeof thumbnail === 'object' && thumbnail.url) {
|
|
92
|
+
const { imageMessage } = await this.utils.generateWAMessageContent(
|
|
93
|
+
{ image: { url: thumbnail.url }},
|
|
94
|
+
{ upload: this.waUploadToServer }
|
|
95
|
+
);
|
|
96
|
+
productImage = imageMessage;
|
|
113
97
|
}
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
async handleInteractive(content, jid, quoted) {
|
|
118
|
-
const {
|
|
119
|
-
title,
|
|
120
|
-
footer,
|
|
121
|
-
thumbnail,
|
|
122
|
-
buttons = [],
|
|
123
|
-
nativeFlowMessage
|
|
124
|
-
} = content.interactiveMessage;
|
|
125
|
-
|
|
126
|
-
if (thumbnail) {
|
|
127
|
-
const media = await this.utils.prepareWAMessageMedia(
|
|
128
|
-
{ image: { url: thumbnail } },
|
|
129
|
-
{ upload: this.waUploadToServer }
|
|
130
|
-
);
|
|
131
|
-
|
|
98
|
+
|
|
132
99
|
return {
|
|
133
100
|
viewOnceMessage: {
|
|
134
101
|
message: {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
deviceListMetadataVersion: 2
|
|
138
|
-
},
|
|
139
|
-
interactiveMessage: WAProto.Message.InteractiveMessage.create({
|
|
140
|
-
body: { text: title },
|
|
102
|
+
interactiveMessage: {
|
|
103
|
+
body: { text: body },
|
|
141
104
|
footer: { text: footer },
|
|
142
105
|
header: {
|
|
143
|
-
title
|
|
106
|
+
title,
|
|
144
107
|
hasMediaAttachment: true,
|
|
145
|
-
|
|
108
|
+
productMessage: {
|
|
109
|
+
product: {
|
|
110
|
+
productImage,
|
|
111
|
+
productId,
|
|
112
|
+
title,
|
|
113
|
+
description,
|
|
114
|
+
currencyCode,
|
|
115
|
+
priceAmount1000,
|
|
116
|
+
retailerId,
|
|
117
|
+
url,
|
|
118
|
+
productImageCount: 1
|
|
119
|
+
},
|
|
120
|
+
businessOwnerJid: "0@s.whatsapp.net"
|
|
121
|
+
}
|
|
146
122
|
},
|
|
147
|
-
nativeFlowMessage:
|
|
148
|
-
}
|
|
123
|
+
nativeFlowMessage: { buttons }
|
|
124
|
+
}
|
|
149
125
|
}
|
|
150
126
|
}
|
|
151
127
|
};
|
|
152
128
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
129
|
+
|
|
130
|
+
async handleInteractive(content, jid, quoted) {
|
|
131
|
+
const {
|
|
132
|
+
title,
|
|
133
|
+
footer,
|
|
134
|
+
thumbnail,
|
|
135
|
+
image,
|
|
136
|
+
video,
|
|
137
|
+
document,
|
|
138
|
+
mimetype,
|
|
139
|
+
fileName,
|
|
140
|
+
jpegThumbnail,
|
|
141
|
+
contextInfo,
|
|
142
|
+
externalAdReply,
|
|
143
|
+
buttons = [],
|
|
144
|
+
nativeFlowMessage
|
|
145
|
+
} = content.interactiveMessage;
|
|
146
|
+
|
|
147
|
+
let media = null;
|
|
148
|
+
let mediaType = null;
|
|
149
|
+
|
|
150
|
+
if (thumbnail) {
|
|
151
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
152
|
+
{ image: { url: thumbnail } },
|
|
153
|
+
{ upload: this.waUploadToServer }
|
|
154
|
+
);
|
|
155
|
+
mediaType = 'image';
|
|
156
|
+
} else if (image) {
|
|
157
|
+
if (typeof image === 'object' && image.url) {
|
|
158
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
159
|
+
{ image: { url: image.url } },
|
|
160
|
+
{ upload: this.waUploadToServer }
|
|
161
|
+
);
|
|
162
|
+
} else {
|
|
163
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
164
|
+
{ image: image },
|
|
165
|
+
{ upload: this.waUploadToServer }
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
mediaType = 'image';
|
|
169
|
+
} else if (video) {
|
|
170
|
+
if (typeof video === 'object' && video.url) {
|
|
171
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
172
|
+
{ video: { url: video.url } },
|
|
173
|
+
{ upload: this.waUploadToServer }
|
|
174
|
+
);
|
|
175
|
+
} else {
|
|
176
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
177
|
+
{ video: video },
|
|
178
|
+
{ upload: this.waUploadToServer }
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
mediaType = 'video';
|
|
182
|
+
} else if (document) {
|
|
183
|
+
let documentPayload = { document: document };
|
|
184
|
+
|
|
185
|
+
if (jpegThumbnail) {
|
|
186
|
+
if (typeof jpegThumbnail === 'object' && jpegThumbnail.url) {
|
|
187
|
+
documentPayload.jpegThumbnail = { url: jpegThumbnail.url };
|
|
188
|
+
} else {
|
|
189
|
+
documentPayload.jpegThumbnail = jpegThumbnail;
|
|
190
|
+
}
|
|
170
191
|
}
|
|
192
|
+
|
|
193
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
194
|
+
documentPayload,
|
|
195
|
+
{ upload: this.waUploadToServer }
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
if (fileName) {
|
|
199
|
+
media.documentMessage.fileName = fileName;
|
|
200
|
+
}
|
|
201
|
+
if (mimetype) {
|
|
202
|
+
media.documentMessage.mimetype = mimetype;
|
|
203
|
+
}
|
|
204
|
+
mediaType = 'document';
|
|
171
205
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
const array = content.albumMessage;
|
|
177
|
-
const album = await this.utils.generateWAMessageFromContent(jid, {
|
|
178
|
-
messageContextInfo: {
|
|
179
|
-
messageSecret: crypto.randomBytes(32),
|
|
180
|
-
},
|
|
181
|
-
albumMessage: {
|
|
182
|
-
expectedImageCount: array.filter((a) => a.hasOwnProperty("image")).length,
|
|
183
|
-
expectedVideoCount: array.filter((a) => a.hasOwnProperty("video")).length,
|
|
184
|
-
},
|
|
185
|
-
}, {
|
|
186
|
-
userJid: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
|
|
187
|
-
quoted,
|
|
188
|
-
upload: this.waUploadToServer
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
await this.relayMessage(jid, album.message, {
|
|
192
|
-
messageId: album.key.id,
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
for (let content of array) {
|
|
196
|
-
const img = await this.utils.generateWAMessage(jid, content, {
|
|
197
|
-
upload: this.waUploadToServer,
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
img.message.messageContextInfo = {
|
|
201
|
-
messageSecret: crypto.randomBytes(32),
|
|
202
|
-
messageAssociation: {
|
|
203
|
-
associationType: 1,
|
|
204
|
-
parentMessageKey: album.key,
|
|
205
|
-
},
|
|
206
|
-
participant: "0@s.whatsapp.net",
|
|
207
|
-
remoteJid: "status@broadcast",
|
|
208
|
-
forwardingScore: 99999,
|
|
209
|
-
isForwarded: true,
|
|
210
|
-
mentionedJid: [jid],
|
|
211
|
-
starred: true,
|
|
212
|
-
labels: ["Y", "Important"],
|
|
213
|
-
isHighlighted: true,
|
|
214
|
-
businessMessageForwardInfo: {
|
|
215
|
-
businessOwnerJid: jid,
|
|
216
|
-
},
|
|
217
|
-
dataSharingContext: {
|
|
218
|
-
showMmDisclosure: true,
|
|
219
|
-
},
|
|
206
|
+
|
|
207
|
+
let interactiveMessage = {
|
|
208
|
+
body: { text: title || "" },
|
|
209
|
+
footer: { text: footer || "" }
|
|
220
210
|
};
|
|
211
|
+
|
|
212
|
+
if (buttons && buttons.length > 0) {
|
|
213
|
+
interactiveMessage.nativeFlowMessage = {
|
|
214
|
+
buttons: buttons
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
if (nativeFlowMessage) {
|
|
218
|
+
interactiveMessage.nativeFlowMessage = {
|
|
219
|
+
...interactiveMessage.nativeFlowMessage,
|
|
220
|
+
...nativeFlowMessage
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
} else if (nativeFlowMessage) {
|
|
224
|
+
interactiveMessage.nativeFlowMessage = nativeFlowMessage;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (media) {
|
|
228
|
+
interactiveMessage.header = {
|
|
229
|
+
title: "",
|
|
230
|
+
hasMediaAttachment: true,
|
|
231
|
+
...media
|
|
232
|
+
};
|
|
233
|
+
} else {
|
|
234
|
+
interactiveMessage.header = {
|
|
235
|
+
title: "",
|
|
236
|
+
hasMediaAttachment: false
|
|
237
|
+
};
|
|
238
|
+
}
|
|
221
239
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
};
|
|
240
|
+
let finalContextInfo = {};
|
|
241
|
+
|
|
242
|
+
if (contextInfo) {
|
|
243
|
+
finalContextInfo = {
|
|
244
|
+
mentionedJid: contextInfo.mentionedJid || [],
|
|
245
|
+
forwardingScore: contextInfo.forwardingScore || 0,
|
|
246
|
+
isForwarded: contextInfo.isForwarded || false,
|
|
247
|
+
...contextInfo
|
|
248
|
+
};
|
|
249
|
+
}
|
|
233
250
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
251
|
+
if (externalAdReply) {
|
|
252
|
+
finalContextInfo.externalAdReply = {
|
|
253
|
+
title: externalAdReply.title || "",
|
|
254
|
+
body: externalAdReply.body || "",
|
|
255
|
+
mediaType: externalAdReply.mediaType || 1,
|
|
256
|
+
thumbnailUrl: externalAdReply.thumbnailUrl || "",
|
|
257
|
+
mediaUrl: externalAdReply.mediaUrl || "",
|
|
258
|
+
sourceUrl: externalAdReply.sourceUrl || "",
|
|
259
|
+
showAdAttribution: externalAdReply.showAdAttribution || false,
|
|
260
|
+
renderLargerThumbnail: externalAdReply.renderLargerThumbnail || false,
|
|
261
|
+
...externalAdReply
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (Object.keys(finalContextInfo).length > 0) {
|
|
266
|
+
interactiveMessage.contextInfo = finalContextInfo;
|
|
267
|
+
}
|
|
248
268
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
key: {
|
|
253
|
-
remoteJid: album.key.remoteJid,
|
|
254
|
-
id: album.key.id,
|
|
255
|
-
fromMe: true,
|
|
256
|
-
participant: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
|
|
257
|
-
},
|
|
258
|
-
message: album.message,
|
|
259
|
-
},
|
|
260
|
-
});
|
|
269
|
+
return {
|
|
270
|
+
interactiveMessage: interactiveMessage
|
|
271
|
+
};
|
|
261
272
|
}
|
|
262
|
-
return album;
|
|
263
|
-
}
|
|
264
|
-
// tama tama
|
|
265
|
-
async handleEvent(content, jid, quoted) {
|
|
266
|
-
const eventData = content.eventMessage;
|
|
267
273
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
274
|
+
async handleAlbum(content, jid, quoted) {
|
|
275
|
+
const array = content.albumMessage;
|
|
276
|
+
const album = await this.utils.generateWAMessageFromContent(jid, {
|
|
277
|
+
messageContextInfo: {
|
|
278
|
+
messageSecret: crypto.randomBytes(32),
|
|
279
|
+
},
|
|
280
|
+
albumMessage: {
|
|
281
|
+
expectedImageCount: array.filter((a) => a.hasOwnProperty("image")).length,
|
|
282
|
+
expectedVideoCount: array.filter((a) => a.hasOwnProperty("video")).length,
|
|
283
|
+
},
|
|
284
|
+
}, {
|
|
285
|
+
userJid: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
|
|
286
|
+
quoted,
|
|
287
|
+
upload: this.waUploadToServer
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
await this.relayMessage(jid, album.message, {
|
|
291
|
+
messageId: album.key.id,
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
for (let content of array) {
|
|
295
|
+
const img = await this.utils.generateWAMessage(jid, content, {
|
|
296
|
+
upload: this.waUploadToServer,
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
img.message.messageContextInfo = {
|
|
300
|
+
messageSecret: crypto.randomBytes(32),
|
|
301
|
+
messageAssociation: {
|
|
302
|
+
associationType: 1,
|
|
303
|
+
parentMessageKey: album.key,
|
|
304
|
+
},
|
|
305
|
+
participant: "0@s.whatsapp.net",
|
|
306
|
+
remoteJid: "status@broadcast",
|
|
307
|
+
forwardingScore: 99999,
|
|
308
|
+
isForwarded: true,
|
|
309
|
+
mentionedJid: [jid],
|
|
310
|
+
starred: true,
|
|
311
|
+
labels: ["Y", "Important"],
|
|
312
|
+
isHighlighted: true,
|
|
313
|
+
businessMessageForwardInfo: {
|
|
314
|
+
businessOwnerJid: jid,
|
|
281
315
|
},
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
316
|
+
dataSharingContext: {
|
|
317
|
+
showMmDisclosure: true,
|
|
318
|
+
},
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
img.message.forwardedNewsletterMessageInfo = {
|
|
322
|
+
newsletterJid: "0@newsletter",
|
|
323
|
+
serverMessageId: 1,
|
|
324
|
+
newsletterName: `WhatsApp`,
|
|
325
|
+
contentType: 1,
|
|
326
|
+
timestamp: new Date().toISOString(),
|
|
327
|
+
senderName: "kikyy dugonggg",
|
|
328
|
+
content: "Text Message",
|
|
329
|
+
priority: "high",
|
|
330
|
+
status: "sent",
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
img.message.disappearingMode = {
|
|
334
|
+
initiator: 3,
|
|
335
|
+
trigger: 4,
|
|
336
|
+
initiatorDeviceJid: jid,
|
|
337
|
+
initiatedByExternalService: true,
|
|
338
|
+
initiatedByUserDevice: true,
|
|
339
|
+
initiatedBySystem: true,
|
|
340
|
+
initiatedByServer: true,
|
|
341
|
+
initiatedByAdmin: true,
|
|
342
|
+
initiatedByUser: true,
|
|
343
|
+
initiatedByApp: true,
|
|
344
|
+
initiatedByBot: true,
|
|
345
|
+
initiatedByMe: true,
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
await this.relayMessage(jid, img.message, {
|
|
349
|
+
messageId: img.key.id,
|
|
350
|
+
quoted: {
|
|
351
|
+
key: {
|
|
352
|
+
remoteJid: album.key.remoteJid,
|
|
353
|
+
id: album.key.id,
|
|
354
|
+
fromMe: true,
|
|
355
|
+
participant: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
|
|
292
356
|
},
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
357
|
+
message: album.message,
|
|
358
|
+
},
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
return album;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
async handleEvent(content, jid, quoted) {
|
|
365
|
+
const eventData = content.eventMessage;
|
|
366
|
+
|
|
367
|
+
const msg = await this.utils.generateWAMessageFromContent(jid, {
|
|
368
|
+
viewOnceMessage: {
|
|
369
|
+
message: {
|
|
370
|
+
messageContextInfo: {
|
|
371
|
+
deviceListMetadata: {},
|
|
372
|
+
deviceListMetadataVersion: 2,
|
|
373
|
+
messageSecret: crypto.randomBytes(32),
|
|
374
|
+
supportPayload: JSON.stringify({
|
|
375
|
+
version: 2,
|
|
376
|
+
is_ai_message: true,
|
|
377
|
+
should_show_system_message: true,
|
|
378
|
+
ticket_id: crypto.randomBytes(16).toString('hex')
|
|
379
|
+
})
|
|
300
380
|
},
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
381
|
+
eventMessage: {
|
|
382
|
+
contextInfo: {
|
|
383
|
+
mentionedJid: [jid],
|
|
384
|
+
participant: jid,
|
|
385
|
+
remoteJid: "status@broadcast",
|
|
386
|
+
forwardedNewsletterMessageInfo: {
|
|
387
|
+
newsletterName: "shenvn.",
|
|
388
|
+
newsletterJid: "120363297591152843@newsletter",
|
|
389
|
+
serverMessageId: 1
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
isCanceled: eventData.isCanceled || false,
|
|
393
|
+
name: eventData.name,
|
|
394
|
+
description: eventData.description,
|
|
395
|
+
location: eventData.location || {
|
|
396
|
+
degreesLatitude: 0,
|
|
397
|
+
degreesLongitude: 0,
|
|
398
|
+
name: "Location"
|
|
399
|
+
},
|
|
400
|
+
joinLink: eventData.joinLink || '',
|
|
401
|
+
startTime: typeof eventData.startTime === 'string' ? parseInt(eventData.startTime) : eventData.startTime || Date.now(),
|
|
402
|
+
endTime: typeof eventData.endTime === 'string' ? parseInt(eventData.endTime) : eventData.endTime || Date.now() + 3600000,
|
|
403
|
+
extraGuestsAllowed: eventData.extraGuestsAllowed !== false
|
|
404
|
+
}
|
|
305
405
|
}
|
|
306
406
|
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}
|
|
407
|
+
}, { quoted });
|
|
408
|
+
|
|
409
|
+
await this.relayMessage(jid, msg.message, {
|
|
410
|
+
messageId: msg.key.id
|
|
411
|
+
});
|
|
412
|
+
return msg;
|
|
413
|
+
}
|
|
315
414
|
|
|
316
|
-
|
|
317
|
-
|
|
415
|
+
async handlePollResult(content, jid, quoted) {
|
|
416
|
+
const pollData = content.pollResultMessage;
|
|
318
417
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
418
|
+
const msg = await this.utils.generateWAMessageFromContent(jid, {
|
|
419
|
+
pollResultSnapshotMessage: {
|
|
420
|
+
name: pollData.name,
|
|
421
|
+
pollVotes: pollData.pollVotes.map(vote => ({
|
|
422
|
+
optionName: vote.optionName,
|
|
423
|
+
optionVoteCount: typeof vote.optionVoteCount === 'number'
|
|
424
|
+
? vote.optionVoteCount.toString()
|
|
425
|
+
: vote.optionVoteCount
|
|
426
|
+
}))
|
|
427
|
+
}
|
|
428
|
+
}, {
|
|
429
|
+
userJid: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
|
|
430
|
+
quoted
|
|
431
|
+
});
|
|
333
432
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
433
|
+
await this.relayMessage(jid, msg.message, {
|
|
434
|
+
messageId: msg.key.id
|
|
435
|
+
});
|
|
337
436
|
|
|
338
|
-
|
|
437
|
+
return msg;
|
|
438
|
+
}
|
|
339
439
|
}
|
|
340
|
-
}
|
|
341
440
|
|
|
342
441
|
module.exports = kikyy;
|
package/lib/Socket/groups.js
CHANGED
|
@@ -305,6 +305,7 @@ const extractGroupMetadata = (result) => {
|
|
|
305
305
|
participants: WABinary_1.getBinaryNodeChildren(group, 'participant').map(({ attrs }) => {
|
|
306
306
|
return {
|
|
307
307
|
id: attrs.jid,
|
|
308
|
+
jid: attrs.phone_number || attrs.jid,
|
|
308
309
|
admin: (attrs.type || null),
|
|
309
310
|
};
|
|
310
311
|
}),
|
package/lib/Socket/index.js
CHANGED