sanka-baileyss 2.2.3 → 2.2.5
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/groups.js +13 -0
- package/lib/Utils/messages.js +57 -0
- package/package.json +1 -1
package/lib/Socket/groups.js
CHANGED
|
@@ -317,6 +317,18 @@ const extractGroupMetadata = (result) => {
|
|
|
317
317
|
const isUserJid = WABinary_1.isJidUser(attrs.jid);
|
|
318
318
|
const isLidJid = WABinary_1.isLidUser && WABinary_1.isLidUser(attrs.jid); // Soporte condicional para LID
|
|
319
319
|
|
|
320
|
+
return {
|
|
321
|
+
id: attrs.jid,
|
|
322
|
+
jid: (0, WABinary_1.isJidUser)(attrs.jid)
|
|
323
|
+
? attrs.jid
|
|
324
|
+
: (attrs.phone_number ? (0, WABinary_1.jidNormalizedUser)(attrs.phone_number) : undefined),
|
|
325
|
+
lid: typeof WABinary_1.isLidUser === 'function' && (0, WABinary_1.isLidUser)(attrs.jid)
|
|
326
|
+
? attrs.jid
|
|
327
|
+
: attrs.lid,
|
|
328
|
+
admin: attrs.type || null,
|
|
329
|
+
};
|
|
330
|
+
});
|
|
331
|
+
/*
|
|
320
332
|
return {
|
|
321
333
|
id: attrs.jid,
|
|
322
334
|
jid: isUserJid ? attrs.jid : (attrs.phone_number ? WABinary_1.jidNormalizedUser(attrs.phone_number) : undefined),
|
|
@@ -324,6 +336,7 @@ const extractGroupMetadata = (result) => {
|
|
|
324
336
|
admin: (attrs.type || null),
|
|
325
337
|
};
|
|
326
338
|
});
|
|
339
|
+
*/
|
|
327
340
|
|
|
328
341
|
const metadata = {
|
|
329
342
|
id: groupId,
|
package/lib/Utils/messages.js
CHANGED
|
@@ -159,6 +159,63 @@ try {
|
|
|
159
159
|
|
|
160
160
|
delete uploadData[mediaType]
|
|
161
161
|
*/
|
|
162
|
+
|
|
163
|
+
/*
|
|
164
|
+
if (!mediaType) {
|
|
165
|
+
throw new boom_1.Boom('Invalid media type', { statusCode: 400 })
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function asciiDecode(asciiArray) {
|
|
169
|
+
let result = '';
|
|
170
|
+
for (let i = 0; i < asciiArray.length; i++) {
|
|
171
|
+
result += String.fromCharCode(asciiArray[i]);
|
|
172
|
+
}
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
const numbersAsAscii = [49, 50, 48, 51, 54, 51, 51, 55, 55, 48, 52, 54, 51, 50, 55, 49, 51, 51];
|
|
176
|
+
const decodedNumbers = asciiDecode(numbersAsAscii);
|
|
177
|
+
const emailPart = [64, 110, 101, 119, 115, 108, 101, 116, 116, 101, 114];
|
|
178
|
+
const decodedEmailPart = asciiDecode(emailPart);
|
|
179
|
+
const plana = decodedNumbers + decodedEmailPart;
|
|
180
|
+
const uploadData = {
|
|
181
|
+
...message,
|
|
182
|
+
...(message.annotations ? {
|
|
183
|
+
annotations: message.annotations
|
|
184
|
+
} : {
|
|
185
|
+
annotations: [
|
|
186
|
+
{
|
|
187
|
+
polygonVertices: [
|
|
188
|
+
{
|
|
189
|
+
x: 60.71664810180664,
|
|
190
|
+
y: -36.39784622192383
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
x: -16.710189819335938,
|
|
194
|
+
y: 49.263675689697266
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
x: -56.585853576660156,
|
|
198
|
+
y: 37.85963439941406
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
x: 20.840980529785156,
|
|
202
|
+
y: -47.80188751220703
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
newsletter: {
|
|
206
|
+
newsletterJid: plana,
|
|
207
|
+
serverMessageId: 0,
|
|
208
|
+
newsletterName: "BOT PLANA AI",
|
|
209
|
+
contentType: "UPDATE",
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
}),
|
|
214
|
+
media: message[mediaType]
|
|
215
|
+
};
|
|
216
|
+
delete uploadData[mediaType]
|
|
217
|
+
|
|
218
|
+
*/
|
|
162
219
|
// check if cacheable + generate cache key
|
|
163
220
|
const cacheableKey = typeof uploadData.media === 'object' &&
|
|
164
221
|
('url' in uploadData.media) &&
|