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.
@@ -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,6 @@
1
- // dugong.d.ts
2
1
  import { proto } from '../../WAProto';
3
2
 
4
- declare namespace kikyy {
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?: string | Buffer | { url: string };
77
+ document?: Buffer;
80
78
  mimetype?: string;
81
79
  fileName?: string;
82
- jpegThumbnail?: string | Buffer | { url: string };
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?: string | Buffer | { url: string; caption?: string };
121
- video?: string | Buffer | { url: string; caption?: string };
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 GroupStatusMessage {
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
- groupStatusMessage?: GroupStatusMessage;
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 kikyy {
205
+ declare class imup {
194
206
  constructor(
195
- utils: kikyy.Utils,
196
- waUploadToServer: kikyy.WAMediaUploadFunction,
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: kikyy.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | 'GROUP_STORY' | null;
212
+ detectType(content: imup.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | 'STATUS_MENTION' | 'ORDER' | null;
201
213
 
202
214
  handlePayment(
203
- content: { requestPaymentMessage: kikyy.PaymentMessage },
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: kikyy.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: kikyy.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: kikyy.AlbumItem[] },
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: kikyy.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: kikyy.PollResultMessage },
244
+ content: { pollResultMessage: imup.PollResultMessage },
233
245
  jid: string,
234
246
  quoted?: proto.IWebMessageInfo
235
247
  ): Promise<any>;
236
248
 
237
- handleGroupStory(
238
- content: { groupStatusMessage: kikyy.GroupStatusMessage },
249
+ handleStMention(
250
+ content: { statusMentionMessage: imup.StatusMentionMessage },
239
251
  jid: string,
240
252
  quoted?: proto.IWebMessageInfo
241
253
  ): Promise<any>;
242
254
 
243
- buildMessageContent(
244
- content: any,
245
- opts?: kikyy.WAMessageContentGenerationOptions
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 = kikyy;
268
+ export = imup;