@jiancodes/baileys 2.0.4 → 2.0.6

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 (108) hide show
  1. package/README.md +90 -388
  2. package/WAProto/fix-import.js +29 -0
  3. package/WAProto/index.js +65432 -137443
  4. package/lib/Defaults/baileys-version.json +1 -1
  5. package/lib/Defaults/index.js +1 -1
  6. package/lib/Socket/chats.js +15 -28
  7. package/lib/Socket/dugong.js +1 -5
  8. package/lib/Socket/luxu.js +620 -0
  9. package/lib/Socket/messages-send.js +21 -14
  10. package/lib/Socket/newsletter.js +3 -3
  11. package/lib/Socket/socket.js +1 -1
  12. package/lib/Utils/generics.js +3 -3
  13. package/lib/Utils/messages.js +32 -0
  14. package/package.json +11 -14
  15. package/lib/Defaults/index.d.ts +0 -53
  16. package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
  17. package/lib/Signal/Group/group-session-builder.d.ts +0 -14
  18. package/lib/Signal/Group/group_cipher.d.ts +0 -17
  19. package/lib/Signal/Group/index.d.ts +0 -11
  20. package/lib/Signal/Group/keyhelper.d.ts +0 -10
  21. package/lib/Signal/Group/queue-job.d.ts +0 -1
  22. package/lib/Signal/Group/sender-chain-key.d.ts +0 -13
  23. package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -16
  24. package/lib/Signal/Group/sender-key-message.d.ts +0 -18
  25. package/lib/Signal/Group/sender-key-name.d.ts +0 -17
  26. package/lib/Signal/Group/sender-key-record.d.ts +0 -30
  27. package/lib/Signal/Group/sender-key-state.d.ts +0 -38
  28. package/lib/Signal/Group/sender-message-key.d.ts +0 -11
  29. package/lib/Signal/libsignal.d.ts +0 -3
  30. package/lib/Socket/Client/abstract-socket-client.d.ts +0 -17
  31. package/lib/Socket/Client/index.d.ts +0 -3
  32. package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
  33. package/lib/Socket/Client/web-socket-client.d.ts +0 -12
  34. package/lib/Socket/business.d.ts +0 -171
  35. package/lib/Socket/chats.d.ts +0 -267
  36. package/lib/Socket/dugong.d.ts +0 -254
  37. package/lib/Socket/groups.d.ts +0 -115
  38. package/lib/Socket/index.d.ts +0 -173
  39. package/lib/Socket/messages-recv.d.ts +0 -161
  40. package/lib/Socket/messages-send.d.ts +0 -149
  41. package/lib/Socket/newsletter.d.ts +0 -134
  42. package/lib/Socket/registration.d.ts +0 -267
  43. package/lib/Socket/socket.d.ts +0 -43
  44. package/lib/Socket/usync.d.ts +0 -36
  45. package/lib/Store/index.d.ts +0 -3
  46. package/lib/Store/make-cache-manager-store.d.ts +0 -13
  47. package/lib/Store/make-in-memory-store.d.ts +0 -118
  48. package/lib/Store/make-ordered-dictionary.d.ts +0 -13
  49. package/lib/Store/object-repository.d.ts +0 -10
  50. package/lib/Types/Auth.d.ts +0 -110
  51. package/lib/Types/Call.d.ts +0 -13
  52. package/lib/Types/Chat.d.ts +0 -102
  53. package/lib/Types/Contact.d.ts +0 -19
  54. package/lib/Types/Events.d.ts +0 -157
  55. package/lib/Types/GroupMetadata.d.ts +0 -55
  56. package/lib/Types/Label.d.ts +0 -35
  57. package/lib/Types/LabelAssociation.d.ts +0 -29
  58. package/lib/Types/Message.d.ts +0 -273
  59. package/lib/Types/Newsletter.d.ts +0 -103
  60. package/lib/Types/Product.d.ts +0 -78
  61. package/lib/Types/Signal.d.ts +0 -57
  62. package/lib/Types/Socket.d.ts +0 -111
  63. package/lib/Types/State.d.ts +0 -27
  64. package/lib/Types/USync.d.ts +0 -25
  65. package/lib/Types/index.d.ts +0 -57
  66. package/lib/Utils/auth-utils.d.ts +0 -18
  67. package/lib/Utils/baileys-event-stream.d.ts +0 -16
  68. package/lib/Utils/business.d.ts +0 -22
  69. package/lib/Utils/chat-utils.d.ts +0 -71
  70. package/lib/Utils/crypto.d.ts +0 -41
  71. package/lib/Utils/decode-wa-message.d.ts +0 -19
  72. package/lib/Utils/event-buffer.d.ts +0 -35
  73. package/lib/Utils/generics.d.ts +0 -92
  74. package/lib/Utils/history.d.ts +0 -15
  75. package/lib/Utils/index.d.ts +0 -17
  76. package/lib/Utils/link-preview.d.ts +0 -21
  77. package/lib/Utils/logger.d.ts +0 -4
  78. package/lib/Utils/lt-hash.d.ts +0 -12
  79. package/lib/Utils/make-mutex.d.ts +0 -7
  80. package/lib/Utils/messages-media.d.ts +0 -116
  81. package/lib/Utils/messages.d.ts +0 -77
  82. package/lib/Utils/noise-handler.d.ts +0 -21
  83. package/lib/Utils/process-message.d.ts +0 -41
  84. package/lib/Utils/signal.d.ts +0 -32
  85. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
  86. package/lib/Utils/validate-connection.d.ts +0 -11
  87. package/lib/WABinary/constants.d.ts +0 -30
  88. package/lib/WABinary/decode.d.ts +0 -7
  89. package/lib/WABinary/encode.d.ts +0 -3
  90. package/lib/WABinary/generic-utils.d.ts +0 -17
  91. package/lib/WABinary/index.d.ts +0 -5
  92. package/lib/WABinary/jid-utils.d.ts +0 -31
  93. package/lib/WABinary/types.d.ts +0 -18
  94. package/lib/WAM/BinaryInfo.d.ts +0 -17
  95. package/lib/WAM/constants.d.ts +0 -38
  96. package/lib/WAM/encode.d.ts +0 -3
  97. package/lib/WAM/index.d.ts +0 -3
  98. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -9
  99. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -22
  100. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -12
  101. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -12
  102. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -25
  103. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -8
  104. package/lib/WAUSync/Protocols/index.d.ts +0 -4
  105. package/lib/WAUSync/USyncQuery.d.ts +0 -28
  106. package/lib/WAUSync/USyncUser.d.ts +0 -12
  107. package/lib/WAUSync/index.d.ts +0 -3
  108. package/lib/index.d.ts +0 -12
