@itsliaaa/baileys 0.1.26 β†’ 0.1.28

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
@@ -34,6 +34,26 @@ This fork designed for production use with a focus on clarity and safety:
34
34
  - 🚫 No obfuscation. Easy to read and audit.
35
35
  - 🚫 No auto-follow channel (newsletter) behavior.
36
36
 
37
+ > [!IMPORTANT]
38
+ Hi everyone,
39
+ >
40
+ > I want to share something that’s been weighing on me a bit.
41
+ >
42
+ > Recently, I found a few packages published on npm that are essentially just **renamed** versions of a fork I personally worked on:
43
+ >
44
+ > - https://www.npmjs.com/package/@noya4u_27/baileys
45
+ > - https://www.npmjs.com/package/@phrolovaa/baileys
46
+ > - https://www.npmjs.com/package/@dnuzi/baileys
47
+ > - https://www.npmjs.com/package/@crysnovax/baileys
48
+ >
49
+ > To be clear, I’m **not** the original maintainer of Baileys all respect goes to the amazing work behind [@whiskeysockets/baileys](https://github.com/WhiskeySockets/Baileys). I only created and maintained my own fork ([@itsliaaa/baileys](https://www.npmjs.com/package/@itsliaaa/baileys)) where I spent a **lot** of time improving and adapting things on my own.
50
+ >
51
+ > **It’s honestly a bit disheartening to see my fork being republished under different names without any acknowledgment or credit.** I put a lot of late nights and personal effort into it, so seeing it circulate like this feels… quietly painful.
52
+ >
53
+ > If you come across these packages, I’d really appreciate it if you could take a closer look and, if appropriate, **help report them to npm.** More than anything, I just hope for a bit of fairness and proper recognition for the work that people put in.
54
+ >
55
+ > Thank you for taking the time to read this 🀍
56
+
37
57
  ### πŸ› οΈ Internal Adjustments
38
58
  - πŸ–ΌοΈ Fixed an issue where media could not be sent to newsletters due to an upstream issue.
39
59
  - πŸ“ Reintroduced [`makeInMemoryStore`](#%EF%B8%8F-implementing-a-data-store) with a minimal ESM adaptation and small adjustments for Baileys v7.
@@ -52,6 +72,8 @@ This fork designed for production use with a focus on clarity and safety:
52
72
  - πŸ“‹ [Message with Table](#-message-with-table) **[NEW]**
53
73
  - πŸ’³ [Payment-related Message](#-sending-payment-messages) (payment requests, invites, orders, invoices).
54
74
  - πŸ“° Simplified sending messages with ad thumbnail using [`externalAdReply`](#3%EF%B8%8F⃣-external-ad-reply), without requiring manual `contextInfo`.
75
+ - πŸ’­ Added support for quoting messages inside channel (newsletter). **[NEW]**
76
+ - πŸŽ€ Added support for [custom button icon](#3%EF%B8%8F⃣-interactive). **[NEW]**
55
77
 
56
78
  ### 🧩 Additional Message Options
57
79
  - πŸ‘οΈ Added optional boolean flags for message handling:
@@ -514,8 +536,32 @@ sock.sendMessage(jid, {
514
536
  })
515
537
  ```
516
538
 
539
+ > [!TIP]
540
+ You can easily add syntax highlighting by importing `tokenizeCode` directly from Baileys.
541
+
542
+ ```javascript
543
+ import { tokenizeCode } from '@itsliaaa/baileys'
544
+
545
+ const language = 'javascript'
546
+ const code = 'console.log("Hello, World!")'
547
+
548
+ sock.sendMessage(jid, {
549
+ richResponse: [{
550
+ text: 'Example Usage',
551
+ }, {
552
+ language,
553
+ code: tokenizeCode(code, language)
554
+ }, {
555
+ text: 'Pretty simple, right?'
556
+ }]
557
+ })
558
+ ```
559
+
517
560
  #### 🧾 Message with Code Block
518
561
 
562
+ > [!NOTE]
563
+ This feature already includes a built-in tokenizer.
564
+
519
565
  ```javascript
520
566
  sock.sendMessage(jid, {
521
567
  headerText: '## Example Usage',
@@ -771,7 +817,8 @@ sock.sendMessage(jid, {
771
817
  offerExpiration: Date.now() + 3_600_000, // --- Optional
772
818
  nativeFlow: [{
773
819
  text: 'πŸ‘‹πŸ» Greeting',
774
- id: '#Greeting'
820
+ id: '#Greeting',
821
+ icon: 'review' // --- Optional
775
822
  }, {
776
823
  text: 'πŸ“ž Call',
777
824
  call: '628123456789'
@@ -800,7 +847,8 @@ sock.sendMessage(jid, {
800
847
  description: '',
801
848
  id: '#SecretIngredient'
802
849
  }]
803
- }]
850
+ }],
851
+ icon: 'default' // --- Optional
804
852
  }],
805
853
  interactiveAsTemplate: false, // --- Optional, wrap the interactive message into a template
806
854
  }, {
@@ -2,7 +2,7 @@ import { proto } from '../../WAProto/index.js';
2
2
  import { makeLibSignalRepository } from '../Signal/libsignal.js';
3
3
  import { Browsers } from '../Utils/browser-utils.js';
4
4
  import logger from '../Utils/logger.js';
5
- const version = [2, 3000, 1035194821];
5
+ const version = [2, 3000, 1037013887];
6
6
  export const UNAUTHORIZED_CODES = [401, 403, 419];
7
7
  export const BIZ_BOT_SUPPORT_PAYLOAD = '{"version":1,"is_ai_message":true,"should_upload_client_logs":false,"should_show_system_message":false,"ticket_id":"7004947587700716","citation_items":[],"ticket_locale":"us"}';
8
8
  export const DEFAULT_ORIGIN = 'https://web.whatsapp.com';
@@ -1,7 +1,7 @@
1
1
  import { Boom } from '@hapi/boom';
2
2
  import { createHash, randomBytes, randomFillSync } from 'crypto';
3
3
  import { proto } from '../../WAProto/index.js';
4
- const baileysVersion = [2, 3000, 1035194821];
4
+ const baileysVersion = [2, 3000, 1037013887];
5
5
  import { DisconnectReason } from '../Types/index.js';
6
6
  import { getAllBinaryNodeChildren, jidDecode } from '../WABinary/index.js';
7
7
  import { sha256 } from './crypto.js';
@@ -561,13 +561,15 @@ const prepareNativeFlowButtons = (message) => {
561
561
  }
562
562
  return {
563
563
  buttons: correctedField.map(button => {
564
- const buttonText = button.text;
564
+ const buttonText = button.text || button.buttonText;
565
+ const buttonIcon = button.icon?.toUpperCase();
565
566
  if (hasOptionalProperty(button, 'id') && !!button.id) {
566
567
  return {
567
568
  name: 'quick_reply',
568
569
  buttonParamsJson: JSON.stringify({
569
570
  display_text: buttonText || 'πŸ‘‰πŸ» Click',
570
- id: button.id
571
+ id: button.id,
572
+ icon: buttonIcon
571
573
  })
572
574
  };
573
575
  }
@@ -576,7 +578,8 @@ const prepareNativeFlowButtons = (message) => {
576
578
  name: 'cta_copy',
577
579
  buttonParamsJson: JSON.stringify({
578
580
  display_text: buttonText || 'πŸ“‹ Copy',
579
- copy_code: button.copy
581
+ copy_code: button.copy,
582
+ icon: buttonIcon
580
583
  })
581
584
  };
582
585
  }
@@ -586,7 +589,8 @@ const prepareNativeFlowButtons = (message) => {
586
589
  buttonParamsJson: JSON.stringify({
587
590
  display_text: buttonText || '🌐 Visit',
588
591
  url: button.url,
589
- merchant_url: button.url
592
+ merchant_url: button.url,
593
+ icon: buttonIcon
590
594
  })
591
595
  };
592
596
  }
@@ -595,7 +599,8 @@ const prepareNativeFlowButtons = (message) => {
595
599
  name: 'cta_call',
596
600
  buttonParamsJson: JSON.stringify({
597
601
  display_text: buttonText || 'πŸ“ž Call',
598
- phone_number: button.call
602
+ phone_number: button.call,
603
+ icon: buttonIcon
599
604
  })
600
605
  };
601
606
  }
@@ -605,7 +610,8 @@ const prepareNativeFlowButtons = (message) => {
605
610
  name: 'single_select',
606
611
  buttonParamsJson: JSON.stringify({
607
612
  title: buttonText || 'πŸ“‹ Select',
608
- sections: button.sections
613
+ sections: button.sections,
614
+ icon: buttonIcon
609
615
  })
610
616
  };
611
617
  }
@@ -1095,7 +1101,7 @@ export const generateWAMessageContent = async (message, options) => {
1095
1101
  else if (hasNonNullishProperty(message, 'templateButtons')) {
1096
1102
  const hydratedTemplate = {
1097
1103
  hydratedButtons: message.templateButtons.map((button, i) => {
1098
- const buttonText = button.text;
1104
+ const buttonText = button.text || button.buttonText;
1099
1105
  if (hasOptionalProperty(button, 'id')) {
1100
1106
  return {
1101
1107
  index: i,
@@ -1447,7 +1453,7 @@ export const generateWAMessageFromContent = (jid, message, options) => {
1447
1453
  const timestamp = unixTimestampSeconds(options.timestamp);
1448
1454
  const isNewsletter = isJidNewsletter(jid);
1449
1455
  const { quoted, userJid } = options;
1450
- if (quoted && !isNewsletter) {
1456
+ if (quoted) {
1451
1457
  const participant = quoted.key.fromMe
1452
1458
  ? userJid // TODO: Add support for LIDs
1453
1459
  : quoted.participant || quoted.key.participant || quoted.key.remoteJid;
@@ -1465,7 +1471,7 @@ export const generateWAMessageFromContent = (jid, message, options) => {
1465
1471
  contextInfo.quotedMessage = quotedMsg;
1466
1472
  // if a participant is quoted, then it must be a group
1467
1473
  // hence, remoteJid of group must also be entered
1468
- if (jid !== quoted.key.remoteJid) {
1474
+ if (!isNewsletter && jid !== quoted.key.remoteJid) {
1469
1475
  contextInfo.remoteJid = quoted.key.remoteJid;
1470
1476
  }
1471
1477
  if (contextInfo && innerMessage[key]) {
@@ -3,6 +3,7 @@
3
3
  * Adds support for tables and code blocks with richResponseMessage (wrapped inside botForwardedMessage).
4
4
  *
5
5
  * If you use or copy this code, please credit my name or project.
6
+ * @itsliaaa/baileys
6
7
  */
7
8
  import { getRandomValues, randomUUID, randomBytes } from 'crypto';
8
9
  import { BOT_RENDERING_CONFIG_METADATA, DONATE_URL, LEXER_REGEX } from '../Defaults/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itsliaaa/baileys",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "description": "Enhanced Baileys v7 with fixed newsletter media upload, plus support for interactive messages, albums, and more message types.",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",