-
Notifications
You must be signed in to change notification settings - Fork 73
/
index.js
313 lines (274 loc) · 27 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
/*
* Information
* Creator / Developer: Dani Ramdani (Dani Techno.) - FullStack Engineer
* Contact creator / Developer: 0895 1254 5999 (WhatsApp), contact@danitechno.com (Email)
*/
/* Thanks to
* Dani Techno. - FullStack Engineer (Creator / Developer)
* daniapi.biz.id (API provider)
* api.caliph.biz.id (API provider)
* @danitech/scraper (Scraper provider)
* @whiskeysockets/baileys (Library "Baileys" provider)
* @adiwajshing/keyed-db
* @hapi/boom
* pino
* qrcode-terminal
* chalk
* mongoose
* node-cron
* nodemon
* other
*/
const {
makeWASocket,
useMultiFileAuthState,
makeInMemoryStore,
PHONENUMBER_MCC,
makeCacheableSignalKeyStore,
jidDecode,
downloadContentFromMessage,
DisconnectReason
} = require('@whiskeysockets/baileys');
const {
Boom
} = require('@hapi/boom');
const pino = require('pino');
const readLine = require('readline');
const qrCodeTerminal = require('qrcode-terminal');
const chalk = require('chalk');
const fs = require('fs');
const mongoose = require('mongoose');
const cron = require('node-cron');
const FileType = require('file-type');
const config = require('./config/settings.js');
const db = require('./models/connectionModel.js');
const userSchema = require('./models/schemaModel.js');
const {
smsg,
fetchJson,
fetchBuffer,
writeExifImage,
writeExifVideo,
imageToWebp,
videoToWebp
} = require('./utils/functionsUtils.js');
const store = makeInMemoryStore({
logger: pino().child({
level: 'silent',
stream: 'store'
})
});
async function startServer() {
try {
// Apa? mau marah?
// Script no encrypt dijual,
// harga? langsung tanya ke:
// 0895 1254 5999 (WhatsApp only)
// atau 0882 9633 9947 (WhatsApp only)
// MakeWASocket (Pairing Code)
function _0x353be0(_0x120494,_0x3713de,_0x123a10,_0x15ebba,_0x450305){return _0x512a(_0x120494- -0x23b,_0x3713de);}(function(_0x3b5fbd,_0x553751){function _0x4ef16f(_0x1d90b9,_0x5266ae,_0x303c53,_0x2f9e0b,_0x5768f9){return _0x512a(_0x1d90b9-0xcb,_0x2f9e0b);}function _0xc1e0d5(_0x1ba041,_0x5967df,_0x4f3749,_0x38cd22,_0x33eded){return _0x512a(_0x4f3749-0x2b7,_0x5967df);}function _0x5c4e9f(_0x55bb3c,_0x5a5380,_0x1685b7,_0x22f93f,_0x1af536){return _0x512a(_0x1af536-0x23f,_0x1685b7);}const _0x55929d=_0x3b5fbd();function _0x479b8f(_0x3d1c8d,_0x1655c7,_0x1523ef,_0x21a7e5,_0x3ed1bb){return _0x512a(_0x3d1c8d-0xd9,_0x1655c7);}function _0x59b54d(_0x277e02,_0x4fe489,_0x328964,_0x324372,_0x178e9c){return _0x512a(_0x178e9c-0x1cc,_0x324372);}while(!![]){try{const _0x39b61d=parseInt(_0x5c4e9f(0x30a,0x2ab,0x307,0x2af,0x2db))/(0x14dd+-0x1*0x219+-0x12c3)*(-parseInt(_0xc1e0d5(0x3b4,0x3a5,0x3a1,0x3db,0x395))/(-0x1a4+-0x2290+0x2436))+-parseInt(_0x4ef16f(0x16b,0x198,0x183,0x175,0x12e))/(-0x234e*-0x1+0x3b3+0x17*-0x1b2)*(-parseInt(_0xc1e0d5(0x3da,0x3a6,0x3a9,0x3aa,0x3a7))/(-0x1*0x10fd+0x321*0x5+0x15c))+-parseInt(_0x5c4e9f(0x33d,0x30a,0x36e,0x362,0x336))/(-0x2393+0xb04+-0x1e4*-0xd)+-parseInt(_0x5c4e9f(0x2f1,0x30e,0x33c,0x34a,0x31e))/(-0x1dd5+0x2386+-0x5ab*0x1)*(parseInt(_0x4ef16f(0x1a4,0x1b0,0x1bb,0x180,0x1aa))/(0x12f3+-0x82a+-0xac2))+-parseInt(_0x4ef16f(0x177,0x193,0x14b,0x195,0x198))/(-0x1*0x251e+0x1501+0x1025*0x1)+parseInt(_0x5c4e9f(0x2cf,0x2ca,0x329,0x321,0x303))/(0x210f+-0x1*0x1b0d+0x1*-0x5f9)+parseInt(_0x479b8f(0x1a1,0x1db,0x1dc,0x1cd,0x166))/(0x1f12+0x1*-0x1a32+-0x4d6);if(_0x39b61d===_0x553751)break;else _0x55929d['push'](_0x55929d['shift']());}catch(_0xbae57a){_0x55929d['push'](_0x55929d['shift']());}}}(_0x19f7,-0x46cef+-0x72407+0x120885));const _0x24b688=(function(){const _0x13d204={};function _0xfae5f5(_0x1d650f,_0xa03a42,_0x371702,_0x60abcf,_0x5a9e49){return _0x512a(_0x60abcf- -0x9b,_0x5a9e49);}_0x13d204[_0x1f4528(0x72,0x9a,0xa9,0xaa,0x7a)]=function(_0x52b4a2,_0x55874c){return _0x52b4a2===_0x55874c;};function _0x15de8d(_0xc86cd6,_0x55bb38,_0x2420db,_0x4d4442,_0x243942){return _0x512a(_0x2420db- -0x1e0,_0xc86cd6);}function _0x4060d7(_0xf86c3b,_0x579abf,_0x2b2e0d,_0x5e7bc8,_0x377d3c){return _0x512a(_0x579abf- -0xdd,_0x377d3c);}_0x13d204[_0x1f4528(0xfb,0x107,0xf0,0xfb,0x10a)]=_0x15de8d(-0xff,-0xf4,-0x12a,-0x10e,-0xf3),_0x13d204[_0x15de8d(-0xc9,-0xa6,-0xd3,-0x108,-0xa7)]=function(_0x39b8bc,_0xd5d847){return _0x39b8bc!==_0xd5d847;},_0x13d204[_0x4060d7(-0x16,-0x3c,-0x5b,-0x2e,-0x22)]=_0x15de8d(-0x135,-0x10e,-0x120,-0x12c,-0x14c),_0x13d204[_0x15de8d(-0xbc,-0xba,-0xeb,-0xc7,-0xb7)]=_0x4b8526(-0x63,-0x78,-0x3b,-0x49,-0x41),_0x13d204[_0x1f4528(0x10c,0xbe,0xed,0xd0,0xbf)]=_0x15de8d(-0xfb,-0xb2,-0xe3,-0xef,-0xe5);function _0x4b8526(_0xba95be,_0x98b7aa,_0x145269,_0x325ea5,_0x56f422){return _0x512a(_0x56f422- -0x143,_0x325ea5);}const _0x5c0681=_0x13d204;let _0x427311=!![];function _0x1f4528(_0x339517,_0x3b36c8,_0x44edf5,_0x2a13d2,_0x5806bd){return _0x512a(_0x2a13d2-0x12,_0x44edf5);}return function(_0x2541ee,_0x5543ad){function _0x22734f(_0x231d7a,_0x44f32b,_0x571b8d,_0x335e96,_0x1e6a38){return _0x4060d7(_0x231d7a-0x28,_0x1e6a38-0x82,_0x571b8d-0x78,_0x335e96-0x40,_0x571b8d);}function _0x23e5b6(_0x226354,_0x556651,_0x46451f,_0x1686b5,_0x37a79a){return _0x4b8526(_0x226354-0x90,_0x556651-0x5d,_0x46451f-0x16f,_0x226354,_0x37a79a- -0x176);}function _0x1ea05f(_0x1892f8,_0x5b63eb,_0xb45c04,_0x1eb7c7,_0x53c73a){return _0x1f4528(_0x1892f8-0x13a,_0x5b63eb-0xdd,_0x1eb7c7,_0x53c73a-0x277,_0x53c73a-0x1ac);}function _0x533cc8(_0x26fb53,_0x10ec33,_0x168f87,_0x5a728e,_0x37813b){return _0x1f4528(_0x26fb53-0x1ce,_0x10ec33-0x1d2,_0x10ec33,_0x26fb53-0x242,_0x37813b-0x117);}if(_0x5c0681[_0x22734f(0x54,0x34,0x0,0x7a,0x3d)](_0x5c0681[_0x533cc8(0x349,0x336,0x380,0x322,0x31f)],_0x5c0681[_0x533cc8(0x312,0x335,0x31f,0x306,0x2f6)])){if(_0xa31ae2){const _0x15aa9c=_0x7051a[_0x533cc8(0x305,0x2ef,0x304,0x2e5,0x336)](_0x4ef459,arguments);return _0x1e9518=null,_0x15aa9c;}}else{const _0x15d84c=_0x427311?function(){function _0x2fb4be(_0x42f6da,_0x468a8d,_0xeea3e,_0x28bd15,_0x17bb16){return _0x22734f(_0x42f6da-0x5,_0x468a8d-0x1bf,_0x42f6da,_0x28bd15-0x128,_0x468a8d- -0x194);}function _0x3cc68a(_0xbbea1e,_0x5d9d1f,_0x44afb2,_0x2f900e,_0x25c129){return _0x533cc8(_0x25c129-0x76,_0xbbea1e,_0x44afb2-0xed,_0x2f900e-0x13b,_0x25c129-0x82);}function _0x29c283(_0x3b0bfe,_0x3c1da5,_0x32f951,_0x3b0f38,_0x38372a){return _0x1ea05f(_0x3b0bfe-0xe9,_0x3c1da5-0xc6,_0x32f951-0xc,_0x38372a,_0x3b0bfe- -0x5a0);}function _0x1007ba(_0x7f8128,_0x17e411,_0x3ce368,_0x288b0c,_0x292d41){return _0x22734f(_0x7f8128-0xbe,_0x17e411-0x10c,_0x292d41,_0x288b0c-0x1d8,_0x7f8128- -0xdc);}function _0x501ed0(_0xa9ea3a,_0x1f504b,_0x10cd2b,_0x2c1286,_0x40d8c7){return _0x533cc8(_0x40d8c7- -0xa8,_0x1f504b,_0x10cd2b-0x13a,_0x2c1286-0xdb,_0x40d8c7-0xb6);}if(_0x5c0681[_0x3cc68a(0x327,0x327,0x385,0x372,0x362)](_0x5c0681[_0x3cc68a(0x3c6,0x3af,0x3a9,0x379,0x3b3)],_0x5c0681[_0x1007ba(-0x4e,-0x4e,-0x7d,-0x19,-0x3d)])){if(_0x5543ad){if(_0x5c0681[_0x29c283(-0x20a,-0x23a,-0x240,-0x1ee,-0x1f9)](_0x5c0681[_0x1007ba(-0x96,-0xd2,-0x98,-0x72,-0xc7)],_0x5c0681[_0x3cc68a(0x37f,0x354,0x3a2,0x372,0x36b)])){const _0xc35457=_0x3d4c41[_0x3cc68a(0x392,0x3a3,0x37f,0x34d,0x37b)](_0x58815c,arguments);return _0x563f8d=null,_0xc35457;}else{const _0x3f4e3b=_0x5543ad[_0x1007ba(-0x86,-0x6b,-0x92,-0xa8,-0xa4)](_0x2541ee,arguments);return _0x5543ad=null,_0x3f4e3b;}}}else{const _0x47a75c=_0x32bfa5?function(){function _0x533869(_0x3c87e9,_0x266709,_0x56e2ee,_0x3dc0d7,_0x437b06){return _0x29c283(_0x3c87e9-0x60c,_0x266709-0x144,_0x56e2ee-0x5d,_0x3dc0d7-0x2d,_0x266709);}if(_0x5d89ef){const _0x2c9401=_0x3a114b[_0x533869(0x3a6,0x3b5,0x372,0x370,0x3c0)](_0x40db08,arguments);return _0x37d37d=null,_0x2c9401;}}:function(){};return _0x460d19=![],_0x47a75c;}}:function(){};return _0x427311=![],_0x15d84c;}};}());function _0x512a(_0x19f700,_0x512a89){const _0x24fd12=_0x19f7();return _0x512a=function(_0x30804e,_0x3590d1){_0x30804e=_0x30804e-(-0x63+-0x1fe1+0x20dc);let _0x200f67=_0x24fd12[_0x30804e];return _0x200f67;},_0x512a(_0x19f700,_0x512a89);}function _0x65a4d2(_0x477d51,_0x586ed6,_0x5209f8,_0x458a9a,_0x51fe8d){return _0x512a(_0x586ed6- -0x75,_0x458a9a);}const _0xef4cc2=_0x24b688(this,function(){const _0x5de769={};_0x5de769[_0xd626bb(0x221,0x1f7,0x214,0x1f2,0x1eb)]=_0x107033(0x7,0x64,0x3e,0x57,0x3b)+_0xd626bb(0x239,0x276,0x1fd,0x243,0x268)+'+$';function _0x3b8914(_0x239193,_0x2b2fcb,_0x4a1c7f,_0x47833a,_0x1263e7){return _0x512a(_0x47833a- -0x25f,_0x4a1c7f);}function _0xd626bb(_0x505eaf,_0x10a079,_0x2e3fca,_0x2b9d6a,_0x50071c){return _0x512a(_0x505eaf-0x13d,_0x10a079);}function _0x107033(_0x308f3c,_0x839927,_0x24f6ce,_0x37168c,_0xb97403){return _0x512a(_0xb97403- -0xa1,_0x37168c);}function _0x55cc94(_0x4ba3db,_0x108797,_0x2d6fb7,_0x14f088,_0xa8755){return _0x512a(_0x4ba3db- -0x264,_0x2d6fb7);}const _0x533db9=_0x5de769;function _0x5c477a(_0x155b55,_0x2cbbda,_0x41e4b2,_0x32ab3f,_0x5dc0d2){return _0x512a(_0x41e4b2-0x2ec,_0x32ab3f);}return _0xef4cc2[_0xd626bb(0x23b,0x257,0x264,0x25a,0x26a)+_0x55cc94(-0x1c6,-0x1c0,-0x1de,-0x1b5,-0x19a)]()[_0x55cc94(-0x169,-0x188,-0x140,-0x136,-0x161)+'h'](_0x533db9[_0x107033(0x2b,0x33,0x62,0x70,0x43)])[_0x55cc94(-0x166,-0x14a,-0x16d,-0x13a,-0x190)+_0x5c477a(0x35d,0x394,0x38a,0x352,0x3ba)]()[_0x107033(0x5c,0x5c,0x44,0x25,0x3d)+_0x55cc94(-0x1a9,-0x1d8,-0x1df,-0x1ca,-0x1de)+'r'](_0xef4cc2)[_0x5c477a(0x3bb,0x3d1,0x3e7,0x3ea,0x3de)+'h'](_0x533db9[_0x3b8914(-0x146,-0x15b,-0x19b,-0x17b,-0x16d)]);});_0xef4cc2();const _0x3b0823={};_0x3b0823[_0x3f8942(0x2d0,0x311,0x2ee,0x2ef,0x2bf)]=process[_0x3f8942(0x346,0x300,0x31c,0x33a,0x333)],_0x3b0823[_0x32cdc0(0x45b,0x420,0x411,0x43f,0x421)+'t']=process[_0x6e9cdf(-0x134,-0xea,-0xde,-0x10f,-0x139)+'t'];const rl=readLine[_0x32cdc0(0x3ec,0x3fb,0x449,0x40f,0x43d)+_0x3f8942(0x31b,0x34a,0x345,0x347,0x37c)+_0x3f8942(0x313,0x31a,0x311,0x308,0x33c)](_0x3b0823),question=_0x4b12dc=>new Promise(_0x5e593d=>rl[_0x32cdc0(0x436,0x458,0x453,0x43b,0x460)+_0x65a4d2(0x56,0x8c,0x76,0xb5,0xa2)](_0x4b12dc,_0x5e593d));function _0x6e9cdf(_0x2a2d99,_0x550f87,_0x4b2925,_0x31b40a,_0x51c068){return _0x512a(_0x31b40a- -0x205,_0x550f87);}function _0x32cdc0(_0x1f7dd9,_0x3cd34e,_0x42d77a,_0x3b20f3,_0x4561b1){return _0x512a(_0x3b20f3-0x338,_0x42d77a);}const pairingCode=config[_0x353be0(-0x188,-0x1b1,-0x167,-0x1c4,-0x1a9)+_0x6e9cdf(-0xf6,-0x10d,-0xff,-0x125,-0x11d)+'de']||process[_0x6e9cdf(-0x141,-0x176,-0x129,-0x15a,-0x12e)][_0x32cdc0(0x3b7,0x3f4,0x40c,0x3df,0x408)+_0x32cdc0(0x426,0x431,0x42b,0x419,0x412)](_0x3f8942(0x307,0x2d9,0x2e6,0x2f9,0x31f)+_0x32cdc0(0x43a,0x416,0x43c,0x441,0x446)+_0x3f8942(0x387,0x315,0x351,0x351,0x384)),useMobile=process[_0x6e9cdf(-0x13c,-0x129,-0x189,-0x15a,-0x18f)][_0x65a4d2(0x1c,0x32,0x6a,0x4e,0x22)+_0x32cdc0(0x414,0x431,0x40c,0x419,0x43a)](_0x32cdc0(0x3ec,0x3e9,0x42a,0x3f9,0x427)+_0x3f8942(0x306,0x2ca,0x2ea,0x2d2,0x2e8)),{state,saveCreds}=await useMultiFileAuthState('./'+config[_0x65a4d2(0x51,0x24,0x21,0x1,0x32)+_0x6e9cdf(-0x148,-0x19f,-0x184,-0x162,-0x17a)+_0x6e9cdf(-0xf4,-0x108,-0xcf,-0xff,-0x115)+_0x353be0(-0x15e,-0x140,-0x18a,-0x16c,-0x125)]),_0x167915={};_0x167915[_0x3f8942(0x332,0x2d7,0x313,0x30f,0x336)]=_0x32cdc0(0x430,0x3ea,0x427,0x40d,0x3f7)+'t';const _0x364147={};function _0x3f8942(_0x48b6bb,_0x229ca4,_0x26c53c,_0x3aa9e4,_0x43fae4){return _0x512a(_0x26c53c-0x241,_0x43fae4);}_0x364147[_0x65a4d2(0x47,0x5d,0x59,0x8c,0x38)]=_0x353be0(-0x166,-0x14d,-0x18f,-0x12d,-0x13d)+'t';const _0x236d85={};_0x236d85[_0x3f8942(0x302,0x316,0x313,0x32c,0x2ea)]=_0x353be0(-0x166,-0x133,-0x194,-0x17e,-0x130)+'t';const sock=makeWASocket({'logger':pino(_0x167915),'printQRInTerminal':!pairingCode,'mobile':useMobile,'auth':{'creds':state[_0x353be0(-0x17f,-0x199,-0x19e,-0x185,-0x14e)],'keys':makeCacheableSignalKeyStore(state[_0x353be0(-0x183,-0x171,-0x17a,-0x19b,-0x1a3)],pino(_0x364147)[_0x6e9cdf(-0x16e,-0x114,-0x119,-0x148,-0x114)](_0x236d85))},'browser':config[_0x32cdc0(0x3ff,0x442,0x43d,0x427,0x424)+'er']});store[_0x32cdc0(0x404,0x41f,0x3d4,0x409,0x3ff)](sock['ev']);if(pairingCode&&!sock[_0x3f8942(0x331,0x332,0x34f,0x345,0x378)+_0x32cdc0(0x3f5,0x451,0x44b,0x42c,0x469)][_0x353be0(-0x17f,-0x169,-0x180,-0x182,-0x199)][_0x65a4d2(0x62,0x8b,0xc1,0x92,0x62)+_0x353be0(-0x187,-0x18d,-0x15a,-0x16f,-0x176)]){if(useMobile)throw new Error(_0x6e9cdf(-0x11b,-0x11b,-0x15e,-0x153,-0x15d)+_0x32cdc0(0x412,0x416,0x41d,0x424,0x3fb)+_0x6e9cdf(-0x158,-0x157,-0x13c,-0x14b,-0x161)+_0x32cdc0(0x3d4,0x3fe,0x3f5,0x40c,0x3dc)+_0x3f8942(0x2db,0x2cf,0x2e9,0x2fe,0x2f2)+_0x6e9cdf(-0x190,-0x150,-0x147,-0x15f,-0x129)+_0x6e9cdf(-0xdc,-0xf0,-0xf1,-0xfd,-0xc0)+_0x32cdc0(0x3fe,0x40c,0x43a,0x410,0x41e));let phoneNumber;!!phoneNumber?(phoneNumber=phoneNumber[_0x65a4d2(0x6b,0x5a,0x4b,0x90,0x8e)+'ce'](/[^0-9]/g,''),!Object[_0x6e9cdf(-0x153,-0x172,-0x178,-0x14d,-0x12b)](PHONENUMBER_MCC)[_0x3f8942(0x2fc,0x324,0x30f,0x2ea,0x2e1)](_0x13de57=>phoneNumber[_0x32cdc0(0x3f4,0x3d5,0x3fc,0x3e8,0x3fd)+_0x6e9cdf(-0x11e,-0x125,-0x114,-0x11a,-0x103)](_0x13de57))&&(console[_0x32cdc0(0x3d3,0x40c,0x41d,0x40e,0x41d)](chalk[_0x65a4d2(0x34,0x26,0x2c,0x2c,0x25)+'ck'](chalk[_0x3f8942(0x33f,0x32d,0x329,0x32d,0x347)+_0x353be0(-0x156,-0x14a,-0x154,-0x165,-0x137)](_0x65a4d2(0xc,0x35,-0x7,0x24,0x3c)+_0x6e9cdf(-0xf2,-0x12d,-0x11b,-0x106,-0xd6)+_0x353be0(-0x1a1,-0x1bb,-0x180,-0x1bd,-0x1a9)+_0x3f8942(0x2de,0x2f2,0x2e5,0x313,0x312)+_0x32cdc0(0x462,0x428,0x424,0x432,0x416)+_0x65a4d2(0x32,0x4d,0x2f,0x31,0x73)+_0x65a4d2(0x99,0x84,0x87,0x62,0x5d)+_0x32cdc0(0x428,0x47e,0x43d,0x444,0x427)+_0x3f8942(0x2db,0x2ee,0x306,0x2d6,0x2e9)+_0x32cdc0(0x43a,0x429,0x438,0x401,0x40f)+_0x65a4d2(0x19,0x42,0x57,0x67,0x66)+_0x3f8942(0x2eb,0x31c,0x30b,0x307,0x2f6)+_0x32cdc0(0x422,0x409,0x3e9,0x3f7,0x415)+'x'),_0x65a4d2(0xa2,0x7e,0x5a,0x53,0xb1))),process[_0x6e9cdf(-0x10f,-0xf7,-0x152,-0x11f,-0xe9)](-0xbc1+-0x162*-0x16+-0x9*0x213)),rl[_0x353be0(-0x19c,-0x198,-0x1c5,-0x18f,-0x196)]()):(phoneNumber=await question(chalk[_0x6e9cdf(-0x18c,-0x151,-0x174,-0x16a,-0x1a5)+'ck'](chalk[_0x6e9cdf(-0xe6,-0x13e,-0x111,-0x114,-0x146)+_0x3f8942(0x2ed,0x2e9,0x314,0x30a,0x2de)+'t'](_0x32cdc0(0x40b,0x3fe,0x3f0,0x428,0x40b)+_0x6e9cdf(-0x166,-0x17a,-0x143,-0x157,-0x18d)+_0x6e9cdf(-0x150,-0x15d,-0x16b,-0x13f,-0x148)+_0x6e9cdf(-0xf9,-0xfa,-0xc5,-0xfb,-0xc3)+_0x65a4d2(0x90,0x57,0x82,0x79,0x25)+_0x65a4d2(0x7b,0x52,0x86,0x5f,0x3f)+_0x32cdc0(0x42c,0x447,0x45d,0x443,0x445)+_0x6e9cdf(-0xda,-0x137,-0x116,-0x100,-0x12d)+_0x353be0(-0x143,-0x16f,-0x120,-0x146,-0x111)+_0x3f8942(0x348,0x330,0x30c,0x321,0x32c)+'x'),_0x3f8942(0x30e,0x356,0x334,0x32f,0x344))),phoneNumber=phoneNumber[_0x353be0(-0x16c,-0x16e,-0x188,-0x164,-0x159)+'ce'](/[^0-9]/g,''),!Object[_0x353be0(-0x183,-0x166,-0x14c,-0x1bb,-0x1b5)](PHONENUMBER_MCC)[_0x353be0(-0x16d,-0x17f,-0x1a2,-0x14f,-0x156)](_0xe405b8=>phoneNumber[_0x65a4d2(0x26,0x3b,0x6a,0xd,0x2a)+_0x353be0(-0x150,-0x127,-0x119,-0x187,-0x13b)](_0xe405b8))&&(console[_0x6e9cdf(-0x10f,-0x16b,-0x134,-0x12f,-0x147)](chalk[_0x3f8942(0x2ba,0x2c5,0x2dc,0x2e8,0x2bb)+'ck'](chalk[_0x32cdc0(0x401,0x3ea,0x403,0x420,0x3f3)+_0x32cdc0(0x3ee,0x3fd,0x41b,0x41d,0x3f6)](_0x32cdc0(0x412,0x3a8,0x3b0,0x3e2,0x3d6)+_0x6e9cdf(-0xfb,-0x114,-0x126,-0x106,-0x12a)+_0x6e9cdf(-0x157,-0x14c,-0x162,-0x16b,-0x14f)+_0x353be0(-0x197,-0x1d3,-0x18f,-0x16d,-0x181)+_0x65a4d2(0x76,0x85,0x82,0x7c,0x5d)+_0x32cdc0(0x400,0x401,0x407,0x3fa,0x3fe)+_0x6e9cdf(-0xed,-0x111,-0xfe,-0x10c,-0x143)+_0x3f8942(0x31f,0x355,0x34d,0x334,0x326)+_0x3f8942(0x2cb,0x2ca,0x306,0x32b,0x317)+_0x32cdc0(0x43c,0x415,0x43b,0x401,0x3f0)+_0x65a4d2(0x7b,0x42,0x23,0x72,0x5b)+_0x65a4d2(0x79,0x55,0x3a,0x20,0x7c)+_0x353be0(-0x17c,-0x13f,-0x184,-0x168,-0x183)+'x'),_0x353be0(-0x148,-0x113,-0x123,-0x13b,-0x176))),phoneNumber=await question(chalk[_0x65a4d2(0x29,0x26,0x4e,-0x1,0x7)+'ck'](chalk[_0x6e9cdf(-0x13a,-0x116,-0xf1,-0x114,-0x112)+_0x353be0(-0x168,-0x17e,-0x169,-0x148,-0x151)+'t'](_0x3f8942(0x365,0x2fa,0x331,0x31b,0x341)+_0x32cdc0(0x3b7,0x3e4,0x40e,0x3e6,0x40e)+_0x353be0(-0x175,-0x19f,-0x19b,-0x15b,-0x1b2)+_0x3f8942(0x325,0x37b,0x34b,0x312,0x365)+_0x3f8942(0x33e,0x30e,0x30d,0x2f9,0x2fc)+_0x3f8942(0x2d4,0x30c,0x308,0x300,0x310)+_0x3f8942(0x334,0x32b,0x34c,0x374,0x329)+_0x3f8942(0x33c,0x328,0x346,0x326,0x348)+_0x353be0(-0x143,-0x141,-0x173,-0x154,-0x132)+_0x32cdc0(0x426,0x41d,0x434,0x403,0x417)+'x'),_0x3f8942(0x349,0x334,0x334,0x36f,0x33a))),phoneNumber=phoneNumber[_0x353be0(-0x16c,-0x144,-0x19f,-0x189,-0x186)+'ce'](/[^0-9]/g,''),rl[_0x6e9cdf(-0x137,-0x164,-0x155,-0x166,-0x15b)]())),setTimeout(async()=>{const _0x5c6a16={};_0x5c6a16[_0x18a699(0x3d4,0x3f5,0x41c,0x414,0x3ea)]=_0x2ff64e(0x35e,0x328,0x356,0x349,0x369)+_0x31d6be(-0x165,-0x173,-0x171,-0x190,-0x185)+_0x18a699(0x402,0x409,0x402,0x3d1,0x418)+_0x4e1b5a(0x5b,0x1e,0x52,0xa,0x28);function _0x41bce2(_0x203122,_0x5b3623,_0x1d98b9,_0x2a86f3,_0x1cf78d){return _0x353be0(_0x1d98b9-0x3fe,_0x203122,_0x1d98b9-0x10c,_0x2a86f3-0x16c,_0x1cf78d-0x170);}const _0x5edd23=_0x5c6a16;function _0x31d6be(_0x2ea469,_0x3500e7,_0x524b1b,_0x312228,_0x1953f8){return _0x353be0(_0x3500e7-0x5,_0x312228,_0x524b1b-0x183,_0x312228-0x1b1,_0x1953f8-0x1ba);}let _0x2e3227=await sock[_0x4e1b5a(0x42,-0x16,0x8,0x8,0x1b)+_0x4e1b5a(0x31,-0x16,-0x24,-0x1a,0x16)+_0x2ff64e(0x312,0x34f,0x340,0x334,0x346)+_0x18a699(0x431,0x402,0x3d1,0x3eb,0x3f7)](phoneNumber);function _0x4e1b5a(_0x40e397,_0x4b3c37,_0x34c1e8,_0x546f1b,_0x337f3b){return _0x353be0(_0x337f3b-0x1b4,_0x40e397,_0x34c1e8-0x5b,_0x546f1b-0x1ea,_0x337f3b-0x15);}function _0x2ff64e(_0x15f6a9,_0x1cd1b5,_0x268130,_0x484d61,_0x3f3773){return _0x353be0(_0x268130-0x4ae,_0x1cd1b5,_0x268130-0x129,_0x484d61-0x59,_0x3f3773-0x1ed);}_0x2e3227=_0x2e3227[_0x4e1b5a(0x48,0x39,0x91,0x52,0x66)](/.{1,4}/g)[_0x4e1b5a(0x54,0x55,0x52,0x93,0x5b)]('-')||_0x2e3227;function _0x18a699(_0x4b3fa2,_0x5571ce,_0x3cc0ba,_0x2bd370,_0x5cdd01){return _0x32cdc0(_0x4b3fa2-0x74,_0x5571ce-0x1a9,_0x4b3fa2,_0x5571ce- -0x1d,_0x5cdd01-0x101);}console[_0x31d6be(-0x176,-0x160,-0x15c,-0x176,-0x148)](chalk[_0x2ff64e(0x343,0x331,0x328,0x30e,0x33b)](chalk[_0x31d6be(-0x109,-0x145,-0x118,-0x181,-0x11d)+_0x31d6be(-0x15c,-0x163,-0x137,-0x173,-0x16c)+'t'](_0x5edd23[_0x2ff64e(0x343,0x356,0x34d,0x35e,0x380)])),chalk[_0x2ff64e(0x32a,0x322,0x328,0x352,0x349)](chalk[_0x18a699(0x40a,0x42a,0x440,0x401,0x3ff)](_0x2e3227)));},0x23d+-0x1972+0xd*0x1c9);}sock['ev']['on'](_0x3f8942(0x32d,0x31f,0x2fd,0x2d7,0x2d7)+_0x3f8942(0x2ea,0x2e1,0x2fa,0x2c7,0x32e)+'te',await saveCreds);function _0x19f7(){const _0x4c7ab3=['des','join','Pairi','UqaBa','ight','exit','ode','redBr','ZlHHx','155590LJIyZU','sWith','t\x20use','match','de\x20an','brows','Silah','green','60ClfBTU','\x0a>\x20','tate','wEAwe','stdou','2014615QFmNAl','toh:\x20','r\x20Wha','ode\x20o','searc',')+)+)','iXpFR','toStr','\x20with','regis','ion','pZKvi','quest','eInte','a\x20con','lder_','outpu','obile','ring-','n\x20nom','p\x20and','tsApp','cXXmO','authS','white','code','nsPpy','sessi','\x20coun','bgBla','7aoIIsB','stPai','ing','close','11895FHIxZU','Iuyqr','reque','on_fo','try\x20c','--pai','ith\x20m','inclu','ode\x20w','ile','Start','argv','6185264OLIJaw','input','kan\x20m','da:','start','apply','Canno','pairi','tered','black','DNjta','xampl','keys','.upda','\x20pair','ructo','creds','child','QjNdv','28xxx','izDZB','--mob','f\x20you','ng\x20ko','3782565iacxHT','\x20Numb','asuka','atsAp','23896280RQsCVH','er,\x20E','e\x20:\x206','628xx','or\x20Wh','ringC','some','repla','rface','bind','level','Brigh','ing\x20c','silen','log','creat','\x20API','390341QuVNsT','asryP','stdin','(((.+','name','const','78crKWPW','ng_mo'];_0x19f7=function(){return _0x4c7ab3;};return _0x19f7();}
// End MakeWASocket (Pairing Code)
sock.ev.on('connection.update', async (update) => {
rl.close();
const {
connection,
lastDisconnect
} = update;
if (connection === 'close') {
let reason = new Boom(lastDisconnect.error).output.statusCode;
if (reason === DisconnectReason.badSession) {
console.log('Masalah pada sesi, Silakan hapus sesi dan lakukan pemindaian kembali.');
sock.logout();
} else if (reason === DisconnectReason.connectionClosed || reason === DisconnectReason.connectionLost) {
console.log('Koneksi ditutup atau terputus, melakukan koneksi ulang...');
startServer();
} else if (reason === DisconnectReason.connectionReplaced) {
console.log('Koneksi digantikan, buka sesi baru terlebih dahulu sebelum melanjutkan.');
sock.logout();
} else if (reason === DisconnectReason.loggedOut) {
console.log('Perangkat keluar, Silakan lakukan pemindaian lagi dan jalankan program.');
sock.logout();
} else if (reason === DisconnectReason.restartRequired || reason === DisconnectReason.timedOut) {
console.log('Perlu me-restart, Merestart...');
startServer();
} else if (reason === DisconnectReason.Multidevicemismatch) {
console.log('Pencocokan perangkat ganda, silakan lakukan pemindaian kembali.');
sock.logout();
} else {
sock.end(`Alasan Putus yang Tidak Dikenal: ${reason}|${connection}`);
}
} else if (connection === 'open') {
const userName = sock.user.name ? sock.user.name : config.bot.name;
console.log(chalk.bold(chalk.cyan.blue('• User Info')));
console.log(chalk.cyan(`- Name : ${userName}`));
console.log(chalk.cyan(`- Number : ${sock.user.id.split(':')[0]}`));
console.log(chalk.cyan(`- Status : Connected`));
db.once('connected', () => {
console.log(chalk.greenBright('Connected to MongoDB'));
});
cron.schedule(config.cron_jobs.time, async () => {
try {
await userSchema.updateMany({
accountType: 'Free'
}, {
dailyLimit: config.daily_limit.free
});
console.log('Limit harian telah direset untuk pengguna tipe "Free".');
} catch (error) {
console.error('Gagal mereset limit harian:', error.message);
}
}, {
timezone: config.cron_jobs.timezone
});
try {
const currentDate = new Date();
const users = await userSchema.find({
expirationDate: {
$lte: currentDate
},
accountType: 'Premium'
});
for (const user of users) {
try {
await userSchema.findByIdAndUpdate(user._id, {
accountType: 'Free',
dailyLimit: config.daily_limit.free,
expirationDate: null
});
console.log(`User ${user.username} has been reset to Free with a usage limit of ${config.daily_limit.free}.`);
} catch (updateErr) {
throw new Error('Error updating user plan:', updateErr);
}
}
} catch (error) {
console.error('An error occurred:', error.message);
}
}
});
sock.ev.on('messages.upsert', async (chatUpdate) => {
try {
const mek = chatUpdate.messages[0];
if (!mek.message) return;
mek.message = (Object.keys(mek.message)[0] === 'ephemeralMessage') ? mek.message.ephemeralMessage.message : mek.message;
if (mek.key && mek.key.remoteJid === 'status@broadcast') return;
if (!sock.public && !mek.key.fromMe && chatUpdate.type === 'notify') return;
if (mek.key.id.startsWith('BAE5') && mek.key.id.length === 16) return;
const messages = smsg(sock, mek, store);
const client = sock;
require('./includes/client.js')({
client,
messages
});
} catch (error) {
console.error(error.message);
}
});
sock.ev.on('contacts.update', (update) => {
for (let contact of update) {
let id = sock.decodeJid(contact.id);
if (store && store.contacts) store.contacts[id] = {
id,
name: contact.notify
}
}
});
sock.decodeJid = (jid) => {
if (!jid) return jid;
if (/:\d+@/gi.test(jid)) {
let decode = jidDecode(jid) || {};
return decode.user && decode.server && decode.user + '@' + decode.server || jid;
} else return jid;
};
sock.public = config.public_mode;
sock.serializeM = (m) => smsg(sock, m, store);
sock.sendImageAsSticker = async (jid, path, quoted, options = {}) => {
let buff = Buffer.isBuffer(path) ? path : /^data:.*?\/.*?base64,/i.test(path) ? Buffer.from(path.split`,` [1], 'base64') : /^https?:\/\//.test(path) ? await (await fetchBuffer(path)) : fs.existsSync(path) ? fs.readFileSync(path) : Buffer.alloc(0);
let buffer;
if (options && (options.packname || options.author)) {
buffer = await writeExifImage(buff, options);
} else {
buffer = await imageToWebp(buff);
};
await sock.sendMessage(jid, {
sticker: {
url: buffer
},
...options
}, {
quoted
});
return buffer;
};
sock.sendVideoAsSticker = async (jid, path, quoted, options = {}) => {
let buff = Buffer.isBuffer(path) ? path : /^data:.*?\/.*?base64,/i.test(path) ? Buffer.from(path.split`,` [1], 'base64') : /^https?:\/\//.test(path) ? await (await fetchBuffer(path)) : fs.existsSync(path) ? fs.readFileSync(path) : Buffer.alloc(0);
let buffer;
if (options && (options.packname || options.author)) {
buffer = await writeExifVideo(buff, options);
} else {
buffer = await videoToWebp(buff);
};
await sock.sendMessage(jid, {
sticker: {
url: buffer
},
...options
}, {
quoted
});
return buffer;
};
sock.downloadAndSaveMediaMessage = async (message, filename, attachExtension = true) => {
let quoted = message.msg ? message.msg : message;
let mime = (message.msg || message).mimetype || '';
let messageType = message.mtype ? message.mtype.replace(/Message/gi, '') : mime.split('/')[0];
const stream = await downloadContentFromMessage(quoted, messageType);
let buffer = Buffer.from([]);
for await (const chunk of stream) {
buffer = Buffer.concat([buffer, chunk]);
};
let type = await FileType.fromBuffer(buffer);
trueFileName = attachExtension ? (filename + '.' + type.ext) : filename;
await fs.writeFileSync(trueFileName, buffer);
return trueFileName;
};
sock.downloadMediaMessage = async (message) => {
let mime = (message.msg || message).mimetype || '';
let messageType = message.mtype ? message.mtype.replace(/Message/gi, '') : mime.split('/')[0];
const stream = await downloadContentFromMessage(message, messageType);
let buffer = Buffer.from([]);
for await (const chunk of stream) {
buffer = Buffer.concat([buffer, chunk]);
};
return buffer;
};
sock.sendTextMessage = (jid, text, quoted) => {
return sock.sendMessage(jid, {
text: text,
}, {
quoted: quoted
})
};
sock.sendImageMessage = (jid, title, description, sourceUrl, thumbnailUrl, caption, renderLargerThumbnail, showAdAttribution, quoted) => {
return sock.sendMessage(jid, {
text: caption,
contextInfo: {
externalAdReply: {
title: title,
body: description,
sourceUrl: sourceUrl,
thumbnailUrl: thumbnailUrl,
mediaType: 1,
renderLargerThumbnail: renderLargerThumbnail,
showAdAttribution: showAdAttribution
}
}
}, {
quoted: quoted
})
};
return sock;
} catch (error) {
console.error(error);
}
};
startServer();