@chatbridge-it/baileys 1.0.2 → 1.0.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 CHANGED
@@ -19,6 +19,7 @@ A WhatsApp Web Multi-Device API library for Node.js. It connects to WhatsApp dir
19
19
  - [Authentication](#authentication)
20
20
  - [Sending Messages](#sending-messages)
21
21
  - [Interactive Messages](#interactive-messages)
22
+ - [Mentions](#mentions)
22
23
  - [Groups](#groups)
23
24
  - [Newsletters (Channels)](#newsletters-channels)
24
25
  - [Contacts, Profiles and Presence](#contacts-profiles-and-presence)
@@ -347,81 +348,66 @@ Supported presence types: `available`, `unavailable`, `composing`, `recording`,
347
348
 
348
349
  ## Interactive Messages
349
350
 
350
- Interactive messages add a text body, an optional header with media, a footer and buttons.
351
+ Interactive messages add a text body, an optional header title, a footer and native-flow buttons. Pass the buttons in `interactiveButtons`.
351
352
 
352
353
  ```js
353
354
  await sock.sendMessage(jid, {
354
- interactiveMessage: {
355
- header: "Order update",
356
- title: "Your order has shipped.",
357
- footer: "chatbridge",
358
- buttons: [
359
- {
360
- name: "cta_url",
361
- buttonParamsJson: JSON.stringify({
362
- display_text: "Track order",
363
- url: "https://example.com/track"
364
- })
365
- },
366
- {
367
- name: "cta_copy",
368
- buttonParamsJson: JSON.stringify({
369
- display_text: "Copy code",
370
- id: "copy-1",
371
- copy_code: "ABC123"
372
- })
373
- },
374
- {
375
- name: "quick_reply",
376
- buttonParamsJson: JSON.stringify({
377
- display_text: "Contact support",
378
- id: "support"
379
- })
380
- }
381
- ]
382
- }
355
+ text: "Your order has shipped.", // body
356
+ title: "Order update", // optional header
357
+ footer: "chatbridge", // optional footer
358
+ interactiveButtons: [
359
+ {
360
+ name: "cta_url",
361
+ buttonParamsJson: JSON.stringify({
362
+ display_text: "Track order",
363
+ url: "https://example.com/track"
364
+ })
365
+ },
366
+ {
367
+ name: "cta_copy",
368
+ buttonParamsJson: JSON.stringify({
369
+ display_text: "Copy code",
370
+ id: "ORDER-1234",
371
+ copy_code: "ORDER-1234"
372
+ })
373
+ },
374
+ {
375
+ name: "quick_reply",
376
+ buttonParamsJson: JSON.stringify({
377
+ display_text: "Thanks!",
378
+ id: "thanks"
379
+ })
380
+ }
381
+ ]
383
382
  }, { quoted: msg });
384
383
  ```
385
384
 
386
- ### Fields
385
+ - `name` is required. `buttonParamsJson` can be a JSON string or a plain object (it is converted for you).
386
+ - Common button names: `cta_url` (open a link), `cta_copy` (copy a code or link), `cta_call` (call a number), `quick_reply` (send a reply back).
387
+ - `mentions` works on interactive messages as well.
388
+
389
+ Button rendering depends on the recipient's WhatsApp app version and account type, and WhatsApp may change or restrict these message types at any time. Test with your target accounts before relying on them in production.
390
+
391
+ ---
387
392
 
388
- | Field | Description |
389
- |---|---|
390
- | `header` | Title shown above the body |
391
- | `title` | Body text |
392
- | `footer` | Small text at the bottom |
393
- | `image` | Header image: `{ url }` or a Buffer |
394
- | `video` | Header video: `{ url }` or a Buffer |
395
- | `document` | Header document. **Buffer only.** Use with `mimetype`, `fileName` and optionally `jpegThumbnail` |
396
- | `buttons` | Array of `{ name, buttonParamsJson }` objects |
397
- | `nativeFlowMessage` | Advanced: raw native flow payload (`buttons`, `messageParamsJson`) |
398
- | `contextInfo` | Optional context such as `mentionedJid` |
393
+ ## Mentions
399
394
 
400
- ### Document header example
395
+ To tag people, write `@number` in the text. Two ways to make it a real mention:
401
396
 
402
397
  ```js
398
+ // 1) explicit list (recommended): exactly these JIDs are mentioned
403
399
  await sock.sendMessage(jid, {
404
- interactiveMessage: {
405
- header: "Invoice",
406
- title: "Your invoice is ready.",
407
- footer: "chatbridge",
408
- document: fs.readFileSync("./invoice.pdf"),
409
- mimetype: "application/pdf",
410
- fileName: "invoice.pdf",
411
- buttons: [
412
- {
413
- name: "cta_url",
414
- buttonParamsJson: JSON.stringify({
415
- display_text: "Pay online",
416
- url: "https://example.com/pay"
417
- })
418
- }
419
- ]
420
- }
421
- }, { quoted: msg });
400
+ text: "Welcome @393331234567!",
401
+ mentions: ["393331234567@s.whatsapp.net"]
402
+ });
403
+
404
+ // 2) automatic: without `mentions`, every @number (7-15 digits) in the text or caption is mentioned
405
+ await sock.sendMessage(jid, { text: "Welcome @393331234567!" });
422
406
  ```
423
407
 
424
- Button rendering depends on the recipient's WhatsApp app version and account type, and WhatsApp may change or restrict these message types at any time. Test with your target accounts before relying on them in production.
408
+ - Use `autoMentions: false` to turn the automatic detection off.
409
+ - Your own `contextInfo` (for example `externalAdReply`) is merged with the mentions, never replaces them.
410
+ - WhatsApp shows the contact name only if the person is in the group or saved in the viewer's contacts. Someone who has just left a group is shown as a plain number.
425
411
 
426
412
  ---
427
413
 
@@ -21,7 +21,9 @@ const makeGroupsSocket = (config) => {
21
21
  }));
22
22
  const groupMetadata = async (jid) => {
23
23
  const result = await groupQuery(jid, 'get', [{ tag: 'query', attrs: { request: 'interactive' } }]);
24
- return (0, exports.extractGroupMetadata)(result);
24
+ const metadata = (0, exports.extractGroupMetadata)(result);
25
+ try { sock.signalRepository?.lidMapping?.learnParticipants(metadata.participants); } catch (_e) { /* ignore */ }
26
+ return metadata;
25
27
  };
26
28
  const groupFetchAllParticipating = async () => {
27
29
  const result = await query({
@@ -52,6 +54,7 @@ const makeGroupsSocket = (config) => {
52
54
  attrs: {},
53
55
  content: [groupNode]
54
56
  });
57
+ try { sock.signalRepository?.lidMapping?.learnParticipants(meta.participants); } catch (_e) { /* ignore */ }
55
58
  data[meta.id] = meta;
56
59
  }
57
60
  }
@@ -210,8 +210,10 @@ const makeMessagesRecvSocket = (config) => {
210
210
  const { account, signedPreKey, signedIdentityKey: identityKey } = authState.creds;
211
211
  if (retryCount === 1) {
212
212
  //request a resend via phone
213
- const msgId = await requestPlaceholderResend(msgKey);
214
- logger.debug(`sendRetryRequest: requested placeholder resend for message ${msgId}`);
213
+ // non bloccante: requestPlaceholderResend attende 5s e rallentava ogni retry
214
+ requestPlaceholderResend(msgKey)
215
+ .then(resendId => logger.debug(`sendRetryRequest: requested placeholder resend for message ${resendId}`))
216
+ .catch(err => logger.debug({ err }, 'sendRetryRequest: placeholder resend fallito'));
215
217
  }
216
218
  const deviceIdentity = (0, Utils_1.encodeSignedDeviceIdentity)(account, true);
217
219
  await authState.keys.transaction(async () => {
@@ -793,6 +795,13 @@ const makeMessagesRecvSocket = (config) => {
793
795
  placeholderResendCache.del(node.attrs.id);
794
796
  }
795
797
  }
798
+ try {
799
+ const lm = signalRepository.lidMapping;
800
+ if (lm) {
801
+ lm.learn(node.attrs.from, node.attrs.sender_pn);
802
+ lm.learn(node.attrs.participant, node.attrs.participant_pn);
803
+ }
804
+ } catch (_e) { /* ignore */ }
796
805
  const { fullMessage: msg, category, author, decrypt } = (0, Utils_1.decryptMessageNode)(node, authState.creds.me.id, authState.creds.me.lid || '', signalRepository, logger);
797
806
  if (response && ((_a = msg === null || msg === void 0 ? void 0 : msg.messageStubParameters) === null || _a === void 0 ? void 0 : _a[0]) === Utils_1.NO_MESSAGE_FOUND_ERROR_TEXT) {
798
807
  msg.messageStubParameters = [Utils_1.NO_MESSAGE_FOUND_ERROR_TEXT, response];
@@ -45,6 +45,8 @@ const makeSocket = (config) => {
45
45
  // add transaction capability
46
46
  const keys = (0, Utils_1.addTransactionCapability)(authState.keys, logger, transactionOpts);
47
47
  const signalRepository = makeSignalRepository({ creds, keys });
48
+ // mappa LID <-> numero (usata dal bot per risolvere i @lid)
49
+ signalRepository.lidMapping = (0, Utils_1.makeLidMapping)(ev, keys, logger);
48
50
  let lastDateRecv;
49
51
  let epoch = 1;
50
52
  let keepAliveReq;
@@ -91,10 +93,6 @@ const makeSocket = (config) => {
91
93
  // ignore
92
94
  }
93
95
  }
94
- // rate limit (429): lo segnaliamo soltanto; rallentare l'invio spetta al codice del bot
95
- if (message.includes('429') || message.includes('rate limit')) {
96
- logger.warn({ msg }, 'rate limit rilevato: riduci la frequenza di invio per evitare ban');
97
- }
98
96
  };
99
97
  /** await the next incoming message */
100
98
  const awaitNextMessage = async (sendMsg) => {
@@ -21,6 +21,7 @@ __exportStar(require("./messages-media"), exports);
21
21
  __exportStar(require("./validate-connection"), exports);
22
22
  __exportStar(require("./crypto"), exports);
23
23
  __exportStar(require("./signal"), exports);
24
+ __exportStar(require("./lid-mapping"), exports);
24
25
  __exportStar(require("./noise-handler"), exports);
25
26
  __exportStar(require("./history"), exports);
26
27
  __exportStar(require("./chat-utils"), exports);
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeLidMapping = void 0;
4
+ // Mappa LID <-> numero di telefono (PN).
5
+ // Sta in memoria e viene salvata nelle chiavi di autenticazione come 'lid-mapping'
6
+ // (file lid-mapping-*.json con useMultiFileAuthState). Emette l'evento 'lid-mapping.update'.
7
+ const userOf = (jid) => String(jid || '').split('@')[0].split(':')[0];
8
+ const serverOf = (jid) => String(jid || '').split('@')[1] || '';
9
+ const isLid = (jid) => serverOf(jid) === 'lid';
10
+ const isPn = (jid) => serverOf(jid) === 's.whatsapp.net';
11
+ const makeLidMapping = (ev, keys, logger) => {
12
+ const lidToPn = new Map();
13
+ const pnToLid = new Map();
14
+ const persist = async (lidUser, pnUser) => {
15
+ if (!keys || typeof keys.set !== 'function') return;
16
+ try {
17
+ await keys.set({ 'lid-mapping': { [pnUser]: lidUser, [`${lidUser}_reverse`]: pnUser } });
18
+ } catch (err) {
19
+ logger?.debug?.({ err }, 'lid-mapping: salvataggio non riuscito');
20
+ }
21
+ };
22
+ // impara una coppia; ritorna true se è nuova
23
+ const learn = (a, b) => {
24
+ let lid, pn;
25
+ if (isLid(a) && isPn(b)) { lid = a; pn = b; }
26
+ else if (isLid(b) && isPn(a)) { lid = b; pn = a; }
27
+ else return false;
28
+ const lidUser = userOf(lid);
29
+ const pnUser = userOf(pn);
30
+ if (!lidUser || !pnUser || lidUser === pnUser) return false;
31
+ if (lidToPn.get(lidUser) === pnUser) return false;
32
+ lidToPn.set(lidUser, pnUser);
33
+ pnToLid.set(pnUser, lidUser);
34
+ persist(lidUser, pnUser);
35
+ try {
36
+ ev.emit('lid-mapping.update', { lid: `${lidUser}@lid`, pn: `${pnUser}@s.whatsapp.net` });
37
+ } catch (_e) { /* ignore */ }
38
+ return true;
39
+ };
40
+ const loadFromKeys = async (type, id) => {
41
+ if (!keys || typeof keys.get !== 'function') return undefined;
42
+ try {
43
+ const res = await keys.get('lid-mapping', [id]);
44
+ return res?.[id];
45
+ } catch (_e) {
46
+ return undefined;
47
+ }
48
+ };
49
+ return {
50
+ learn,
51
+ async storeLIDPNMappings(pairs) {
52
+ for (const p of pairs || []) learn(p.lid, p.pn || p.jid || p.phoneNumber);
53
+ },
54
+ async getPNForLID(lid) {
55
+ if (!isLid(lid)) return null;
56
+ const lidUser = userOf(lid);
57
+ let pnUser = lidToPn.get(lidUser);
58
+ if (!pnUser) {
59
+ pnUser = await loadFromKeys('lid-mapping', `${lidUser}_reverse`);
60
+ if (pnUser) { lidToPn.set(lidUser, pnUser); pnToLid.set(pnUser, lidUser); }
61
+ }
62
+ return pnUser ? `${pnUser}@s.whatsapp.net` : null;
63
+ },
64
+ async getLIDForPN(pn) {
65
+ if (!isPn(pn)) return null;
66
+ const pnUser = userOf(pn);
67
+ let lidUser = pnToLid.get(pnUser);
68
+ if (!lidUser) {
69
+ lidUser = await loadFromKeys('lid-mapping', pnUser);
70
+ if (lidUser) { pnToLid.set(pnUser, lidUser); lidToPn.set(lidUser, pnUser); }
71
+ }
72
+ return lidUser ? `${lidUser}@lid` : null;
73
+ },
74
+ async getLIDsForPNs(pns) {
75
+ const out = [];
76
+ for (const pn of pns || []) {
77
+ const lid = await this.getLIDForPN(pn);
78
+ if (lid) out.push({ pn, lid });
79
+ }
80
+ return out.length ? out : null;
81
+ },
82
+ // coppie da participant / messaggi: { id: lid, jid: pn }
83
+ learnParticipants(list) {
84
+ for (const p of list || []) learn(p?.id, p?.jid);
85
+ }
86
+ };
87
+ };
88
+ exports.makeLidMapping = makeLidMapping;
@@ -38,6 +38,29 @@ const WABinary_1 = require("../WABinary");
38
38
  const crypto_1 = require("./crypto");
39
39
  const generics_1 = require("./generics");
40
40
  const getTmpFilesDirectory = () => (0, os_1.tmpdir)();
41
+ const JIMP_AUTO = -1;
42
+ /** rende l'API di jimp 1.x identica a quella di jimp 0.x usata dal resto del codice */
43
+ const wrapJimpV1 = (img) => {
44
+ let q = 50;
45
+ const api = {
46
+ getWidth: () => img.width,
47
+ getHeight: () => img.height,
48
+ quality(v) { q = v; return api; },
49
+ resize(w, h) {
50
+ img.resize((h === undefined || h === JIMP_AUTO) ? { w } : { w, h });
51
+ return api;
52
+ },
53
+ crop(x, y, w, h) { img.crop({ x, y, w, h }); return api; },
54
+ getBufferAsync(mime) { return img.getBuffer(mime, { quality: q }); }
55
+ };
56
+ return api;
57
+ };
58
+ const jimpV1Adapter = (Jimp) => ({
59
+ read: async (input) => wrapJimpV1(await Jimp.read(input)),
60
+ MIME_JPEG: 'image/jpeg',
61
+ RESIZE_BILINEAR: undefined,
62
+ AUTO: JIMP_AUTO
63
+ });
41
64
  const getImageProcessingLibrary = async () => {
42
65
  const [_jimp, sharp] = await Promise.all([
43
66
  (async () => {
@@ -55,9 +78,15 @@ const getImageProcessingLibrary = async () => {
55
78
  return { sharp };
56
79
  }
57
80
  const jimp = (_jimp === null || _jimp === void 0 ? void 0 : _jimp.default) || _jimp;
58
- if (jimp) {
81
+ // jimp 0.x: l'oggetto ha direttamente il metodo read()
82
+ if (jimp && typeof jimp.read === 'function') {
59
83
  return { jimp };
60
84
  }
85
+ // jimp 1.x: la classe e' esportata come { Jimp } e ha un'API diversa -> adattatore
86
+ const jimpV1 = (_jimp && _jimp.Jimp) || (jimp && jimp.Jimp);
87
+ if (jimpV1 && typeof jimpV1.read === 'function') {
88
+ return { jimp: jimpV1Adapter(jimpV1) };
89
+ }
61
90
  throw new boom_1.Boom('No image processing library available');
62
91
  };
63
92
  const hkdfInfoKey = (type) => {
@@ -250,6 +250,90 @@ const generateForwardMessageContent = (message, forceForward) => {
250
250
  return content;
251
251
  };
252
252
  exports.generateForwardMessageContent = generateForwardMessageContent;
253
+ // ---------------------------------------------------------------------------
254
+ // Menzioni e pulsanti interattivi (chatbridge)
255
+ // ---------------------------------------------------------------------------
256
+ const WRAPPER_KEYS = ['viewOnceMessage', 'viewOnceMessageV2', 'viewOnceMessageV2Extension', 'ephemeralMessage', 'documentWithCaptionMessage'];
257
+ /** scende dentro gli involucri (viewOnce, effimero...) fino al contenuto reale del messaggio */
258
+ const getInnerContent = (m) => {
259
+ let cur = m;
260
+ for (let i = 0; i < 4; i++) {
261
+ const key = Object.keys(cur)[0];
262
+ const val = cur[key];
263
+ if (WRAPPER_KEYS.includes(key) && val && val.message) {
264
+ cur = val.message;
265
+ continue;
266
+ }
267
+ return (val && typeof val === 'object') ? val : undefined;
268
+ }
269
+ return undefined;
270
+ };
271
+ const uniqueList = (arr) => [...new Set(arr)];
272
+ /** accetta "3939...@s.whatsapp.net", "@lid" oppure un semplice numero */
273
+ const normalizeMentionJid = (j) => {
274
+ if (typeof j !== 'string') {
275
+ return null;
276
+ }
277
+ j = j.trim();
278
+ if (!j) {
279
+ return null;
280
+ }
281
+ if (!j.includes('@')) {
282
+ const digits = j.replace(/\D/g, '');
283
+ return digits ? `${digits}@s.whatsapp.net` : null;
284
+ }
285
+ return j;
286
+ };
287
+ const MENTION_REGEX = /(?<![\w.])@(\d{7,15})(?!\d)/g;
288
+ /**
289
+ * Elenco delle menzioni del messaggio.
290
+ * - se passi `mentions`, vengono usate esattamente quelle (ripulite e senza doppioni)
291
+ * - se non le passi, i numeri scritti come @39333... nel testo diventano menzioni automatiche
292
+ * (disattivabile con `autoMentions: false`)
293
+ */
294
+ const resolveMentions = (message) => {
295
+ if (Array.isArray(message.mentions) && message.mentions.length) {
296
+ return uniqueList(message.mentions.map(normalizeMentionJid).filter(Boolean));
297
+ }
298
+ if (message.autoMentions === false) {
299
+ return [];
300
+ }
301
+ const found = [];
302
+ for (const text of [message.text, message.caption]) {
303
+ if (typeof text === 'string') {
304
+ for (const hit of text.matchAll(MENTION_REGEX)) {
305
+ found.push(`${hit[1]}@s.whatsapp.net`);
306
+ }
307
+ }
308
+ }
309
+ return uniqueList(found);
310
+ };
311
+ /** unisce `extra` al contextInfo esistente, senza mai perdere le menzioni gia presenti */
312
+ const mergeContextInfo = (m, extra) => {
313
+ const content = getInnerContent(m);
314
+ if (!content) {
315
+ return;
316
+ }
317
+ const current = (content.contextInfo && typeof content.contextInfo === 'object') ? content.contextInfo : {};
318
+ const merged = { ...current, ...extra };
319
+ const a = current.mentionedJid;
320
+ const b = extra.mentionedJid;
321
+ if ((a && a.length) || (b && b.length)) {
322
+ merged.mentionedJid = uniqueList([...(a || []), ...(b || [])]);
323
+ }
324
+ content.contextInfo = merged;
325
+ };
326
+ /** pulsante interattivo: buttonParamsJson puo essere una stringa JSON oppure un oggetto */
327
+ const normalizeInteractiveButton = (b) => {
328
+ if (!b || typeof b !== 'object' || !b.name) {
329
+ throw new boom_1.Boom('Invalid interactive button: "name" is required', { statusCode: 400 });
330
+ }
331
+ let params = b.buttonParamsJson;
332
+ if (params !== undefined && typeof params !== 'string') {
333
+ params = JSON.stringify(params);
334
+ }
335
+ return { name: b.name, buttonParamsJson: params === undefined ? '{}' : params };
336
+ };
253
337
  const generateWAMessageContent = async (message, options) => {
254
338
  var _a;
255
339
  var _b;
@@ -313,6 +397,19 @@ const generateWAMessageContent = async (message, options) => {
313
397
  type: Types_1.WAProto.Message.ProtocolMessage.Type.REVOKE
314
398
  };
315
399
  }
400
+ else if ('pin' in message && message.pin) {
401
+ const pinKey = message.pin.key || message.pin;
402
+ const pinType = message.pin.key ? message.pin.type : message.type;
403
+ const pinTime = message.pin.key ? message.pin.time : message.time;
404
+ m.pinInChatMessage = {
405
+ key: pinKey,
406
+ type: pinType,
407
+ senderTimestampMs: Date.now()
408
+ };
409
+ m.messageContextInfo = {
410
+ messageAddOnDurationInSecs: pinType === 1 ? (pinTime || 86400) : 0
411
+ };
412
+ }
316
413
  else if ('forward' in message) {
317
414
  m = (0, exports.generateForwardMessageContent)(message.forward, message.force);
318
415
  }
@@ -427,6 +524,28 @@ const generateWAMessageContent = async (message, options) => {
427
524
  }
428
525
  };
429
526
  }
527
+ if ('interactiveButtons' in message && Array.isArray(message.interactiveButtons) && message.interactiveButtons.length) {
528
+ const interactiveMessage = {
529
+ nativeFlowMessage: {
530
+ buttons: message.interactiveButtons.map(normalizeInteractiveButton)
531
+ }
532
+ };
533
+ if (message.title || message.subtitle) {
534
+ interactiveMessage.header = {
535
+ title: message.title || '',
536
+ subtitle: message.subtitle || '',
537
+ hasMediaAttachment: false
538
+ };
539
+ }
540
+ const bodyText = message.text !== undefined ? message.text : message.caption;
541
+ if (bodyText) {
542
+ interactiveMessage.body = { text: bodyText };
543
+ }
544
+ if (message.footer) {
545
+ interactiveMessage.footer = { text: message.footer };
546
+ }
547
+ m = { interactiveMessage };
548
+ }
430
549
  if ('sections' in message && !!message.sections) {
431
550
  const listMessage = {
432
551
  sections: message.sections,
@@ -441,10 +560,11 @@ const generateWAMessageContent = async (message, options) => {
441
560
  if ('viewOnce' in message && !!message.viewOnce) {
442
561
  m = { viewOnceMessage: { message: m } };
443
562
  }
444
- if ('mentions' in message && ((_a = message.mentions) === null || _a === void 0 ? void 0 : _a.length)) {
445
- const [messageType] = Object.keys(m);
446
- m[messageType].contextInfo = m[messageType] || {};
447
- m[messageType].contextInfo.mentionedJid = message.mentions;
563
+ {
564
+ const mentioned = resolveMentions(message);
565
+ if (mentioned.length) {
566
+ mergeContextInfo(m, { mentionedJid: mentioned });
567
+ }
448
568
  }
449
569
  if ('edit' in message) {
450
570
  m = {
@@ -457,9 +577,7 @@ const generateWAMessageContent = async (message, options) => {
457
577
  };
458
578
  }
459
579
  if ('contextInfo' in message && !!message.contextInfo) {
460
- const [messageType] = Object.keys(m);
461
- m[messageType] = m[messageType] || {};
462
- m[messageType].contextInfo = message.contextInfo;
580
+ mergeContextInfo(m, message.contextInfo);
463
581
  }
464
582
  return Types_1.WAProto.Message.fromObject(m);
465
583
  };
package/lib/index.js CHANGED
@@ -18,9 +18,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18
18
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.makeWASocket = void 0;
21
+ exports.WAProto = exports.proto = exports.makeWASocket = void 0;
22
22
  const Socket_1 = __importDefault(require("./Socket"));
23
+ const WAProto_1 = require("../WAProto");
23
24
  exports.makeWASocket = Socket_1.default;
25
+ exports.proto = WAProto_1.proto || WAProto_1;
26
+ exports.WAProto = WAProto_1.proto || WAProto_1;
24
27
  __exportStar(require("../WAProto"), exports);
25
28
  __exportStar(require("./Utils"), exports);
26
29
  __exportStar(require("./Types"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatbridge-it/baileys",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "WhatsApp Baileys multifunction by ChatBridge",
5
5
  "keywords": [
6
6
  "chatbridge",
@@ -36,6 +36,7 @@
36
36
  "audio-decode": "^2.1.3",
37
37
  "axios": "^1.3.3",
38
38
  "cache-manager": "4.0.1",
39
+ "fluent-ffmpeg": "^2.1.2",
39
40
  "futoin-hkdf": "^1.5.1",
40
41
  "libphonenumber-js": "^1.10.20",
41
42
  "libsignal": "^6.0.0",
@@ -71,10 +72,10 @@
71
72
  "typescript": "^4.6.4"
72
73
  },
73
74
  "peerDependencies": {
74
- "jimp": "*",
75
- "link-preview-js": "*",
76
- "qrcode-terminal": "*",
77
- "sharp": "*"
75
+ "jimp": ">=0.16.1",
76
+ "link-preview-js": ">=3.0.0",
77
+ "qrcode-terminal": ">=0.12.0",
78
+ "sharp": ">=0.32.2"
78
79
  },
79
80
  "peerDependenciesMeta": {
80
81
  "jimp": {