dtec-bail 1.0.7 → 1.0.9
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 +1 -1
- package/README.md +454 -29
- package/engine-requirements.js +4 -13
- package/lib/Defaults/constants.js +74 -0
- package/lib/Defaults/media.js +48 -0
- package/lib/Socket/chats.js +15 -28
- package/lib/Socket/{dugong.d.ts → luxu.d.ts} +51 -37
- package/lib/Socket/luxu.js +591 -0
- package/lib/Socket/messages-send.js +121 -100
- package/lib/Socket/newsletter.js +132 -96
- package/lib/Socket/socket.js +10 -16
- package/lib/Utils/generics.js +1 -1
- package/lib/Utils/messages-media.js +835 -545
- package/lib/Utils/messages.js +1571 -497
- package/lib/WABinary/jid-utils.js +3 -0
- package/lib/index.js +4 -10
- package/lib/temp +1 -0
- package/package.json +12 -21
- package/lib/@Danu'Zz +0 -1
- package/lib/Socket/dugong.js +0 -484
- package/lib/WAUSync/index.d.ts +0 -3
package/lib/Socket/chats.js
CHANGED
|
@@ -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
|
|
91
|
-
if (!
|
|
92
|
-
throw new Error('enter
|
|
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:
|
|
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:
|
|
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
|
-
|
|
965
|
+
checkStatusWA,
|
|
979
966
|
removeMessageLabel,
|
|
980
967
|
star
|
|
981
968
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
// dugong.d.ts
|
|
2
1
|
import { proto } from '../../WAProto';
|
|
3
2
|
|
|
4
|
-
declare namespace
|
|
3
|
+
declare namespace imup {
|
|
5
4
|
interface MediaUploadOptions {
|
|
6
5
|
fileEncSha256?: Buffer;
|
|
7
6
|
mediaType?: string;
|
|
@@ -70,20 +69,20 @@ declare namespace kikyy {
|
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
interface InteractiveMessage {
|
|
73
|
-
header?: string;
|
|
74
72
|
title: string;
|
|
75
73
|
footer?: string;
|
|
76
74
|
thumbnail?: string;
|
|
77
75
|
image?: string | Buffer | { url: string };
|
|
78
76
|
video?: string | Buffer | { url: string };
|
|
79
|
-
document?:
|
|
77
|
+
document?: Buffer;
|
|
80
78
|
mimetype?: string;
|
|
81
79
|
fileName?: string;
|
|
82
|
-
jpegThumbnail?:
|
|
80
|
+
jpegThumbnail?: Buffer;
|
|
83
81
|
contextInfo?: {
|
|
84
82
|
mentionedJid?: string[];
|
|
85
83
|
forwardingScore?: number;
|
|
86
84
|
isForwarded?: boolean;
|
|
85
|
+
forwardedNewsletterMessageInfo?: proto.Message.ContextInfo.ForwardedNewsletterMessageInfo;
|
|
87
86
|
externalAdReply?: {
|
|
88
87
|
title?: string;
|
|
89
88
|
body?: string;
|
|
@@ -117,8 +116,8 @@ declare namespace kikyy {
|
|
|
117
116
|
}
|
|
118
117
|
|
|
119
118
|
interface AlbumItem {
|
|
120
|
-
image?:
|
|
121
|
-
video?:
|
|
119
|
+
image?: { url: string; caption?: string };
|
|
120
|
+
video?: { url: string; caption?: string };
|
|
122
121
|
}
|
|
123
122
|
|
|
124
123
|
interface EventMessageLocation {
|
|
@@ -146,9 +145,28 @@ declare namespace kikyy {
|
|
|
146
145
|
interface PollResultMessage {
|
|
147
146
|
name: string;
|
|
148
147
|
pollVotes: PollVote[];
|
|
148
|
+
newsletter?: {
|
|
149
|
+
newsletterName: string;
|
|
150
|
+
newsletterJid: string;
|
|
151
|
+
};
|
|
149
152
|
}
|
|
150
153
|
|
|
151
|
-
interface
|
|
154
|
+
interface StatusMentionMessage {
|
|
155
|
+
image?: { url: string } | string;
|
|
156
|
+
video?: { url: string } | string;
|
|
157
|
+
mentions: string[];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
interface OrderMessage {
|
|
161
|
+
thumbnail?: Buffer | string,
|
|
162
|
+
itemCount?: string | number,
|
|
163
|
+
message: string,
|
|
164
|
+
orderTitle: string,
|
|
165
|
+
totalAmount1000?: string | number,
|
|
166
|
+
totalCurrencyCode?: string
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
interface GroupStatus {
|
|
152
170
|
message?: any;
|
|
153
171
|
image?: string | Buffer | { url: string };
|
|
154
172
|
video?: string | Buffer | { url: string };
|
|
@@ -165,7 +183,8 @@ declare namespace kikyy {
|
|
|
165
183
|
albumMessage?: AlbumItem[];
|
|
166
184
|
eventMessage?: EventMessage;
|
|
167
185
|
pollResultMessage?: PollResultMessage;
|
|
168
|
-
|
|
186
|
+
statusMentionMessage?: StatusMentionMessage;
|
|
187
|
+
orderMessage?: OrderMessage;
|
|
169
188
|
sender?: string;
|
|
170
189
|
}
|
|
171
190
|
|
|
@@ -180,75 +199,70 @@ declare namespace kikyy {
|
|
|
180
199
|
generateWAMessageFromContent: (jid: string, content: any, options?: any) => Promise<any>;
|
|
181
200
|
generateWAMessage: (jid: string, content: any, options?: any) => Promise<any>;
|
|
182
201
|
generateMessageID: () => string;
|
|
183
|
-
prepareMessageContent?: (content: any, options?: any) => Promise<any>;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
interface BailUtils {
|
|
187
|
-
generateWAMessageContent?: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
|
|
188
|
-
generateMessageID: () => string;
|
|
189
|
-
getContentType: (msg: any) => string;
|
|
190
202
|
}
|
|
191
203
|
}
|
|
192
204
|
|
|
193
|
-
declare class
|
|
205
|
+
declare class imup {
|
|
194
206
|
constructor(
|
|
195
|
-
utils:
|
|
196
|
-
waUploadToServer:
|
|
207
|
+
utils: imup.Utils,
|
|
208
|
+
waUploadToServer: imup.WAMediaUploadFunction,
|
|
197
209
|
relayMessageFn?: (jid: string, content: any, options?: any) => Promise<any>
|
|
198
210
|
);
|
|
199
211
|
|
|
200
|
-
detectType(content:
|
|
212
|
+
detectType(content: imup.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | 'STATUS_MENTION' | 'ORDER' | null;
|
|
201
213
|
|
|
202
214
|
handlePayment(
|
|
203
|
-
content: { requestPaymentMessage:
|
|
215
|
+
content: { requestPaymentMessage: imup.PaymentMessage },
|
|
204
216
|
quoted?: proto.IWebMessageInfo
|
|
205
217
|
): Promise<{ requestPaymentMessage: proto.Message.RequestPaymentMessage }>;
|
|
206
218
|
|
|
207
219
|
handleProduct(
|
|
208
|
-
content: { productMessage:
|
|
220
|
+
content: { productMessage: imup.ProductMessage },
|
|
209
221
|
jid: string,
|
|
210
222
|
quoted?: proto.IWebMessageInfo
|
|
211
223
|
): Promise<{ viewOnceMessage: proto.Message.ViewOnceMessage }>;
|
|
212
224
|
|
|
213
225
|
handleInteractive(
|
|
214
|
-
content: { interactiveMessage:
|
|
226
|
+
content: { interactiveMessage: imup.InteractiveMessage },
|
|
215
227
|
jid: string,
|
|
216
228
|
quoted?: proto.IWebMessageInfo
|
|
217
229
|
): Promise<{ interactiveMessage: proto.Message.InteractiveMessage }>;
|
|
218
230
|
|
|
219
231
|
handleAlbum(
|
|
220
|
-
content: { albumMessage:
|
|
232
|
+
content: { albumMessage: imup.AlbumItem[] },
|
|
221
233
|
jid: string,
|
|
222
234
|
quoted?: proto.IWebMessageInfo
|
|
223
235
|
): Promise<any>;
|
|
224
236
|
|
|
225
237
|
handleEvent(
|
|
226
|
-
content: { eventMessage:
|
|
238
|
+
content: { eventMessage: imup.EventMessage },
|
|
227
239
|
jid: string,
|
|
228
240
|
quoted?: proto.IWebMessageInfo
|
|
229
241
|
): Promise<any>;
|
|
230
242
|
|
|
231
243
|
handlePollResult(
|
|
232
|
-
content: { pollResultMessage:
|
|
244
|
+
content: { pollResultMessage: imup.PollResultMessage },
|
|
233
245
|
jid: string,
|
|
234
246
|
quoted?: proto.IWebMessageInfo
|
|
235
247
|
): Promise<any>;
|
|
236
248
|
|
|
237
|
-
|
|
238
|
-
content: {
|
|
249
|
+
handleStMention(
|
|
250
|
+
content: { statusMentionMessage: imup.StatusMentionMessage },
|
|
239
251
|
jid: string,
|
|
240
252
|
quoted?: proto.IWebMessageInfo
|
|
241
253
|
): Promise<any>;
|
|
242
254
|
|
|
243
|
-
|
|
244
|
-
content:
|
|
245
|
-
|
|
255
|
+
handleOrderMessage(
|
|
256
|
+
content: { orderMessage: imup.OrderMessage },
|
|
257
|
+
jid: string,
|
|
258
|
+
quoted?: proto.IWebMessageInfo
|
|
259
|
+
): Promise<any>;
|
|
260
|
+
|
|
261
|
+
handleGroupStory(
|
|
262
|
+
content: { orderMessage: imup.GroupStatus },
|
|
263
|
+
jid: string,
|
|
264
|
+
quoted?: proto.IWebMessageInfo
|
|
246
265
|
): Promise<any>;
|
|
247
|
-
|
|
248
|
-
utils: kikyy.Utils;
|
|
249
|
-
relayMessage: (jid: string, content: any, options?: any) => Promise<any>;
|
|
250
|
-
waUploadToServer: kikyy.WAMediaUploadFunction;
|
|
251
|
-
bail: kikyy.BailUtils;
|
|
252
266
|
}
|
|
253
267
|
|
|
254
|
-
export =
|
|
268
|
+
export = imup;
|