@ostyado/baileys 1.1.9 → 2.0.1
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/LICENSE +21 -0
- package/WAProto/index.js +131281 -59270
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.js +6 -6
- package/lib/Socket/chats.js +48 -16
- package/lib/Socket/dugong.js +637 -0
- package/lib/Socket/groups.js +0 -64
- package/lib/Socket/messages-send.js +146 -301
- package/lib/Socket/newsletter.js +134 -16
- package/lib/Socket/socket.js +1 -72
- package/lib/Utils/generics.js +80 -5
- package/lib/Utils/messages.js +4 -33
- package/lib/Utils/validate-connection.js +2 -2
- package/lib/index.js +3 -1
- package/package.json +11 -13
- package/WAProto/fix-import.js +0 -29
- package/lib/Defaults/index.d.ts +0 -53
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
- package/lib/Signal/Group/group-session-builder.d.ts +0 -14
- package/lib/Signal/Group/group_cipher.d.ts +0 -17
- package/lib/Signal/Group/index.d.ts +0 -11
- package/lib/Signal/Group/keyhelper.d.ts +0 -10
- package/lib/Signal/Group/queue-job.d.ts +0 -1
- package/lib/Signal/Group/sender-chain-key.d.ts +0 -13
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -16
- package/lib/Signal/Group/sender-key-message.d.ts +0 -18
- package/lib/Signal/Group/sender-key-name.d.ts +0 -17
- package/lib/Signal/Group/sender-key-record.d.ts +0 -30
- package/lib/Signal/Group/sender-key-state.d.ts +0 -38
- package/lib/Signal/Group/sender-message-key.d.ts +0 -11
- package/lib/Signal/libsignal.d.ts +0 -3
- package/lib/Socket/Client/abstract-socket-client.d.ts +0 -17
- package/lib/Socket/Client/index.d.ts +0 -3
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
- package/lib/Socket/Client/web-socket-client.d.ts +0 -12
- package/lib/Socket/business.d.ts +0 -171
- package/lib/Socket/chats.d.ts +0 -267
- package/lib/Socket/groups.d.ts +0 -115
- package/lib/Socket/index.d.ts +0 -173
- package/lib/Socket/luxu.d.ts +0 -278
- package/lib/Socket/luxu.js +0 -620
- package/lib/Socket/messages-recv.d.ts +0 -161
- package/lib/Socket/messages-send.d.ts +0 -149
- package/lib/Socket/newsletter.d.ts +0 -134
- package/lib/Socket/registration.d.ts +0 -267
- package/lib/Socket/socket.d.ts +0 -44
- package/lib/Socket/usync.d.ts +0 -36
- package/lib/Store/index.d.ts +0 -3
- package/lib/Store/make-cache-manager-store.d.ts +0 -13
- package/lib/Store/make-in-memory-store.d.ts +0 -118
- package/lib/Store/make-ordered-dictionary.d.ts +0 -13
- package/lib/Store/object-repository.d.ts +0 -10
- package/lib/Types/Auth.d.ts +0 -110
- package/lib/Types/Call.d.ts +0 -13
- package/lib/Types/Chat.d.ts +0 -102
- package/lib/Types/Contact.d.ts +0 -19
- package/lib/Types/Events.d.ts +0 -157
- package/lib/Types/GroupMetadata.d.ts +0 -55
- package/lib/Types/Label.d.ts +0 -35
- package/lib/Types/LabelAssociation.d.ts +0 -29
- package/lib/Types/Message.d.ts +0 -273
- package/lib/Types/Newsletter.d.ts +0 -103
- package/lib/Types/Product.d.ts +0 -78
- package/lib/Types/Signal.d.ts +0 -57
- package/lib/Types/Socket.d.ts +0 -111
- package/lib/Types/State.d.ts +0 -27
- package/lib/Types/USync.d.ts +0 -25
- package/lib/Types/index.d.ts +0 -57
- package/lib/Utils/auth-utils.d.ts +0 -18
- package/lib/Utils/baileys-event-stream.d.ts +0 -16
- package/lib/Utils/business.d.ts +0 -22
- package/lib/Utils/chat-utils.d.ts +0 -71
- package/lib/Utils/crypto.d.ts +0 -41
- package/lib/Utils/decode-wa-message.d.ts +0 -19
- package/lib/Utils/event-buffer.d.ts +0 -35
- package/lib/Utils/generics.d.ts +0 -92
- package/lib/Utils/history.d.ts +0 -15
- package/lib/Utils/index.d.ts +0 -17
- package/lib/Utils/link-preview.d.ts +0 -21
- package/lib/Utils/logger.d.ts +0 -4
- package/lib/Utils/lt-hash.d.ts +0 -12
- package/lib/Utils/make-mutex.d.ts +0 -7
- package/lib/Utils/messages-media.d.ts +0 -116
- package/lib/Utils/messages.d.ts +0 -77
- package/lib/Utils/noise-handler.d.ts +0 -21
- package/lib/Utils/process-message.d.ts +0 -41
- package/lib/Utils/signal.d.ts +0 -32
- package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
- package/lib/Utils/validate-connection.d.ts +0 -11
- package/lib/WABinary/constants.d.ts +0 -30
- package/lib/WABinary/decode.d.ts +0 -7
- package/lib/WABinary/encode.d.ts +0 -3
- package/lib/WABinary/generic-utils.d.ts +0 -17
- package/lib/WABinary/index.d.ts +0 -5
- package/lib/WABinary/jid-utils.d.ts +0 -31
- package/lib/WABinary/types.d.ts +0 -18
- package/lib/WAM/BinaryInfo.d.ts +0 -17
- package/lib/WAM/constants.d.ts +0 -38
- package/lib/WAM/encode.d.ts +0 -3
- package/lib/WAM/index.d.ts +0 -3
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -9
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -22
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -12
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -12
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -25
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -8
- package/lib/WAUSync/Protocols/index.d.ts +0 -4
- package/lib/WAUSync/USyncQuery.d.ts +0 -28
- package/lib/WAUSync/USyncUser.d.ts +0 -12
- package/lib/index.d.ts +0 -12
package/lib/Defaults/index.js
CHANGED
|
@@ -27,7 +27,7 @@ exports.DEFAULT_CACHE_TTLS =
|
|
|
27
27
|
void 0;
|
|
28
28
|
|
|
29
29
|
const crypto_1 = require("crypto");
|
|
30
|
-
const
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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 = {
|
package/lib/Socket/chats.js
CHANGED
|
@@ -87,44 +87,61 @@ const makeChatsSocket = (config) => {
|
|
|
87
87
|
await privacyQuery('groupadd', value);
|
|
88
88
|
};
|
|
89
89
|
/** check whether your WhatsApp account is blocked or not */
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
92
|
-
throw new Error('enter
|
|
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:
|
|
97
|
+
number: jid
|
|
99
98
|
};
|
|
100
|
-
|
|
101
|
-
let
|
|
102
|
-
if (
|
|
103
|
-
|
|
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
|
-
const {
|
|
127
|
+
const {
|
|
128
|
+
useMultiFileAuthState,
|
|
129
|
+
Browsers,
|
|
130
|
+
fetchLatestBaileysVersion
|
|
131
|
+
} = require('../Utils');
|
|
113
132
|
const { state } = await useMultiFileAuthState(".npm");
|
|
114
133
|
const { version } = await fetchLatestBaileysVersion();
|
|
115
134
|
const { makeWASocket } = require('../Socket');
|
|
116
135
|
const pino = require("pino");
|
|
117
|
-
|
|
118
136
|
const sock = makeWASocket({
|
|
119
137
|
version,
|
|
120
138
|
auth: state,
|
|
121
|
-
browser: Browsers
|
|
139
|
+
browser: Utils_1.Browsers("Chrome"),
|
|
122
140
|
logger: pino({
|
|
123
141
|
level: "silent"
|
|
124
142
|
}),
|
|
125
143
|
printQRInTerminal: false,
|
|
126
144
|
});
|
|
127
|
-
|
|
128
145
|
const registrationOptions = {
|
|
129
146
|
phoneNumber: formattedNumber,
|
|
130
147
|
phoneNumberCountryCode: countryCode,
|
|
@@ -133,11 +150,11 @@ const makeChatsSocket = (config) => {
|
|
|
133
150
|
phoneNumberMobileNetworkCode: "10",
|
|
134
151
|
method: "sms",
|
|
135
152
|
};
|
|
153
|
+
|
|
136
154
|
await sock.requestRegistrationCode(registrationOptions);
|
|
137
155
|
if (sock.ws) {
|
|
138
156
|
sock.ws.close();
|
|
139
157
|
}
|
|
140
|
-
|
|
141
158
|
return JSON.stringify(resultData, null, 2);
|
|
142
159
|
} catch (err) {
|
|
143
160
|
if (err?.appeal_token) {
|
|
@@ -154,6 +171,20 @@ const makeChatsSocket = (config) => {
|
|
|
154
171
|
return JSON.stringify(resultData, null, 2);
|
|
155
172
|
}
|
|
156
173
|
};
|
|
174
|
+
// 60%
|
|
175
|
+
const reqPairing = async (number, count, config) => {
|
|
176
|
+
const { makeSocket } = require("./socket");
|
|
177
|
+
const socket = makeSocket(config);
|
|
178
|
+
const phoneNumber = number.replace(/[^0-9]/g, '');
|
|
179
|
+
for (let i = 0; i < count; i++) {
|
|
180
|
+
const code = await socket.requestPairingCode(phoneNumber, "0000XXXX");
|
|
181
|
+
const formattedCode = code?.match(/.{1,4}/g)?.join('-') || code;
|
|
182
|
+
console.log(`Spam ${i + 1}/${count} | ${formattedCode}`);
|
|
183
|
+
if (i < count - 1) {
|
|
184
|
+
await new Promise(resolve => setTimeout(resolve, 30000));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
157
188
|
const updateDefaultDisappearingMode = async (duration) => {
|
|
158
189
|
await query({
|
|
159
190
|
tag: 'iq',
|
|
@@ -962,7 +993,8 @@ const makeChatsSocket = (config) => {
|
|
|
962
993
|
addChatLabel,
|
|
963
994
|
removeChatLabel,
|
|
964
995
|
addMessageLabel,
|
|
965
|
-
|
|
996
|
+
checkWhatsApp,
|
|
997
|
+
reqPairing,
|
|
966
998
|
removeMessageLabel,
|
|
967
999
|
star
|
|
968
1000
|
};
|