-
Notifications
You must be signed in to change notification settings - Fork 1
/
azebot.js
998 lines (983 loc) · 49.1 KB
/
azebot.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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
/**
* Source Code By RezaDevv
* Don't Forget Smile
* This Bot Telegram Using Api Official
* Thank You
*/
require("./configuration/config");
const { Telegraf, Context } = require('telegraf')
const { message, editedMessage, channelPost, editedChannelPost, callbackQuery } = require("telegraf/filters");
const chalk = require('chalk');
const { exec } = require("child_process");
const fs = require('fs');
const fetch = require('node-fetch');
const os = require('os');
const speed = require('performance-now');
const util = require('util');
const { aze_bot } = require('./myfunc/function');
const { Configuration, OpenAIApi } = require("openai");
const axios = require("axios");
//Database
const signup = JSON.parse(fs.readFileSync('./src/user.json'));
const banned = JSON.parse(fs.readFileSync('./src/banned.json'));
module.exports = aze = async (aze, bot) => {
//console.log(aze)
try {
const body = aze.message.text || aze.message.caption || ''
const budy = (typeof aze.message.text == 'string' ? aze.message.text : '')
const { isUrl } = aze_bot;
const isCmd = /^[°•π÷׶∆£¢€¥®™�✓_=|~!?#/$%^&.+-,\\\©^]/.test(body)
const prefix = isCmd ? body[0] : ''
const command = isCmd ? body.slice(1).trim().split(' ').shift().toLowerCase() : ''
const args = body.trim().split(/ +/).slice(1)
const text = q = args.join(" ")
const user = aze_bot.getUserName(aze.message.from)
const pushname = user.full_name;
const user_id = aze.message.from.id + " "
const username = aze.message.from.username ? aze.message.from.username : "unknown";
const isCreator = OWNER[0].replace("https://t.me/", '') == aze.update.message.from.username
const from = aze.message.chat.id
const opts = { parse_mode: 'MARKDOWN' };
//Groups
const isGroup = aze.chat.type.includes('group')
const groupName = isGroup ? aze.chat.title : ''
const newMember = aze.message.new_chat_member;
const leftMember = aze.message.left_chat_member;
const isBanned = banned.includes("" + from)
const isImage = aze.message.hasOwnProperty('photo')
const isVideo = aze.message.hasOwnProperty('video')
const isAudio = aze.message.hasOwnProperty('audio')
const isSticker = aze.message.hasOwnProperty('sticker')
const isContact = aze.message.hasOwnProperty('contact')
const isLocation = aze.message.hasOwnProperty('location')
const isDocument = aze.message.hasOwnProperty('document')
const isAnimation = aze.message.hasOwnProperty('animation')
const isMedia = isImage || isVideo || isAudio || isSticker || isContact || isLocation || isDocument || isAnimation
const quotedMessage = aze.message.reply_to_message || {}
const isQuotedImage = quotedMessage.hasOwnProperty('photo')
const isQuotedVideo = quotedMessage.hasOwnProperty('video')
const isQuotedAudio = quotedMessage.hasOwnProperty('audio')
const isQuotedSticker = quotedMessage.hasOwnProperty('sticker')
const isQuotedContact = quotedMessage.hasOwnProperty('contact')
const isQuotedLocation = quotedMessage.hasOwnProperty('location')
const isQuotedDocument = quotedMessage.hasOwnProperty('document')
const isQuotedAnimation = quotedMessage.hasOwnProperty('animation')
const isQuoted = aze.message.hasOwnProperty('reply_to_message')
const isUser = signup.includes("" + from)
const timestampi = speed();
const latensii = speed() - timestampi
const reply = async (text) => {
for (var x of aze_bot.range(0, text.length, 4096)) { //maks 4096 character, jika lebih akan eror
return await aze.replyWithMarkdown(text.substr(x, 4096), {
disable_web_page_preview: true
})
}
}
const getStyle = (style_, style, style2) => {
listt = `${LANGUAGE_IND.getStyle(style, style2)}`
for (var i = 0; i < 300; i++) {
listt += '» `' + style_[i] + '`\n'
}
reply(listt)
}
//Get type message
var typeMessage = body.substr(0, 50).replace(/\n/g, '')
if (isImage) typeMessage = 'Image'
else if (isVideo) typeMessage = 'Video'
else if (isAudio) typeMessage = 'Audio'
else if (isSticker) typeMessage = 'Sticker'
else if (isContact) typeMessage = 'Contact'
else if (isLocation) typeMessage = 'Location'
else if (isDocument) typeMessage = 'Document'
else if (isAnimation) typeMessage = 'Animation'
//Push message to console
if (aze.message) {
console.log(chalk.black(chalk.bgWhite('[ PESAN ]')), chalk.black(chalk.bgGreen(new Date)), chalk.black(chalk.bgBlue(body || typeMessage)) + '\n' + chalk.magenta('=> From'), chalk.green(pushname) + '\n' + chalk.blueBright('=> In'), chalk.green(isGroup ? groupName : 'Private Chat', aze.message.chat.id))
if (newMember) {
const memberId = newMember.id;
const memberUsername = newMember.username;
const chatId = aze.chat.id;
console.log(`New member joined: ${memberId} (${memberUsername})`);
bot.telegram.sendMessage(chatId, `_Selamat datang, ${memberUsername}!_`, opts);
} else if (leftMember) {
const memberId = leftMember.id;
const memberUsername = leftMember.username;
const chatId = aze.chat.id;
console.log(`Member left: ${memberId} (${memberUsername})`);
bot.telegram.sendMessage(chatId, `_Sampai jumpa, ${memberUsername}!_`, opts);
}
}
//Push user to database
if (isCmd && !isUser && !isGroup) {
signup.push("" + from)
bot.telegram.sendMessage(from, `╭──❒ *USER BARU TERDETEKSI*\n├• 📌 Id: ${from}\n├• 📌 Name: ${pushname}\n├• 📌 Username: @${username ? username : 'Unknown'}\n╰❑\n\n*Selamat datang gunakan bot dengan bijak!. Patuhi Syarat & Ketentuan yang berlaku /rules Terimakasih.*\n\n[@${OWNER_NAME}](${OWNER[0]})`, opts)
fs.writeFileSync('./src/user.json', JSON.stringify(signup, null, 2))
setTimeout(() => {
bot.telegram.sendMessage(OWNERID, `╭──❒ *ADA USER BARU*\n├• 📌 Id: ${from}\n├• 📌 Name: ${pushname}\n├• 📌 Username: @${username ? username : 'Unknown'}\n╰❑`, opts)
}, 3000)
}
switch (command) {
case "tes": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
reply("I'm here")
}
break
case "owner": case "creator": {
await aze.sendContact(OWNER_NUMBER, OWNER_NAME)
reply(`This owner [${OWNER_NAME}](${OWNER[0]}) 👑`)
}
break
case "menu": case "help": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
LANGUAGE_IND.menu(aze, THUMBNAIL, pushname, OWNER_NAME, OWNER, prefix, latensii, os, aze_bot, username, signup.length, isCreator, user.id.toString())
}
break
case "donasi": case "donate": {
LANGUAGE_IND.donasi(aze, DONASI)
}
break
case "script": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
aze.reply("Source code this bot...", {
reply_markup: {
inline_keyboard: [
[{
text: 'Github',
url: "https://github.com/resahdevv/Aze-Bot-Tele"
}, {
text: 'WhatsApp',
url: "https://wa.me/+6285742632270"
}]
]
}
})
}
break
case "rules": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
reply(LANGUAGE_IND.rules)
}
break
case "ping": case "botsatus": {
if (!isCreator) return reply(LANGUAGE_IND.mess.owner)
const used = process.memoryUsage()
const cpus = os.cpus().map(cpu => {
cpu.total = Object.keys(cpu.times).reduce((last, type) => last + cpu.times[type], 0)
return cpu
})
const cpu = cpus.reduce((last, cpu, _, { length }) => {
last.total += cpu.total
last.speed += cpu.speed / length
last.times.user += cpu.times.user
last.times.nice += cpu.times.nice
last.times.sys += cpu.times.sys
last.times.idle += cpu.times.idle
last.times.irq += cpu.times.irq
return last
}, {
speed: 0,
total: 0,
times: {
user: 0,
nice: 0,
sys: 0,
idle: 0,
irq: 0
}
})
let timestamp = speed()
let latensi = speed() - timestamp
neww = performance.now()
oldd = performance.now()
respon = `_Kecepatan Respon_ ${latensi.toFixed(4)} _Second_ \n ${oldd - neww} _miliseconds_\n_Runtime_ : ${aze_bot.runtime(process.uptime())}\n\n💻 _Server Information_\nRAM: ${aze_bot.formatp(os.totalmem() - os.freemem())} / ${aze_bot.formatp(os.totalmem())}\n_NodeJS Memory Usaage_\n${Object.keys(used).map((key, _, arr) => `${key.padEnd(Math.max(...arr.map(v=>v.length)),' ')}: ${aze_bot.formatp(used[key])}`).join('\n')}\n\n${cpus[0] ? `_Total CPU Usage_\n${cpus[0].model.trim()} (${cpu.speed} MHZ)\n${Object.keys(cpu.times).map(type => `- *${(type + '*').padEnd(6)}: ${(100 * cpu.times[type] / cpu.total).toFixed(2)}%`).join('\n')}\n_CPU Core(s) Usage (${cpus.length} Core CPU)_\n\n${cpus.map((cpu, i) => `${i + 1}. ${cpu.model.trim()} (${cpu.speed} MHZ)\n${Object.keys(cpu.times).map(type => `- *${(type + '*').padEnd(6)}: ${(100 * cpu.times[type] / cpu.total).toFixed(2)}%`).join('\n')}`).join('\n\n')}` : ''}`.trim()
reply(respon)
}
break
case "anime": case "waifu": case "husbu": case "neko": case "shinobu": case "megumin": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
reply(LANGUAGE_IND.mess.wait)
const image_url = api('zenz', '/randomanime/' + command, {}, 'apikey')
var button = [
[{
text: 'Next ⏭',
callback_data: command + '*' + user_id
}]
]
aze.replyWithPhoto({
url: image_url
}, {
caption: 'Successfull Generate ' + command.replace('anime', 'Anime').replace('waifu', 'Waifu').replace('husbu', 'Husbu').replace('neko', 'Neko').replace('shinobu', 'Shinobu').replace('megumin', 'Megumin'),
parse_mode: "MARKDOWN",
disable_web_page_preview: true,
reply_markup: {
inline_keyboard: button
}
})
}
break
case "getidchat": case "getidgroup": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (command === 'getidchat') {
if (isGroup) return reply(LANGUAGE_IND.mess.private)
reply('ID Chat: ' + from)
} else if (command === 'getidgroup') {
if (!isGroup) return reply(LANGUAGE_IND.mess.group)
reply('ID Group: ' + from)
}
}
break
case "restart": {
if (!isCreator) return reply(LANGUAGE_IND.mess.owner)
await reply(`Restarting ${BOT_NAME}`)
try{
await bot.telegram.sendMessage(from, {text: LANGUAGE_IND.mess.success})
await aze_bot.sleep(3000)
exec(`npm start`)
} catch (err) {
exec(`node index.js`)
await aze_bot.sleep(4000)
reply('Sukses')
}
}
break
case "gempa": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
reply(LANGUAGE_IND.mess.waitdata)
let anu = await aze_bot.fetchJson('https://data.bmkg.go.id/DataMKG/TEWS/autogempa.json')
aze.replyWithPhoto({
url: 'https://data.bmkg.go.id/DataMKG/TEWS/' + anu.Infogempa.gempa.Shakemap
}, {
caption: `⭔ Tanggal : ${anu.Infogempa.gempa.Tanggal}\n⭔ Jam : ${anu.Infogempa.gempa.Jam}\n⭔ Date Time : ${anu.Infogempa.gempa.DateTime}\n⭔ Coordinate : ${anu.Infogempa.gempa.Coordinates}\n⭔ Lintang : ${anu.Infogempa.gempa.Lintang}\n⭔ Bujur : ${anu.Infogempa.gempa.Bujur}\n⭔ Magnitude : ${anu.Infogempa.gempa.Magnitude}\n⭔ Kedalaman : ${anu.Infogempa.gempa.Kedalaman}\n⭔ Wilayah : ${anu.Infogempa.gempa.Wilayah}\n⭔ Potensi : ${anu.Infogempa.gempa.Potensi}\n⭔ Dirasakan : ${anu.Infogempa.gempa.Dirasakan}`
})
}
break
case "tiktoknowm": case "tiktok": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (!args[0]) return reply('Masukkan Query Link!')
if (!isUrl(args[0])) return reply('Link Invalid')
const tiktokDomains = ['vt.tiktok.com', 'tiktok.com'];
const url = new URL(args[0]);
if (!tiktokDomains.includes(url.hostname)) {
return reply('Link bukan dari TikTok!')
}
reply(LANGUAGE_IND.mess.wait)
let anu = await aze_bot.fetchJson(api('zenz', '/downloader/tiktok', { url: args[0] }, 'apikey'))
if (anu.status == false) return reply(anu.result.message)
aze.replyWithVideo({
url: anu.result.url[0].url
}, {
caption: 'Download From ' + args[0]
})
}
break
case "darkjoke": case "memeindo": case "meme": case "patrick": case "profil": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
reply(LANGUAGE_IND.mess.wait)
const image_url = api('zenz', '/randomimage/' + command, {}, 'apikey')
var button = [
[{
text: 'Next ⏭',
callback_data: command + '*' + user_id
}]
]
aze.replyWithPhoto({
url: image_url
}, {
caption: 'Successfull Generate ' + command.replace('darkjoke', 'Darkjoke').replace('memeindo', 'Memeindo').replace('meme', 'Meme').replace('patrick', 'Patrick').replace('profil', 'Profil'),
parse_mode: "MARKDOWN",
disable_web_page_preview: true,
reply_markup: {
inline_keyboard: button
}
})
}
break
case "tiktokmp3": case "tiktokaudio": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (!args[0]) return reply('Masukkan Query Link!')
if (!isUrl(args[0])) return reply('Link Invalid')
const tiktokDomains = ['vt.tiktok.com', 'tiktok.com'];
const url = new URL(args[0]);
if (!tiktokDomains.includes(url.hostname)) {
return reply('Link bukan dari TikTok!')
}
reply(LANGUAGE_IND.mess.wait)
let anu = await aze_bot.fetchJson(api('zenz', '/downloader/tiktok', { url: args[0] }, 'apikey'))
if (anu.status == false) return reply(anu.result.message)
aze.replyWithAudio({
url: anu.result.url[1].url,
filename: 'Tiktok Audio.mp3'
}, {
caption: 'Download From ' + args[0]
})
}
break
case "gitclone": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (!args[0]) return reply(`Example: ${prefix + command} UrlRepo`);
let regex = /(?:https|git)(?::\/\/|@)github\.com[\/:]([^\/:]+)\/(.+)/i;
if (!regex.test(args[0])) return reply('```Link Incorrect```');
let [, user, repo] = args[0].match(regex) || [];
if (!repo) return reply('```Repository not found```');
repo = repo.replace(/.git$/, '');
let url = `https://api.github.com/repos/${user}/${repo}/zipball`;
reply(`_Cloning Repository_\n\n🌟 _User: ${user}_\n🌟 _Repo: ${repo}_\n\n_Loading!..._`);
aze.replyWithDocument({
url: url,
filename: repo + '.zip'
}, {
caption: `_${LANGUAGE_IND.mess.success}_`,
parse_mode: 'MARKDOWN'
})
}
break
case "diffusion" : {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (!text) return reply(`EXample: ${prefix + command} cute girl beautifull`)
reply(LANGUAGE_IND.mess.wait)
const image_url = api('lol', '/api/diffusion-prompt', {prompt: text}, 'apikey')
aze.replyWithPhoto({
url: image_url,
}, {
caption: `_${text}_`,
parse_mode: 'MARKDOWN'
});
}
break
case "ai": {
try {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (KEY_OPENAI === "ISI_APIKEY_OPENAI_DISINI") return reply("_Mohon isi apikey di config.js_");
if (!text) return reply(`Chat dengan AI.\n\nContoh:\n${prefix}${command} Presiden Indonesia ?`);
reply(LANGUAGE_IND.mess.wait)
const configuration = new Configuration({
apiKey: KEY_OPENAI,
});
const openai = new OpenAIApi(configuration);
const response = await openai.createChatCompletion({
model: "gpt-3.5-turbo",
messages: [{role: "user", content: text}],
});
reply(`${response.data.choices[0].message.content}`);
} catch (error) {
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
console.log(`${error.response.status}\n\n${error.response.data}`);
} else {
console.log(error);
reply("Maaf, sepertinya ada yang error :"+ error.message);
}
}
}
break
case "img": {
try {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (KEY_OPENAI === "ISI_APIKEY_OPENAI_DISINI") return reply("_Mohon isi apikey di config.js_");
if (!text) return reply(`Chat dengan AI.\n\nContoh:\n${prefix}${command} Gril Cute`);
reply(LANGUAGE_IND.mess.wait)
const configuration = new Configuration({
apiKey: KEY_OPENAI,
});
const openai = new OpenAIApi(configuration);
const response = await openai.createImage({
prompt: text,
n: 1,
size: "512x512",
});
aze.replyWithPhoto({
url: response.data.data[0].url,
}, {
caption: `_${text}_`,
parse_mode: 'MARKDOWN'
});
} catch (error) {
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
console.log(`${error.response.status}\n\n${error.response.data}`);
} else {
console.log(error);
reply("Maaf, sepertinya ada yang error :"+ error.message);
}
}
}
break
case "whoisip": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (!args[0]) return reply(`Example: ${prefix + command} 192.168.10.20`)
reply(LANGUAGE_IND.mess.wait)
try {
let anu = await aze_bot.fetchJson(api('lol', '/api/ipaddress/' + args[0], {}, 'apikey'))
bot.telegram.sendMessage(from, {text: `⭔ Country : ${anu.result.country}\n⭔ Country Code : ${anu.result.countryCode}\n⭔ Region : ${anu.result.region}\n⭔ Region Name : ${anu.result.regionName}\n⭔ City : ${anu.result.city}\n⭔ Zip : ${anu.result.zip}\n⭔ Lat : ${anu.result.lat}\n⭔ Lon : ${anu.result.lon}\n⭔ Time Zone : ${anu.result.timezone}\n⭔ Isp : ${anu.result.isp}\n⭔ Org : ${anu.result.org}\n⭔ As : ${anu.result.as}\n⭔ Query : ${anu.result.query}`}, opts)
} catch (error) {
console.error('Error fetching JSON:', error);
reply('_Terjadi kesalahan saat mengambil data. Silakan coba lagi nanti._');
}
}
break
case "getip": {
if (!isCreator) return reply(LANGUAGE_IND.mess.owner)
reply("My public IP address is: " + ipserver);
}
break
case "shortlink": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (!args[0]) return reply(`Example ${prefix + command} https://google.com`)
let anu = await aze_bot.fetchJson(api('lol', '/api/shortlink', {url: args[0]}, 'apikey'))
bot.telegram.sendMessage(from, {text: `*${LANGUAGE_IND.mess.success}*\n⭔ Url : ${anu.result ? anu.result : 'Unknow'}`}, opts)
}
break
case "banned": {
if (!isCreator) return reply(LANGUAGE_IND.mess.owner)
if (!args[0]) return reply(`Example: ${prefix + command} 1283353379`)
if (args[0] === OWNERID) return reply('_Id Owner Di Larang!_')
let telgram_id = args[0].replace(/[^0-9]/g, '')
let banned_ = []
if (fs.existsSync('./src/banned.json')) {
banned_ = JSON.parse(fs.readFileSync('./src/banned.json'))
}
if (banned_.includes(telgram_id)) {
reply(`_Id ${telgram_id} Telah Terbanned_`)
} else {
banned.push(telgram_id)
fs.writeFileSync('./src/banned.json', JSON.stringify(banned))
reply(`_Success Banned ${telgram_id}_`)
}
}
break
case "getcase": {
if (!isCreator) return reply(LANGUAGE_IND.mess.owner)
if (text === command) return reply('_Acsess Denied!_')
if (!args[0]) return reply("Mau ngambil case apa?")
try {
reply(LANGUAGE_IND.mess.wait)
let code = "case " + `"${args[0]}"` + fs.readFileSync('./azebot.js').toString().split(`case "${args[0]}"`)[1].split('break')[0] + 'break'
let image_url = api('lol', '/api/carbon', { code: code, language: 'javascript' }, 'apikey')
aze.replyWithPhoto({
url: image_url
}, {
caption: LANGUAGE_IND.mess.success,
parse_mode: "MARKDOWN",
})
} catch (error) {
reply(error)
}
}
break
case "unbanned": {
if (!isCreator) return reply(LANGUAGE_IND.mess.owner)
if (!args[0]) return reply(`Example: ${prefix + command} 1283353379`)
let telgram_id = args[0].replace(/[^0-9]/g, '')
let banned_ = JSON.parse(fs.readFileSync('./src/banned.json'))
let unp = banned_.indexOf(telgram_id)
if (unp !== -1) {
banned.splice(unp, 1)
fs.writeFileSync('./src/banned.json', JSON.stringify(banned))
reply(`_Success Unbanned ${telgram_id}_`)
} else {
reply(`_Id ${telgram_id} Not Found_`)
}
}
break
case "ytmp3": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (!args[0]) return reply('Masukkan Query Link!')
if (!isUrl(args[0])) return reply('Link Invalid')
const youtubeDomains = ['youtube.com', 'www.youtube.com', 'youtu.be'];
const url = new URL(args[0]);
if (!youtubeDomains.includes(url.hostname)) {
return reply('Link bukan dari Youtube!')
}
reply(LANGUAGE_IND.mess.wait)
let anu = await fetch(api('lol', '/api/ytaudio', { url: args[0] }, 'apikey'))
if (!anu.ok) throw await anu.text()
var result = await anu.json()
var { id, thumbnail, title } = result.result
var { link, bitrate, size } = result.result.link
let key = "「 *YOUTUBE AUDIO* 」\n\n"
key += `• _Id: ${id}_\n`
key += `• _Bitrate: ${bitrate}_\n`
key += `• _Size: ${size}_\n`
await aze.replyWithPhoto({
url: thumbnail
}, {
caption: key,
parse_mode: 'MARKDOWN'
})
await aze.replyWithAudio({
url: link,
filename: title
})
}
break
case "ytmp4": case "ytshorts": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (!args[0]) return reply('Masukkan Query Link!')
if (!isUrl(args[0])) return reply('Link Invalid')
const youtubeDomains = ['youtube.com', 'www.youtube.com', 'youtu.be'];
const url = new URL(args[0]);
if (!youtubeDomains.includes(url.hostname)) {
return reply('Link bukan dari Youtube!')
}
if (command === 'ytshorts') {
reply(LANGUAGE_IND.mess.wait)
let anu = await fetch(api('lol', '/api/ytvideo2', { url: args[0] }, 'apikey'))
if (!anu.ok) throw await anu.text()
var result = await anu.json()
var { title, thumbnail, size, link} = result.result
let key = "「 *YOUTUBE SHORTS* 」\n\n"
key += `• _Title: ${title}_\n`
key += `• _Size: ${size}_\n`
await aze.replyWithPhoto({
url: thumbnail
}, {
caption: key,
parse_mode: 'MARKDOWN'
})
aze.replyWithVideo({
url: link
}, {
caption: LANGUAGE_IND.mess.success
})
} else if (command === 'ytmp4') {
reply(LANGUAGE_IND.mess.wait)
let anu = await fetch(api('lol', '/api/ytvideo', { url: args[0] }, 'apikey'))
if (!anu.ok) throw await anu.text()
var result = await anu.json()
var { id, thumbnail } = result.result
var { link, type, resolution, size } = result.result.link
let key = "「 *YOUTUBE VIDEO* 」\n\n"
key += `• _Id: ${id}_\n`
key += `• _Type: ${type}_\n`
key += `• _Resolusi: ${resolution}_\n`
key += `• _Size: ${size}_\n`
await aze.replyWithPhoto({
url: thumbnail
}, {
caption: key,
parse_mode: 'MARKDOWN'
})
aze.replyWithVideo({
url: link
}, {
caption: LANGUAGE_IND.mess.success
})
}
}
break
case "toaudio": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (!text) return reply(`Example: ${prefix + command} Hello World`)
reply(LANGUAGE_IND.mess.wait)
let anu = (api('lol', '/api/gtts/id', { text: text }, 'apikey'))
aze.replyWithAudio({
url: anu,
filename: 'Google Audio.mp3'
})
}
break
case "stalkgithub": case "stalkinstagram": case "stalktiktok": case "stalktwitter": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (!text) return reply(`Example: ${prefix + command} username`)
if (command === 'stalkgithub') {
reply(LANGUAGE_IND.mess.wait)
let anu = await fetch(api('lol', '/api/github/' + text, {}, 'apikey'))
if (!anu.ok) throw await anu.text()
var result = await anu.json()
var {avatar, url, name, followers, following, public_repos, public_gists, type, company, location, email, bio} = result.result
var get_link = await aze_bot.fetchJson(`https://tinyurl.com/api-create.php?url=${url}`)
let key = "「 *STALKER GITHUB* 」\n\n"
key += `• _Name: ${name}_\n`
key += `• _Followers: ${followers}_\n`
key += `• _Following: ${following}_\n`
key += `• _Public Repo: ${public_repos}_\n`
key += `• _Public Gists: ${public_gists}_\n`
key += `• _Type: ${type}_\n`
key += `• _Company: ${company}_\n`
key += `• _Location: ${location}_\n`
key += `• _Email: ${email}_\n`
key += `• _Bio: ${bio}_\n`
key += `• _Url: ${get_link}_\n`
await aze.replyWithPhoto({
url: avatar
}, {
caption: key,
parse_mode: 'MARKDOWN'
})
} else if (command === 'stalkinstagram') {
reply(LANGUAGE_IND.mess.wait)
let anu = await fetch(api('lol', '/api/stalkig/' + text, {}, 'apikey'))
if (!anu.ok) throw await anu.text()
var result = await anu.json()
var { photo_profile, fullname, posts, followers, following, bio } = result.result
let key = "「 *STALKER INSTAGRAM* 」\n\n"
key += `• _Username: ${result.result.username}_\n`
key += `• _Full Name: ${fullname}_\n`
key += `• _Posts: ${posts}_\n`
key += `• _Followers: ${followers}_\n`
key += `• _Following: ${following}_\n`
key += `• _Bio: ${bio}_\n`
await aze.replyWithPhoto({
url: photo_profile
}, {
caption: key,
parse_mode: 'MARKDOWN'
})
} else if (command === 'stalktiktok') {
reply(LANGUAGE_IND.mess.wait)
let anu = await fetch(api('lol', '/api/stalktiktok/' + text, {}, 'apikey'))
if (!anu.ok) throw await anu.text()
var result = await anu.json()
var { user_picture, nickname, bio, followers, followings, likes, video } = result.result
let key = "「 *STALKER TIKTOK* 」\n\n"
key += `• _Username: ${result.result.username}_\n`
key += `• _Nickname: ${nickname}_\n`
key += `• _Bio: ${bio}_\n`
key += `• _Followers: ${followers}_\n`
key += `• _Following: ${followings}_\n`
key += `• _Like: ${likes}_\n`
key += `• _Video: ${video}_\n`
await aze.replyWithPhoto({
url: user_picture
}, {
caption: key,
parse_mode: 'MARKDOWN'
})
} else if (command === 'stalktwitter') {
reply(LANGUAGE_IND.mess.wait)
let anu = await fetch(api('lol', '/api/twitter/' + text, {}, 'apikey'))
if (!anu.ok) throw await anu.text()
var result = await anu.json()
var { name, screen_name, description, profile_picture, followers, following, tweet, joined } = result.result
let key = "「 *STALKER TWITTER* 」\n\n"
key += `• _Name: ${name}_\n`
key += `• _Screen Name: ${screen_name}_\n`
key += `• _Followers: ${followers}_\n`
key += `• _Following: ${following}_\n`
key += `• _Tweet: ${tweet}_\n`
key += `• _Joined: ${joined}_\n`
key += `• _Description: ${description}_\n`
await aze.replyWithPhoto({
url: profile_picture
}, {
caption: key,
parse_mode: 'MARKDOWN'
})
}
}
break
case "apkdownload": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (!text) return reply(`Example: ${prefix + command} com.whatsapp`)
reply(LANGUAGE_IND.mess.wait)
let anu = await fetch(api('lol', '/api/apkdownloader', {package: text }, 'apikey'))
if (!anu.ok) throw await anu.text()
var result = await anu.json()
var { apk_name, apk_icon, apk_version, apk_author, apk_link } = result.result
var get_link = await aze_bot.fetchJson(`https://tinyurl.com/api-create.php?url=${apk_link}`)
let key = "「 *APK DOWNLOADER* 」\n\n"
key += `• _Apk Name: ${apk_name}_\n`
key += `• _Apk Version: ${apk_version}_\n`
key += `• _Apk Author: ${apk_author}_\n`
key += `• _Link: ${get_link}_\n`
await aze.replyWithPhoto({
url: apk_icon
}, {
caption: key,
parse_mode: 'MARKDOWN'
})
aze.replyWithDocument({
url: apk_link,
filename: apk_name + '.apk'
}, {
caption: LANGUAGE_IND.mess.success
})
}
break
case "mediafire": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (!args[0]) return reply('Masukkan Query Link!')
if (!isUrl(args[0])) return reply('Link Invalid')
const mediafireDomains = ['mediafire.com', 'www.mediafire.com'];
const url = new URL(args[0]);
if (!mediafireDomains.includes(url.hostname)) {
return reply('Link bukan dari Mediafire!')
}
reply(LANGUAGE_IND.mess.wait)
let anu = await fetch(api('lol', '/api/mediafire', {url: args[0] }, 'apikey'))
if (!anu.ok) throw await anu.text()
var result = await anu.json()
var { filename, filetype, filesize, uploaded, link } = result.result
let key = "「 *MEDIAFIRE DOWNLOADER* 」\n\n"
key += `• _Type: ${filetype}_\n`
key += `• _Size: ${filesize}_\n`
key += `• _Upload: ${uploaded}_\n`
await reply(key)
if (filename.includes(".zip")) {
aze.replyWithDocument({
url: link,
filename: filename
})
} else if (filename.includes(".mp4")) {
aze.replyWithVideo({
url: link
}, {
caption: LANGUAGE_IND.mess.success
})
} else if (filename.includes(".mp3")) {
aze.replyWithAudio({
url: link,
filename: filename
})
} else {
reply("_Invalid media type_")
}
}
break
case "cuaca": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (!text) return reply(`Example: ${prefix + command} banjar`)
reply(LANGUAGE_IND.mess.wait)
let anu = await fetch(api('lol', '/api/cuaca/' + text, {}, 'apikey'))
if (!anu.ok) throw await anu.text()
var result = await anu.json()
var { tempat, latitude, longitude, cuaca, angin, description, kelembapan, suhu, udara, permukaan_laut } = result.result
let key = "「 *INFORMASI CUACA* 」\n\n"
key += `• _Tempat: ${tempat}_\n`
key += `• _Latitude: ${latitude}_\n`
key += `• _Longitude: ${longitude}_\n`
key += `• _Cuaca: ${cuaca}_\n`
key += `• _Angin: ${angin}_\n`
key += `• _Description: ${description}_\n`
key += `• _Kelembapan: ${kelembapan}_\n`
key += `• _Suhu: ${suhu}_\n`
key += `• _Udara: ${udara}_\n`
key += `• _Permukaan Laut: ${permukaan_laut}_\n`
await reply(key)
}
break
case "nulis": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (!text) return reply(`Example: ${prefix + command} Hello World`)
reply(LANGUAGE_IND.mess.wait)
let anu = await api('lol', '/api/nulis', {text: text }, 'apikey')
aze.replyWithPhoto({
url: anu
}, {
caption: LANGUAGE_IND.mess.success,
parse_mode: 'MARKDOWN'
});
}
break
case "sendnotify": {
if (!isCreator) return reply(LANGUAGE_IND.mess.owner)
let telegram_id = text.split('|')[0]
let pesan = text.split('|')[1]
if (telegram_id === OWNERID) return reply('_Id Owner Di Larang_')
if (!pesan && !telegram_id) return reply(`Example: ${prefix + command} Id|Hallo`)
bot.telegram.sendMessage(telegram_id, pesan, opts)
await reply(LANGUAGE_IND.mess.success)
}
break
case "spam": {
if (!isCreator) return reply(LANGUAGE_IND.mess.owner)
let tel_id = text.split('|')[0]
let count = text.split('|')[1]
let mess = text.split('|')[2]
if (tel_id === OWNERID) return reply('_Id Owner Di Larang_')
if (!tel_id && !count && !mess) return reply(`Example: ${prefix + command} 123xxx|20|Hi`)
let i = 1;
let isWaitingDisplayed = false;
function sendSpamMess() {
if (!isWaitingDisplayed) {
// Menampilkan pesan "Menunggu..." hanya sekali sebelum proses pengiriman pesan dimulai
reply("_Mengirim Spam..._");
isWaitingDisplayed = true;
}
bot.telegram.sendMessage(tel_id.replace(/[^0-9]/g, ''), { text: mess }, opts);
i++;
if (i <= count) {
setTimeout(sendSpamMess, 1000); // kirim pesan setiap 1 detik
} else {
// Menampilkan bahwa pesan spam berhasil di kirim
reply("_Success Spam..._");
}
}
sendSpamMess();
}
break
case "translate": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (!text) return reply(`Example: ${prefix + command} Hello World`)
reply(LANGUAGE_IND.mess.wait)
let anu = await fetch(api('lol', '/api/translate/auto/id', {text: text }, 'apikey'))
if (!anu.ok) throw await anu.text()
var result = await anu.json()
var { to, translated } = result.result
let key = "「 *HASIL TRANSLATE* 」\n\n"
key += `• _From: ${result.result.from}_\n`
key += `• _To: ${to}_\n`
await reply(key)
reply(translated.replace('null', 'Unknown'))
}
break
case "fetch": {
if (isBanned) return reply(LANGUAGE_IND.mess.banned)
if (!text) return reply(`Example: ${prefix + command} EndPoint`)
if (!isUrl(text)) return reply('Link Invalid!')
reply(LANGUAGE_IND.mess.wait)
async function fetchData() {
try {
const response = await fetch(text);
if (!response.ok) {
throw new Error('Response error: ' + response.status);
}
const data = await response.json();
let file_name = aze_bot.getRandom("json")
fs.writeFile(file_name, JSON.stringify(data), (err) => {
if (err) {
console.error('Error:', err);
} else {
console.log('Response saved successfully.');
}
});
aze.replyWithDocument({
source: './' + file_name,
filename: 'response.json'
}, {
caption: `_${LANGUAGE_IND.mess.success}_`,
parse_mode: 'MARKDOWN'
})
setTimeout(() => {
fs.unlink(file_name, (err) => {
if (err) {
console.error('Error deleting file:', err);
} else {
console.log('File deleted successfully.');
}
});
}, 3000);
} catch (error) {
console.error('Error:', error);
}
}
fetchData();
}
break
case "buysourcecode": {
aze.replyWithPhoto({
source: PRICE
}, {
caption: '_Untuk melakukan pembelian contact_ [Click Here](https://wa.me/+6285742632270)',
parse_mode: "MARKDOWN"
})
}
//break
//case "broadnotif": {
//if (!isCreator) return reply(LANGUAGE_IND.mess.owner)
//if (!text) return reply(`Example: ${prefix}${command} Hi Semuanya`)
//let signup = JSON.parse(fs.readFileSync('./src/user.json'))
//let count = signup.length;
//let sentCount = 0;
//reply('*_Sedang Mengirim Pesan..._');
//for (let i = 0; i < signup.length; i++) {
//setTimeout(function() {
//bot.telegram.sendMessage(signup[i], { text: text }, opts);
//count--;
//sentCount++;
//if (count === 0) {
//bot.telegram.sendMessage(from, { text: `_Semua pesan telah dikirim!_:\n_Jumlah pesan terkirim: ${sentCount}_`}, opts);
//}
//}, i * 1000); // delay setiap pengiriman selama 1 detik
//}
//}
break
case "qrcode": {
if (!isCreator) return reply(LANGUAGE_IND.mess.owner)
if (!text) return reply(`Example: ${prefix}${command} Hello World`)
reply(LANGUAGE_IND.mess.wait)
let url = api('lol', '/api/qrcode', {text: text }, 'apikey')
aze.replyWithPhoto({
url: url
}, {
caption: LANGUAGE_IND.mess.success,
parse_mode: "MARKDOWN"
})
}
break
case "listuser": {
if (!isCreator) return reply(LANGUAGE_IND.mess.owner)
let teks = '*「 DAFTAR ID USER 」*\n\n';
for (let pengguna of signup) {
teks += `- ${pengguna}\n`;
}
teks += `\n_Total User : ${signup.length}_`;
if (teks.length > 4096) {
const maxMessageLength = 4096;
const messages = [];
let currentMessage = '';
// Memisahkan teks menjadi beberapa pesan dengan panjang maksimum 4096 karakter
const lines = teks.split('\n');
for (let line of lines) {
if ((currentMessage + line).length > maxMessageLength) {
messages.push(currentMessage.trim());
currentMessage = '';
}
currentMessage += line + '\n';
}
// Mengirim pesan-pesan yang terpisah
for (let i = 0; i < messages.length; i++) {
const isLastMessage = i === messages.length - 1;
const messageText = isLastMessage ? messages[i].trim() : messages[i].trim() + '...';
bot.telegram.sendMessage(from, { text: messageText }, opts);
}
} else {
bot.telegram.sendMessage(from, { text: teks.trim() }, opts);
}
}
break
case "listbanned": {
if (!isCreator) return reply(LANGUAGE_IND.mess.owner)
let teks = '*「 DAFTAR ID BANNED 」*\n\n';
for (let medog of banned) {
teks += `- ${medog}\n`;
}
teks += `\n_Total Banned : ${banned.length}_`;
if (teks.length > 4096) {
const maxMessageLength = 4096;
const messages = [];
let currentMessage = '';
// Memisahkan teks menjadi beberapa pesan dengan panjang maksimum 4096 karakter
const lines = teks.split('\n');
for (let line of lines) {
if ((currentMessage + line).length > maxMessageLength) {
messages.push(currentMessage.trim());
currentMessage = '';
}
currentMessage += line + '\n';
}
// Mengirim pesan-pesan yang terpisah
for (let i = 0; i < messages.length; i++) {
const isLastMessage = i === messages.length - 1;
const messageText = isLastMessage ? messages[i].trim() : messages[i].trim() + '...';
bot.telegram.sendMessage(from, { text: messageText }, opts);
}
} else {
bot.telegram.sendMessage(from, { text: teks.trim() }, opts);
}
}
}
} catch (e) {
aze.reply(util.format(e))
console.log('[ ERROR ] ' + e)
}
}
let file = require.resolve(__filename);
fs.watchFile(file, () => {
fs.unwatchFile(file);
console.log(chalk.redBright(`Update ${__filename}`));
delete require.cache[file];
require(file);
});