@itsliaaa/baileys 0.1.16 → 0.1.17

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
@@ -860,7 +860,7 @@ sock.sendMessage(jid, {
860
860
 
861
861
  ```javascript
862
862
  sock.sendMessage(jid, {
863
- text: 'Just a label!',
863
+ text: '🏷️ Just a label!',
864
864
  secureMetaServiceLabel: true
865
865
  })
866
866
  ```
package/WAProto/index.js CHANGED
@@ -58091,6 +58091,7 @@ export const proto = $root.proto = (() => {
58091
58091
  HistorySyncOnDemandRequest.prototype.onDemandMsgCount = null;
58092
58092
  HistorySyncOnDemandRequest.prototype.oldestMsgTimestampMs = null;
58093
58093
  HistorySyncOnDemandRequest.prototype.accountLid = null;
58094
+ HistorySyncOnDemandRequest.prototype.supportInlineResponse = null;
58094
58095
 
58095
58096
  let $oneOfFields;
58096
58097
 
@@ -58124,6 +58125,11 @@ export const proto = $root.proto = (() => {
58124
58125
  set: $util.oneOfSetter($oneOfFields)
58125
58126
  });
58126
58127
 
58128
+ Object.defineProperty(HistorySyncOnDemandRequest.prototype, "_supportInlineResponse", {
58129
+ get: $util.oneOfGetter($oneOfFields = ["supportInlineResponse"]),
58130
+ set: $util.oneOfSetter($oneOfFields)
58131
+ });
58132
+
58127
58133
  HistorySyncOnDemandRequest.create = function create(properties) {
58128
58134
  return new HistorySyncOnDemandRequest(properties);
58129
58135
  };
@@ -58143,6 +58149,8 @@ export const proto = $root.proto = (() => {
58143
58149
  w.uint32(40).int64(m.oldestMsgTimestampMs);
58144
58150
  if (m.accountLid != null && Object.hasOwnProperty.call(m, "accountLid"))
58145
58151
  w.uint32(50).string(m.accountLid);
58152
+ if (m.supportInlineResponse != null && Object.hasOwnProperty.call(m, "supportInlineResponse"))
58153
+ w.uint32(56).bool(m.supportInlineResponse);
58146
58154
  return w;
58147
58155
  };
58148
58156
 
@@ -58179,6 +58187,10 @@ export const proto = $root.proto = (() => {
58179
58187
  m.accountLid = r.string();
58180
58188
  break;
58181
58189
  }
58190
+ case 7: {
58191
+ m.supportInlineResponse = r.bool();
58192
+ break;
58193
+ }
58182
58194
  default:
58183
58195
  r.skipType(t & 7);
58184
58196
  break;
@@ -58216,6 +58228,9 @@ export const proto = $root.proto = (() => {
58216
58228
  if (d.accountLid != null) {
58217
58229
  m.accountLid = String(d.accountLid);
58218
58230
  }
58231
+ if (d.supportInlineResponse != null) {
58232
+ m.supportInlineResponse = Boolean(d.supportInlineResponse);
58233
+ }
58219
58234
  return m;
58220
58235
  };
58221
58236
 
@@ -58256,6 +58271,11 @@ export const proto = $root.proto = (() => {
58256
58271
  if (o.oneofs)
58257
58272
  d._accountLid = "accountLid";
58258
58273
  }
58274
+ if (m.supportInlineResponse != null && m.hasOwnProperty("supportInlineResponse")) {
58275
+ d.supportInlineResponse = m.supportInlineResponse;
58276
+ if (o.oneofs)
58277
+ d._supportInlineResponse = "supportInlineResponse";
58278
+ }
58259
58279
  return d;
58260
58280
  };
58261
58281
 
@@ -507,7 +507,20 @@ export const makeMessagesSocket = (config) => {
507
507
  return;
508
508
  }
509
509
  // Lia@Changes 02-02-26 --- Add keepInChat, editedMessage, mediaNotifyMessage and pollUpdateMessage
510
- if (innerMessage?.pinInChatMessage || innerMessage?.pollUpdateMessage || innerMessage?.keepInChatMessage || innerMessage?.protocolMessage?.editedMessage || innerMessage?.protocolMessage?.mediaNotifyMessage || innerMessage?.reactionMessage) {
510
+ const isNeedMetaAttrs = innerMessage?.pinInChatMessage || innerMessage?.keepInChatMessage || innerMessage?.reactionMessage
511
+ if (isNeedMetaAttrs) {
512
+ const metaAttrs = {};
513
+ if (innerMessage?.pollUpdateMessage) {
514
+ metaAttrs.polltype = 'vote';
515
+ }
516
+ metaAttrs.content_type = 'add_on';
517
+ binaryNodeContent.push({
518
+ tag: 'meta',
519
+ attrs: metaAttrs,
520
+ content: undefined
521
+ });
522
+ }
523
+ if (isNeedMetaAttrs || innerMessage?.protocolMessage?.editedMessage || innerMessage?.protocolMessage?.mediaNotifyMessage) {
511
524
  extraAttrs['decrypt-fail'] = 'hide'; // todo: expand for reactions and other types
512
525
  }
513
526
  // Lia@Changes 02-02-26 --- Add native_flow_name to extraAttrs when sending interactiveResponseMessage
@@ -1121,8 +1134,6 @@ export const makeMessagesSocket = (config) => {
1121
1134
  const isKeepMsg = 'keep' in content && !!content.keep;
1122
1135
  const isPollMsg = 'poll' in content && !!content.poll;
1123
1136
  const isQuizMsg = 'poll' in content && !!content.poll.pollType;
1124
- const isPollResultMsg = 'pollResult' in content && !!content.pollResult;
1125
- const isPollUpdateMsg = 'pollUpdate' in content && !!content.pollUpdate;
1126
1137
  const isAiMsg = 'ai' in content && !!content.ai;
1127
1138
  const isNeedBizAttrs = 'secureMetaServiceLabel' in content && !!content.secureMetaServiceLabel;
1128
1139
  const additionalAttributes = options.additionalAttributes || {};
@@ -1151,7 +1162,7 @@ export const makeMessagesSocket = (config) => {
1151
1162
  tag: 'meta',
1152
1163
  attrs: {
1153
1164
  // Lia@Note 08-02-26 --- Still a hypothesis regarding PollResult ༎ຶ⁠‿⁠༎ຶ
1154
- polltype: isQuizMsg ? 'quiz_creation' : isPollResultMsg || isPollUpdateMsg ? 'vote' : 'creation',
1165
+ polltype: isQuizMsg ? 'quiz_creation' : 'creation',
1155
1166
  contenttype: isPollMsg && isNewsletter ? 'text' : undefined
1156
1167
  },
1157
1168
  content: undefined
@@ -1,5 +1,5 @@
1
1
  import { Boom } from '@hapi/boom';
2
- import { createHash, randomBytes } from 'crypto';
2
+ import { createHash, randomBytes, randomFillSync } from 'crypto';
3
3
  import { proto } from '../../WAProto/index.js';
4
4
  const baileysVersion = [2, 3000, 1035194821];
5
5
  import { DisconnectReason } from '../Types/index.js';
@@ -132,19 +132,19 @@ export async function promiseTimeout(ms, promise) {
132
132
  // inspired from whatsmeow code
133
133
  // https://github.com/tulir/whatsmeow/blob/64bc969fbe78d31ae0dd443b8d4c80a5d026d07a/send.go#L42
134
134
  export const generateMessageIDV2 = (userId) => {
135
- const data = Buffer.allocUnsafe(8 + 20 + 16);
136
- data.writeBigUInt64BE(BigInt(unixTimestampSeconds()));
135
+ const data = Buffer.allocUnsafe(44);
136
+ data.writeBigUInt64BE(BigInt(Date.now() / 1000 | 0), 0);
137
137
  if (userId) {
138
- const id = jidDecode(userId);
139
- if (id?.user) {
140
- const len = data.write(id.user, 8);
138
+ const userStr = userId.split('@')[0].split(':')[0];
139
+ if (userStr) {
140
+ const len = data.write(userStr, 8);
141
141
  data.write('@c.us', 8 + len);
142
142
  }
143
143
  }
144
- randomBytes(16).copy(data, 28);
144
+ randomFillSync(data, 28, 16);
145
145
  const hash = createHash('sha256').update(data).digest();
146
- const hex = hash.toString('hex').toUpperCase();
147
- const baseId = '3EB0' + hex.substring(0, 18);
146
+ const hex = hash.toString('hex', 0, 9).toUpperCase();
147
+ const baseId = '3EB0' + hex;
148
148
  const pos = 4 + (hash[0] & 15);
149
149
  return baseId.slice(0, pos) + 'STARFALL' + baseId.slice(pos);
150
150
  };
@@ -1,6 +1,6 @@
1
1
  import { LRUCache } from 'lru-cache';
2
2
  /** Number of sent messages to cache in memory for handling retry receipts */
3
- const RECENT_MESSAGES_SIZE = 512;
3
+ const RECENT_MESSAGES_SIZE = 1024;
4
4
  const MESSAGE_KEY_SEPARATOR = '\u0000';
5
5
  /** Timeout for session recreation - 1 hour */
6
6
  const RECREATE_SESSION_TIMEOUT = 60 * 60 * 1000; // 1 hour in milliseconds
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itsliaaa/baileys",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "A simple fork of Baileys for WhatsApp automation",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -48,7 +48,7 @@
48
48
  "p-queue": "^9.1.0",
49
49
  "pino": "^9.6.0",
50
50
  "protobufjs": "^7.5.4",
51
- "whatsapp-rust-bridge": "0.5.3",
51
+ "whatsapp-rust-bridge": "^0.5.3",
52
52
  "ws": "^8.19.0"
53
53
  },
54
54
  "peerDependencies": {