@itsliaaa/baileys 0.1.24 โ†’ 0.1.25

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,16 +34,13 @@ 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
- ### โš™๏ธ Changes
38
-
39
- #### ๐Ÿ› ๏ธ Internal Adjustments
37
+ ### ๐Ÿ› ๏ธ Internal Adjustments
40
38
  - ๐Ÿ–ผ๏ธ Fixed an issue where media could not be sent to newsletters due to an upstream issue.
41
39
  - ๐Ÿ“ Reintroduced [`makeInMemoryStore`](#%EF%B8%8F-implementing-a-data-store) with a minimal ESM adaptation and small adjustments for Baileys v7.
42
40
  - ๐Ÿ“ฆ Switched FFmpeg execution from `exec` to `spawn` for safer process handling.
43
41
  - ๐Ÿ—ƒ๏ธ Added [`@napi-rs/image`](https://www.npmjs.com/package/@napi-rs/image) as a supported image processing backend in [`getImageProcessingLibrary()`](#%EF%B8%8F-image-processing), offering a balance between performance and compatibility.
44
42
 
45
- #### ๐Ÿ“จ Message Handling & Compatibility
46
- - ๐Ÿ“ฐ Simplified sending messages with ad thumbnail using [`externalAdReply`](#3%EF%B8%8Fโƒฃ-external-ad-reply), without requiring manual `contextInfo`.
43
+ ### ๐Ÿ“จ Message Handling & Compatibility
47
44
  - ๐Ÿ“ฉ Expanded message support for:
48
45
  - ๐Ÿ–ผ๏ธ [Album Message](#%EF%B8%8F-album-image--video)
49
46
  - ๐Ÿ‘ค [Group Status Message](#4%EF%B8%8Fโƒฃ-group-status)
@@ -54,8 +51,9 @@ This fork designed for production use with a focus on clarity and safety:
54
51
  - ๐Ÿงพ [Message with Code Blocks](#-message-with-code-block) **[NEW]**
55
52
  - ๐Ÿ“‹ [Message with Table](#-message-with-table) **[NEW]**
56
53
  - ๐Ÿ’ณ [Payment-related Message](#-sending-payment-messages) (payment requests, invites, orders, invoices).
54
+ - ๐Ÿ“ฐ Simplified sending messages with ad thumbnail using [`externalAdReply`](#3%EF%B8%8Fโƒฃ-external-ad-reply), without requiring manual `contextInfo`.
57
55
 
58
- #### ๐Ÿงฉ Additional Message Options
56
+ ### ๐Ÿงฉ Additional Message Options
59
57
  - ๐Ÿ‘๏ธ Added optional boolean flags for message handling:
60
58
  - ๐Ÿค– [`ai`](#1%EF%B8%8Fโƒฃ-ai-icon) - AI icon on message
61
59
  - ๐Ÿ“ฃ [`mentionAll`](#-mention) - Mention all group participants without requiring their JIDs in `mentions` or `mentionedJid` **[NEW]**
@@ -340,6 +338,29 @@ sock.sendMessage(jid, {
340
338
  quoted: message
341
339
  })
342
340
  ```
341
+ ##### ๐Ÿ—“๏ธ Event
342
+
343
+ ```javascript
344
+ sock.sendMessage(jid, {
345
+ event: {
346
+ name: '๐ŸŽถ Meet & Mingle Party',
347
+ description: 'Meet & Mingle Party is a fun, casual gathering to connect, chat, and build new relationships within the community.',
348
+ call: 'audio', // --- Or "video", this field is optional
349
+ startDate: new Date(Date.now() + 3600000),
350
+ endDate: new Date(Date.now() + 28800000),
351
+ isCancelled: false, // --- Optional
352
+ isScheduleCall: false, // --- Optional
353
+ extraGuestsAllowed: false, // --- Optional
354
+ location: {
355
+ name: 'Jakarta',
356
+ degreesLatitude: -6.2,
357
+ degreesLongitude: 106.8
358
+ }
359
+ }
360
+ }, {
361
+ quoted: message
362
+ })
363
+ ```
343
364
 
344
365
  ##### ๐Ÿ“Š Poll
345
366
 
@@ -400,11 +421,56 @@ sock.sendMessage(jid, {
400
421
  })
401
422
  ```
402
423
 
403
- ##### ๐ŸŽž๏ธ Status Mention
424
+ ##### ๐Ÿ’ญ Response
404
425
 
405
426
  ```javascript
406
- sock.sendMessage([jidA, jidB, jidC], {
407
- text: 'Hello! ๐Ÿ‘‹๐Ÿป'
427
+ // --- Using buttonsResponseMessage
428
+ sock.sendMessage(jid, {
429
+ type: 'plain',
430
+ buttonReply: {
431
+ id: '#Menu',
432
+ displayText: 'โœจ Interesting Menu'
433
+ }
434
+ }, {
435
+ quoted: message
436
+ })
437
+
438
+ // --- Using interactiveResponseMessage
439
+ sock.sendMessage(jid, {
440
+ flowReply: {
441
+ format: 0,
442
+ text: '๐Ÿ’ญ Response',
443
+ name: 'menu_options',
444
+ paramsJson: JSON.stringify({
445
+ id: '#Menu',
446
+ description: 'โœจ Interesting Menu'
447
+ })
448
+ }
449
+ }, {
450
+ quoted: message
451
+ })
452
+
453
+ // --- Using listResponseMessage
454
+ sock.sendMessage(jid, {
455
+ listReply: {
456
+ title: '๐Ÿ“„ See More',
457
+ description: 'โœจ Interesting Menu',
458
+ id: '#Menu'
459
+ }
460
+ }, {
461
+ quoted: message
462
+ })
463
+
464
+ // --- Using templateButtonReplyMessage
465
+ sock.sendMessage(jid, {
466
+ type: 'template',
467
+ buttonReply: {
468
+ id: '#Menu',
469
+ displayText: 'โœจ Interesting Menu',
470
+ index: 1
471
+ }
472
+ }, {
473
+ quoted: message
408
474
  })
409
475
  ```
410
476
 
@@ -454,7 +520,7 @@ sock.sendMessage(jid, {
454
520
  ```javascript
455
521
  sock.sendMessage(jid, {
456
522
  headerText: '## Example Usage',
457
- contentText: '---'
523
+ contentText: '---',
458
524
  code: 'console.log("Hello, World!")',
459
525
  language: 'javascript',
460
526
  footerText: 'Pretty simple, right?'
@@ -477,6 +543,14 @@ sock.sendMessage(jid, {
477
543
  })
478
544
  ```
479
545
 
546
+ ##### ๐ŸŽž๏ธ Status Mention
547
+
548
+ ```javascript
549
+ sock.sendMessage([jidA, jidB, jidC], {
550
+ text: 'Hello! ๐Ÿ‘‹๐Ÿป'
551
+ })
552
+ ```
553
+
480
554
  #### ๐Ÿ“ Sending Media Messages
481
555
 
482
556
  > [!NOTE]
@@ -5,7 +5,7 @@
5
5
  * If you use or copy this code, please credit my name or project.
6
6
  */
7
7
  import { getRandomValues, randomUUID, randomBytes } from 'crypto';
8
- import { BOT_RENDERING_CONFIG_METADATA, LEXER_REGEX } from '../Defaults/index.js';
8
+ import { BOT_RENDERING_CONFIG_METADATA, DONATE_URL, LEXER_REGEX } from '../Defaults/index.js';
9
9
  import { LANGUAGE_KEYWORDS } from '../WABinary/constants.js';
10
10
  import { CodeHighlightType, RichSubMessageType } from '../Types/RichType.js';
11
11
  import { proto } from '../../WAProto/index.js';
@@ -49,7 +49,7 @@ export const tokenizeCode = (code, language = 'javascript') => {
49
49
  export const toUnified = (submessages) =>
50
50
  ({
51
51
  response_id: randomUUID(),
52
- sections: submessages.map((submessage) => {
52
+ sections: submessages.map((submessage, index) => {
53
53
  switch (submessage.messageType) {
54
54
  case RichSubMessageType.CODE:
55
55
  const codeMetadata = submessage.codeMetadata;
@@ -63,7 +63,6 @@ export const toUnified = (submessages) =>
63
63
  __typename: 'GenAISingleLayoutViewModel'
64
64
  }
65
65
  };
66
- break;
67
66
  case RichSubMessageType.CONTENT_ITEMS:
68
67
  return {
69
68
  view_model: {
@@ -86,7 +85,6 @@ export const toUnified = (submessages) =>
86
85
  __typename: 'GenAIHScrollLayoutViewModel'
87
86
  }
88
87
  };
89
- break;
90
88
  case RichSubMessageType.LATEX:
91
89
  const latexMetadata = submessage.latexMetadata;
92
90
  const item = {
@@ -109,7 +107,6 @@ export const toUnified = (submessages) =>
109
107
  __typename: 'GenAISingleLayoutViewModel'
110
108
  }
111
109
  };
112
- break;
113
110
  case RichSubMessageType.TABLE:
114
111
  const tableMetadata = submessage.tableMetadata;
115
112
  return {
@@ -122,15 +119,39 @@ export const toUnified = (submessages) =>
122
119
  __typename: 'GenAISingleLayoutViewModel'
123
120
  }
124
121
  };
125
- break;
126
122
  case RichSubMessageType.TEXT:
123
+ const shouldAddInlineEntity = index == 0;
124
+ const inlineEntity = [{
125
+ key: 'Starseed',
126
+ metadata: {
127
+ reference_id: 1,
128
+ reference_url: DONATE_URL,
129
+ reference_title: 'For Donation via Saweria',
130
+ reference_display_name: 'Donate',
131
+ sources: [{
132
+ source_type: 'THIRD_PARTY',
133
+ source_display_name: 'Donate',
134
+ source_subtitle: '',
135
+ source_url: DONATE_URL
136
+ }],
137
+ __typename: 'GenAISearchCitationItem'
138
+ }
139
+ }];
140
+ const textEntity = shouldAddInlineEntity ?
141
+ '{{Starseed}}ยน{{/Starseed}}' :
142
+ '';
127
143
  return {
128
144
  view_model: {
129
- primitive: { text: submessage.messageText, inline_entities: [], __typename: 'GenAIMarkdownTextUXPrimitive' },
145
+ primitive: {
146
+ text: submessage.messageText + textEntity,
147
+ inline_entities: shouldAddInlineEntity ?
148
+ inlineEntity :
149
+ [],
150
+ __typename: 'GenAIMarkdownTextUXPrimitive'
151
+ },
130
152
  __typename: 'GenAISingleLayoutViewModel'
131
153
  }
132
154
  };
133
- break;
134
155
  }
135
156
  return submessage;
136
157
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itsliaaa/baileys",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
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",