ell-bail 1.2.0 → 2.0.0

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.
Files changed (41) hide show
  1. package/README.md +341 -93
  2. package/engine-requirements.js +1 -2
  3. package/lib/Defaults/baileys-version.json +1 -1
  4. package/lib/Defaults/index.js +19 -2
  5. package/lib/Socket/chats.d.ts +215 -28
  6. package/lib/Socket/chats.js +155 -49
  7. package/lib/Socket/{luxu.d.ts → dugong.d.ts} +44 -41
  8. package/lib/Socket/dugong.js +484 -0
  9. package/lib/Socket/groups.js +1 -0
  10. package/lib/Socket/index.js +1 -0
  11. package/lib/Socket/messages-recv.js +5 -47
  12. package/lib/Socket/messages-send.d.ts +1 -1
  13. package/lib/Socket/messages-send.js +227 -320
  14. package/lib/Socket/newsletter.d.ts +130 -232
  15. package/lib/Socket/newsletter.js +101 -22
  16. package/lib/Socket/registration.d.ts +0 -1
  17. package/lib/Socket/registration.js +4 -627
  18. package/lib/Socket/socket.d.ts +1 -1
  19. package/lib/Socket/socket.js +66 -31
  20. package/lib/Types/Newsletter.d.ts +97 -86
  21. package/lib/Types/Newsletter.js +38 -32
  22. package/lib/Utils/auth-utils.js +0 -5
  23. package/lib/Utils/crypto.js +1 -18
  24. package/lib/Utils/generics.d.ts +0 -1
  25. package/lib/Utils/generics.js +64 -38
  26. package/lib/Utils/messages-media.js +145 -57
  27. package/lib/Utils/messages.js +54 -13
  28. package/lib/Utils/use-multi-file-auth-state.js +45 -6
  29. package/lib/Utils/validate-connection.js +89 -65
  30. package/lib/WABinary/constants.d.ts +27 -24
  31. package/lib/WABinary/encode.js +160 -123
  32. package/lib/WABinary/generic-utils.d.ts +2 -1
  33. package/lib/index.d.ts +1 -0
  34. package/lib/index.js +7 -2
  35. package/package.json +15 -7
  36. package/WAProto/index.js +0 -130309
  37. package/lib/KeyDB/BinarySearch.js +0 -18
  38. package/lib/KeyDB/KeyedDB.js +0 -164
  39. package/lib/KeyDB/index.js +0 -2
  40. package/lib/Signal/Group/x +0 -1
  41. package/lib/Socket/luxu.js +0 -550
@@ -59,30 +59,7 @@ const makeMessagesRecvSocket = (config) => {
59
59
  useClones: false
60
60
  });
61
61
  let sendActiveReceipts = false;