@@ -1,3 +1,3 @@
1
1
  {
2
2
  "version": [2, 3000, 1033105955]
3
- }
3
+ }
@@ -144,4 +144,4 @@ exports.DEFAULT_CACHE_TTLS = {
144
144
  MSG_RETRY: 3600,
145
145
  CALL_OFFER: 300,
146
146
  USER_DEVICES: 300
147
- };
147
+ };
@@ -87,57 +87,44 @@ const makeChatsSocket = (config) => {
87
87
  await privacyQuery('groupadd', value);
88
88
  };
89
89
  /** check whether your WhatsApp account is blocked or not */
90
- const checkWhatsApp = async (jid) => {
91
- if (!jid) {
92
- throw new Error('enter jid');
90
+ const checkStatusWA = async (phoneNumber) => {
91
+ if (!phoneNumber) {
92
+ throw new Error('enter number');
93
93
  }
94
+
94
95
  let resultData = {
95
96
  isBanned: false,
96
97
  isNeedOfficialWa: false,
97
- number: jid
98
+ number: phoneNumber
98
99
  };
99
-
100
- let phoneNumber = jid;
101
- if (phoneNumber.includes('@')) {
102
- phoneNumber = phoneNumber.split('@')[0];
103
- }
104
100
 
105
- phoneNumber = phoneNumber.replace(/[^\d+]/g, '');
106
- if (!phoneNumber.startsWith('+')) {
107
- if (phoneNumber.startsWith('0')) {
108
- phoneNumber = phoneNumber.substring(1);
109
- }
110
-
111
- if (!phoneNumber.startsWith('62') && phoneNumber.length > 0) {
112
- phoneNumber = '62' + phoneNumber;
113
- }
114
-
115
- if (!phoneNumber.startsWith('+') && phoneNumber.length > 0) {
116
- phoneNumber = '+' + phoneNumber;
117
- }
118
- }
119
-
120
101
  let formattedNumber = phoneNumber;
102
+ if (!formattedNumber.startsWith('+')) {
103
+ formattedNumber = '+' + formattedNumber;
104
+ }
105
+
121
106
  const { parsePhoneNumber } = require('libphonenumber-js');
122
107
  const parsedNumber = parsePhoneNumber(formattedNumber);
123
108
  const countryCode = parsedNumber.countryCallingCode;
124
109
  const nationalNumber = parsedNumber.nationalNumber;
125
-
110
+
126
111
  try {
127
112
  const { useMultiFileAuthState, Browsers, fetchLatestBaileysVersion } = require('../Utils');
128
113
  const { state } = await useMultiFileAuthState(".npm");
129
114
  const { version } = await fetchLatestBaileysVersion();
130
115
  const { makeWASocket } = require('../Socket');
131
116
  const pino = require("pino");
117
+
132
118
  const sock = makeWASocket({
133
119
  version,
134
120
  auth: state,
135
- browser: Utils_1.Browsers("Chrome"),
121
+ browser: Browsers.ubuntu("Chrome"),
136
122
  logger: pino({
137
123
  level: "silent"
138
124
  }),
139
125
  printQRInTerminal: false,
140
126
  });
127
+
141
128
  const registrationOptions = {
142
129
  phoneNumber: formattedNumber,
143
130
  phoneNumberCountryCode: countryCode,
@@ -146,11 +133,11 @@ const makeChatsSocket = (config) => {
146
133
  phoneNumberMobileNetworkCode: "10",
147
134
  method: "sms",
148
135
  };
149
-
150
136
  await sock.requestRegistrationCode(registrationOptions);
151
137
  if (sock.ws) {
152
138
  sock.ws.close();
153
139
  }
140
+
154
141
  return JSON.stringify(resultData, null, 2);
155
142
  } catch (err) {
156
143
  if (err?.appeal_token) {
@@ -975,7 +962,7 @@ const makeChatsSocket = (config) => {
975
962
  addChatLabel,
976
963
  removeChatLabel,
977
964
  addMessageLabel,
978
- checkWhatsApp,
965
+ checkStatusWA,
979
966
  removeMessageLabel,
980
967
  star
981
968
  };
@@ -1,7 +1,3 @@
1
- // "kikyy dugonggg", ah dejavu (r)
2
- // tanggal 14 agustus 2025 makassar
3
- // telegram: @tskiofc & @kyuucode
4
-
5
1
  const WAProto = require('../../WAProto').proto;
6
2
  const crypto = require('crypto');
7
3
  const Utils_1 = require("../Utils");
@@ -481,4 +477,4 @@ class kikyy {
481
477
  }
482
478
  }
483
479
 
484
- module.exports = kikyy;
480
+ module.exports = kikyy;