@periskope/baileys 6.7.16-alpha.6 → 6.7.16-alpha.8

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.
@@ -347,7 +347,7 @@ const makeMessagesSocket = (config) => {
347
347
  const senderKeyJids = [];
348
348
  // ensure a connection is established with every device
349
349
  for (const { user, device } of devices) {
350
- const jid = (0, WABinary_1.jidEncode)(user, (groupData === null || groupData === void 0 ? void 0 : groupData.addressingMode) ? 'lid' : 's.whatsapp.net', device);
350
+ const jid = (0, WABinary_1.jidEncode)(user, (groupData === null || groupData === void 0 ? void 0 : groupData.addressingMode) === 'lid' ? 'lid' : 's.whatsapp.net', device);
351
351
  if (!senderKeyMap[jid] || !!participant) {
352
352
  senderKeyJids.push(jid);
353
353
  // store that this person has had the sender keys sent to them
@@ -38,22 +38,9 @@ function decodeMessageNode(stanza, meId, meLid) {
38
38
  const recipient = stanza.attrs.recipient;
39
39
  const isMe = (jid) => (0, WABinary_1.areJidsSameUser)(jid, meId);
40
40
  const isMeLid = (jid) => (0, WABinary_1.areJidsSameUser)(jid, meLid);
41
- if ((0, WABinary_1.isJidUser)(from)) {
42
- if (recipient) {
43
- if (!isMe(from)) {
44
- throw new boom_1.Boom('receipient present, but msg not from me', { data: stanza });
45
- }
46
- chatId = recipient;
47
- }
48
- else {
49
- chatId = from;
50
- }
51
- msgType = 'chat';
52
- author = from;
53
- }
54
- else if ((0, WABinary_1.isLidUser)(from)) {
55
- if (recipient) {
56
- if (!isMeLid(from)) {
41
+ if ((0, WABinary_1.isJidUser)(from) || (0, WABinary_1.isLidUser)(from)) {
42
+ if (recipient && !(0, WABinary_1.isJidMetaIa)(recipient)) {
43
+ if (!isMe(from) && !isMeLid(from)) {
57
44
  throw new boom_1.Boom('receipient present, but msg not from me', { data: stanza });
58
45
  }
59
46
  chatId = recipient;
@@ -17,6 +17,8 @@ export declare const jidEncode: (user: string | number | null, server: JidServer
17
17
  export declare const jidDecode: (jid: string | undefined) => FullJid | undefined;
18
18
  /** is the jid a user */
19
19
  export declare const areJidsSameUser: (jid1: string | undefined, jid2: string | undefined) => boolean;
20
+ /** is the jid Meta IA */
21
+ export declare const isJidMetaIa: (jid: string | undefined) => boolean | undefined;
20
22
  /** is the jid a user */
21
23
  export declare const isJidUser: (jid: string | undefined) => boolean | undefined;
22
24
  /** is the jid a group */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jidNormalizedUser = exports.isJidBot = exports.isJidNewsletter = exports.isJidStatusBroadcast = exports.isJidGroup = exports.isJidBroadcast = exports.isLidUser = exports.isJidUser = exports.areJidsSameUser = exports.jidDecode = exports.jidEncode = exports.META_AI_JID = exports.STORIES_JID = exports.PSA_WID = exports.SERVER_JID = exports.OFFICIAL_BIZ_JID = exports.S_WHATSAPP_NET = void 0;
3
+ exports.jidNormalizedUser = exports.isJidBot = exports.isJidNewsletter = exports.isJidStatusBroadcast = exports.isJidGroup = exports.isJidBroadcast = exports.isLidUser = exports.isJidUser = exports.isJidMetaIa = exports.areJidsSameUser = exports.jidDecode = exports.jidEncode = exports.META_AI_JID = exports.STORIES_JID = exports.PSA_WID = exports.SERVER_JID = exports.OFFICIAL_BIZ_JID = exports.S_WHATSAPP_NET = void 0;
4
4
  exports.S_WHATSAPP_NET = '@s.whatsapp.net';
5
5
  exports.OFFICIAL_BIZ_JID = '16505361212@c.us';
6
6
  exports.SERVER_JID = 'server@c.us';
@@ -34,6 +34,9 @@ const areJidsSameUser = (jid1, jid2) => {
34
34
  return (((_a = (0, exports.jidDecode)(jid1)) === null || _a === void 0 ? void 0 : _a.user) === ((_b = (0, exports.jidDecode)(jid2)) === null || _b === void 0 ? void 0 : _b.user));
35
35
  };
36
36
  exports.areJidsSameUser = areJidsSameUser;
37
+ /** is the jid Meta IA */
38
+ const isJidMetaIa = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@bot'));
39
+ exports.isJidMetaIa = isJidMetaIa;
37
40
  /** is the jid a user */
38
41
  const isJidUser = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@s.whatsapp.net'));
39
42
  exports.isJidUser = isJidUser;
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@periskope/baileys",
3
- "version": "6.7.16-alpha.6",
4
- "description": "WhatsApp API",
5
- "keywords": [
3
+ "version": "6.7.16-alpha.8",
4
+ "description": "WhatsApp API", "keywords": [
6
5
  "whatsapp",
7
6
  "automation"
8
7
  ],