62
- const sentAcks = new Map();
63
- let ackCount = 0;
64
- let lastAckTime = 0;
65
- let ackBurstTimeout;
66
62
  const sendMessageAck = async ({ tag, attrs, content }, errorCode) => {
67
- const now = Date.now();
68
- if (now - lastAckTime < 100) {
69
- ackCount++;
70
- } else {
71
- ackCount = 1;
72
- }
73
- lastAckTime = now;
74
- clearTimeout(ackBurstTimeout);
75
- ackBurstTimeout = setTimeout(() => {
76
- ackCount = 0;
77
- }, 500);
78
- if (ackCount > 10 && ackCount < 50) {
79
- console.warn(`[HIGH-RISK-WARNING] ${ackCount} Acks sended in under <100ms`);
80
- }
81
- if (ackCount >= 50) {
82
- console.error(`[HIGH-BANN-RISK | BOT-RESTART] Bot Restarts to many Acks send! Ack sended: ${ackCount}`);
83
- setTimeout(() => process.exit(1), 500);
84
- return;
85
- }
86
63
  const stanza = {
87
64
  tag: 'ack',
88
65
  attrs: {
@@ -91,16 +68,16 @@ const makeMessagesRecvSocket = (config) => {
91
68
  class: tag
92
69
  }
93
70
  }
94
- if (errorCode) {
71
+ if (!!errorCode) {
95
72
  stanza.attrs.error = errorCode.toString();
96
73
  }
97
- if (attrs.participant) {
74
+ if (!!attrs.participant) {
98
75
  stanza.attrs.participant = attrs.participant;
99
76
  }
100
- if (attrs.recipient) {
77
+ if (!!attrs.recipient) {
101
78
  stanza.attrs.recipient = attrs.recipient;
102
79
  }
103
- if (attrs.type && (tag !== 'message' || (0, WABinary_1.getBinaryNodeChild)({ tag, attrs, content }, 'unavailable') || errorCode !== 0)) {
80
+ if (!!attrs.type && (tag !== 'message' || (0, WABinary_1.getBinaryNodeChild)({ tag, attrs, content }, 'unavailable') || errorCode !== 0)) {
104
81
  stanza.attrs.type = attrs.type;
105
82
  }
106
83
  if (tag === 'message' && (0, WABinary_1.getBinaryNodeChild)({ tag, attrs, content }, 'unavailable')) {
@@ -946,24 +923,6 @@ const makeMessagesRecvSocket = (config) => {
946
923
  }, 15000);
947
924
  return sendPeerDataOperationMessage(pdoMessage);
948
925
  };
949
- const setProfileStatus = async(status) => {
950
- const stanza = {
951
- tag: 'iq',
952
- attrs: {
953
- to: WABinary_1.S_WHATSAPP_NET,
954
- type: 'set',
955
- xmlns: 'status'
956
- },
957
- content: [
958
- {
959
- tag: 'status',
960
- attrs: {},
961
- content: Buffer.from(status, 'utf-8')
962
- }
963
- ]
964
- }
965
- return query(stanza);
966
- };
967
926
  const handleCall = async (node) => {
968
927
  const { attrs } = node;
969
928
  const [infoChild] = (0, WABinary_1.getAllBinaryNodeChildren)(node);
@@ -1122,7 +1081,7 @@ const makeMessagesRecvSocket = (config) => {
1122
1081
  msg.messageStubType = call.isVideo ? Types_1.WAMessageStubType.CALL_MISSED_GROUP_VIDEO : Types_1.WAMessageStubType.CALL_MISSED_GROUP_VOICE;
1123
1082
  }
1124
1083
  else {
1125
- msg.messageStubType = call.isVideo ? Types_1.WAMessageStubType.CALL_MISSED_VIDEO : Types_1.WAMessageStubType.CALL_MISSED_VOICE;
1084
+ msg.messageStubType = call.isVideo ? Types_1.WAMessageStubType.CALL_MISSED_VIDEO : Types_1.WAMessageStubType.CALL_MISSED_VOICE;
1126
1085
  }
1127
1086
  }
1128
1087
  else {
@@ -1146,7 +1105,6 @@ const makeMessagesRecvSocket = (config) => {
1146
1105
  offerCall,
1147
1106
  fetchMessageHistory,
1148
1107
  requestPlaceholderResend,
1149
- setProfileStatus
1150
1108
  };
1151
1109
  };
1152
1110
  exports.makeMessagesRecvSocket = makeMessagesRecvSocket;
@@ -21,7 +21,7 @@ export declare const makeMessagesSocket: (config: SocketConfig) => {
21
21
  [_: string]: string;
22
22
  }>;
23
23
  sendPeerDataOperationMessage: (pdoMessage: proto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
24
- luki: any;
24
+ rahmi: any;
25
25
  updateMediaMessage: (message: proto.IWebMessageInfo) => Promise<proto.IWebMessageInfo>;
26
26
  sendMessage: (jid: string, content: AnyMessageContent, options?: MiscMessageGenerationOptions) => Promise<proto.WebMessageInfo | undefined>;
27
27
  subscribeNewsletterUpdates: (jid: string) => Promise<{