This repository has been archived by the owner on Dec 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
/
main3.py
1426 lines (1413 loc) · 81.1 KB
/
main3.py
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
999
1000
#!/usr/bin/python
"""
@AUTHOR : KRYPTON-BYTE
@DATE : TUE OCT 13, 2020
" Wahai Orang-orang Yg Beriman Mengapakah Kamu Mengatakan Sesuatu Yg Tidak Kamu Kerjakan? Amat Besar Kebencian Di Sisi Allah Bahwa Kamu Mengatakan Apa-apa Yang Tidak Kmau Kerjakan." (QS asg-shaff: 2-3)
"""
import difflib
from openwa.helper import convert_to_base64
from openwa import WhatsAPIDriver
from moviepy import editor
from mutagen.mp3 import MP3
from mutagen.id3 import ID3, APIC, TIT2
import locale
import time
from concurrent.futures import ThreadPoolExecutor
locale.setlocale(locale.LC_ALL, 'C')
from googletrans import Translator
import base64, os, pickle, hashlib,datetime, wikipedia, re,secrets , pyqrcode, hashlib, json, requests, random, subprocess, asyncio
from gtts import gTTS
import tesserocr
from PIL import Image
from pyzbar.pyzbar import decode
from ast import literal_eval
from gtts import gTTS
from io import BytesIO
import threading, math, psutil
#------------Module--------------#
#----------------
from lib2 import desain, EditR, cordIndo, QuoteTrans, scrapX, pinterest, findSurah, detect, SpeechToText, spam, tiktok, vidPinDownload, ListLang, langExecute, url2png, img2ascii, goimage, twettdownload, pitch, setDriver, setCountDown, parser_nuklir, nsearch, tiktok2
from lib2 import stickerSave, getListSticker, getSticker, deleteSticker, downloadDrive, get_AntiToxic, get_nsfw, get_prefix, set_AntiToxic, set_prefix, set_nsfw, stickerExif, get_male, get_female, isUsers, set_user, driver_, broadcast_serv, t_sticker, eight_bit, instagram_filter, alay, morse, blackpink, orange, Convert, paste_transparant_layer
from libx import *
from data import update_toxic, resert_toxic
from setting import author, BotName, proxy, MenuList, prefix
from javascript.pitnah import FakeReply, hidetag
from flask import Flask, render_template
import socketio, eventlet
#-----------setting----------------------#
wikipedia.set_lang('id')
TempSelf = []
tra = Translator()
mutiara = json.loads(open("assets/mutiara.json").read())
stop = 0
running = []
afk = {}
starttime = time.time()
Kasar = open("assets/badword.txt","r").read().splitlines()
FullCommand = ["notoxic","dadu","wasted","iphone","simi","grup","cmd","refresh","morse","attp","alay","blackpink","fdeface","countdown","ifilter","8bit","nsearchs","nsearch","afk","sticker2","sclear","tele_sticker","runtime","gf","bf","cimage","pitnah","other_bots","check","reg","set_prefix","twitter_download","pitch","cari_gambar","pyexec","toimg","hidetag","img2ascii","play","save_sticker", "get_sticker", "delete_sticker", "list_sticker","tstiker","tp","status","tiktok","tiktok2","kquote","execute","pintdown","join","transcript","whoisthis","whatimage","set","ping","quran","yt2mp4","pembersihan","pinterest","sendmessage","xnx2mp4","author","nsfw","gif","menu","help","chord","igstalk","report","replyreport","sticker","stiker","fb","quote1","kusonime","otakudesu","delete","upimg","ig","cari","support","tulis","waifu","qrmaker","gambar","intro","kitsune","qrreader","?","wait","url2png","run","ocr","doujin","film","ts","cc","tts","quotemaker","yt2mp3","yt","wiki","list-admin","admin","unadmin","kick","add","owner","linkgroup","revoke","dog","mentionall","neko","quote","gambar","bc","joke","bct", "ph"]
global driver
driver = WhatsAPIDriver(client='Chrome', headless=True, loadstyles=False ,chrome_options=["--no-sandbox",'--disable-dev-shm-usage'])
#kpatch = krypton_patch(driver)
driver_(driver)
setDriver(driver)
isAdmin = lambda _:driver.wapi_functions.getMe()["wid"] in driver.wapi_functions.getGroupAdmins(_)
class GetRepMedia:
def __init__(self, js):
self.obj = js._js_obj["quotedMsg"]
self.client_url = self.obj.get('deprecatedMms3Url')
self.media_key = self.obj.get("mediaKey")
self.type = self.obj.get("type")
self.crypt_keys= {'document': '576861747341707020446f63756d656e74204b657973','image': '576861747341707020496d616765204b657973','video': '576861747341707020566964656f204b657973','ptt': '576861747341707020417564696f204b657973','audio': '576861747341707020417564696f204b657973','sticker': '576861747341707020496d616765204b657973'}
def main(TextObject):
global afk
try:
if (af:=set(TextObject.get_js_obj()["mentionedJidList"])):
for i in list(set(afk.keys()) & af):
TextObject.reply_message(f"{i[:-5]} Sedang Afk\nReason : {afk[i]}")
if afk.pop(TextObject.sender.id, None):
TextObject.reply_message(f"Wellcome Back {TextObject.sender.id[:-5]}")
if TextObject.type == 'chat':
if set(TextObject.content.lower().split())&set(Kasar):
if '@g.us' in TextObject.chat_id:
if (value:=get_AntiToxic(TextObject.chat_id)):
if (melanggar:=update_toxic(TextObject.chat_id, TextObject.sender.id, value)) == "kick":
driver.wapi_functions.sendMessage(TextObject.chat_id,"Terpaksa Saya Mengkick Anda Karna Anda Melanggar Peraturan")
driver.remove_participant_group(TextObject.chat_id,TextObject.sender.id)
else:
driver.wapi_functions.sendMessage(TextObject.chat_id,f"Saya Telah Memperingati Anda Sebanyak : {melanggar}")
if driver.wapi_functions.getMe()["wid"] in TextObject.get_js_obj()["mentionedJidList"]:
TextObject.reply_message("Ketik *!help* Untuk Menampilkan Menu")
if TextObject.content[len(prefix):].split()[0] in FullCommand and TextObject.content[:len(prefix)] == prefix:
replyCommand(TextObject)
#executor.submit(replyCommand, (TextObject),(chatObject.chat))
elif '@c.us' in TextObject.chat_id:
TextObject.reply_message(chatbot(TextObject.content))
elif (not TextObject.content[len(prefix):].split()[0] in FullCommand ) and TextObject.content[:len(prefix)] == prefix:
if (pil:=difflib.get_close_matches(TextObject.content[len(prefix):].split()[0], FullCommand, n=1)):
TextObject.reply_message(f"Mungkin Yg Anda Maksud Adalah *{prefix}{pil[0]}*")
elif TextObject.type == 'image' and TextObject.caption[0][:len(prefix)] == prefix:
recImageReplyCommand(TextObject)
#executor.submit(recImageReplyCommand, (TextObject),(chatObject.chat))
elif TextObject.type == "video" and TextObject.caption[0][:len(prefix)] == prefix:
videoHandlr(TextObject)
#executor.submit(videoHandlr,(TextObject))
elif TextObject.type == 'vcard':
if isAdmin(TextObject.chat_id):
member=driver.wapi_functions.getGroupParticipantIDs(TextObject.chat_id)
masuk='---------➤SELAMAT DATANG \n'
for i in TextObject.contacts:
for u in re.findall('waid\=(.*?):',i.decode()):
try:
if u in member:
True
else:
driver.add_participant_group(TextObject.chat_id,'%s@c.us'%(u))
masuk+='➤ @%s'%(u)
except Exception as e:
print(f"Error -> {str(e)}")
True
else:
driver.wapi_functions.sendMessageWithMentions(TextObject.chat_id,masuk,'')
except Exception as e:#selenium.common.exceptions.InvalidSessionIdException:
print(f"Error -> {str(e)}")
pass
def recImageReplyCommand(Msg):
caption = Msg.caption[len(prefix):]
args=caption.split()[1:]
ran=secrets.token_hex(7)
if Msg.caption:
kpt = caption.lower().split()[0]
if kpt == "wait":
fn=Msg.save_media('./cache',Msg.media_key)
res=WhatAnimeIsThis(fn)
if res["status"]:
driver.wapi_functions.sendImage(convert_to_base64(BytesIO(res["video"].content)), Msg.chat_id, "wait.mp4")
Msg.reply_message(res["hasil"])
else:
Msg.reply_message("Gagal di cari")
os.remove(fn)
elif kpt == "wasted":
fn=Msg.save_media('./cache',Msg.media_key)
paste_transparant_layer(Image.open(fn)).save(fn)
driver.send_media(fn, Msg.chat_id, "sukses")
os.remove(fn)
elif kpt == "ifilter":
fn=Msg.save_media('./cache',Msg.media_key)
if args:
tp=instagram_filter(fn, args[0])
if isinstance(tp, str):
Msg.reply_message(tp)
else:
Image.open(tp).save(f"cache/{ran}.png")
driver.send_media(f"cache/{ran}.png", Msg.chat_id, f"*Filter* : {args[0]}")
#driver.wapi_functions(convert_to_base64(tp), Msg.chat_id, "ig.png", f"Filter: {args[0]}")
else:
Msg.reply_message("Masukan Nama Filter")
elif kpt =="reg": #!reg name|age|gender|bio
capt=caption[len(kpt)+1:].split('|')
fn=Msg.save_media('./cache',Msg.media_key)
if ((nama:=capt[0]) and (umur:=capt[1]).isnumeric() and (gender:= capt[2] if capt[2] in ["male","female"] else None) and (bio:=capt[3])):
set_user(nama=nama, umur=umur, gender=capt[2], bio=bio, profile=imgUploader(base64.b64encode(open(fn,"rb").read())).get("url"), chat_id=Msg.sender.id[:-5], from_bot=driver.wapi_functions.getMe()["wid"], from_id=Msg.chat_id)
else:
Msg.reply_message(f"*e.g:*\n {prefix}reg name|age|gender[male|female]|bio")
elif kpt == "whatimage":
fn=Msg.save_media('./cache',Msg.media_key)
Msg.reply_message(searchWithImage(imgUploader(base64.b64encode(open(fn,"rb").read())).get("url")))
os.remove(fn)
elif kpt == "whoisthis":
fn=Msg.save_media('./cache',Msg.media_key)
res=imgUploader(base64.b64encode(open(fn,"rb").read()).decode()).get("url")
if res:
Msg.reply_message(detect(res))
else:
Msg.reply_message("Gagal Mengindetifikasi Gambar")
elif kpt == "quote1":
arg=caption[7:].split('|')
for i in range(arg.count('')):
arg.remove('')
if len(arg) == 3:
color = (0, 0, 0) if arg[2] == "1" else (255, 255, 255)
fn=Msg.save_media("./cache",Msg.media_key)
desain(fn, katakata=arg[0], author=arg[1], col=color)
driver.send_media(fn, Msg.chat_id, "Quote Berhasil Di Buat")
os.remove(fn)
elif kpt in ['stiker','sticker']:
try:
fn=Msg.save_media('./cache',Msg.media_key)
os.rename(fn,"cache/%s.png"%ran)
pasteLayer("cache/%s.png"%ran, packname= caption[len(kpt)+1:] if args else driver.wapi_functions.getMe().get('pushname'))
driver.wapi_functions.sendImageAsSticker(convert_to_base64("cache/%s.png.webp"%ran)[23:],Msg.chat_id,{})
os.remove("cache/%s.png"%ran)
except Exception as e:
print(f"Error -> {str(e)}")
False
elif kpt == "upimg":
fn=Msg.save_media("./cache", Msg.media_key)
Msg.reply_message(imgUploader(base64.b64encode(open(fn,"rb").read()).decode())["msg"])
elif kpt == 'qrreader':
img=decode(Image.open(Msg.save_media('./cache',Msg.media_key)))
Msg.reply_message('Text : %s\nType : %s'%(img[0][0].decode(), img[0][1])) if img else Msg.reply_message('Gambar Tidak Valid')
elif kpt == "ocr":
fn=Msg.save_media("./cache", Msg.media_key)
Msg.reply_message(tesserocr.file_to_text(fn, lang="eng+ind+jap+chi").strip())
os.remove(fn)
elif kpt == "return":
Msg.reply_message(json.dumps(Msg._js_obj, indent=4))
def videoHandlr(Msg):
caption = Msg.caption[len(prefix):]
if caption.lower().split()[0] == "gif":
ran=Msg.save_media('./cache',Msg.media_key).split('/')[-1][:-4]
try:
mv=editor.VideoFileClip("cache/%s.mp4"%ran)
if int(mv.duration) <= 10:
if mv.size[0] < 512 or mv.size[1] < 512:
pattern=patternRes(mv.size[0], mv.size[1])
sticker=mv.resize(width=pattern[0], height=pattern[1])
sticker.write_videofile(f"{ran}.mp4")
os.system(f"""ffmpeg -i cache/{ran}.mp4 -y -vcodec libwebp -filter_complex "scale='min(512,512)':min'(512,512)':force_original_aspect_ratio=decrease,fps=15, pad=512:512:-1:-1:color=white@0.0,split[a][b];[a]palettegen=reserve_transparent=on:transparency_color=ffffff[p];[b][p]paletteuse" -f webp {ran}.webp""") #pasteLayer("cache/%s.png"%ran,packname="".join(filter(lambda ch:ord(ch)<256,)))
open(f"cache/{ran}.exif","wb").write(stickerExif(packname="".join(filter(lambda ch:ord(ch)<256,caption[len(caption.lower().split()[0])+1:] if caption[len(caption.lower().split()[0])+1:] else driver.wapi_functions.getMe().get('pushname')))))
os.system(f"webpmux -set exif cache/{ran}.exif {ran}.webp -o {ran}.webp")
if len(open(f"{ran}.webp","rb").read()) > 1024*1024:
Msg.reply_message("Sticker Melebihi Batas Maksimal")
else:
driver.wapi_functions.sendImageAsSticker(convert_to_base64("%s.webp"%ran)[23:],Msg.chat_id,{})
os.remove(f"{ran}.webp")
os.remove(f"cache/{ran}.exif")
except Exception as e:
print(f"Error -> {str(e)}")
elif caption.lower().split()[0] == "iphone":
ran=Msg.save_media('./cache',Msg.media_key).split('/')[-1][:-4]
Convert(f"cache/{ran}.mp4").Merge(f"cache/{ran}.mp4")
driver.send_media(f'cache/{ran}.mp4',Msg.chat_id,"SUKSES")
def replyCommand(Msg):
global prefix, stop
chat = Msg.content[len(prefix):]
args = chat.split(' ')[1:]
kpt = chat.lower().split(' ')[0].lower()
chat_id = Msg.chat_id
kpt = chat.lower().split(' ')[0].lower()
ran = secrets.token_hex(7)
spams = spam(Msg.sender.id).check()
if spams:
Msg.reply_message(f"Spam Terdeteksi Silahkan Tunggu *{spams.get('s')}* Detik")
elif kpt == 'qrmaker':
if len(args) == 0:
Msg.reply_message('*salah*')
else:
pyqrcode.create(chat.replace(kpt+' ','')).png('cache/bar.png', scale=6)
driver.send_media('cache/bar.png',chat_id,'text : %s'%(chat.replace(kpt,'')))
elif kpt == "afk":
afk.update({Msg.sender.id:sh if (sh:=chat[len(kpt)+1:]) else "Tanpa Alasan"})
Msg.reply_message(f"Afk Berhasil Reason {sh if (sh:=chat[len(kpt)+1:]) else 'Tanpa Alasan'}")
elif kpt == "countdown":
if args[0].isnumeric():
setCountDown({"chat_id":chat_id, "time":time.time()+int(args[0])})
Msg.reply_message(f"Hitung Berhasil Di Set {args[0]} Detik")
else:
Msg.reply_message("Argumen Berupa Angka (detik)")
elif kpt == "tele_sticker":
if args:
x=t_sticker(chat[len(kpt)+1:])
if x=="error":
Msg.reply_message("Nama Sticker Tidak Di Temukan")
else:
Msg.reply_message("Sticker Ditemukan Harap Tunggu Proses converting.....")
for i in enumerate(x):
if stop:
stop=0
break
else:
open(f"cache/{ran}_{i[0]}.tgs" if i[1]["anim"] else f"cache/{ran}_{i[0]}.webp","wb").write(i[1]["content"].content)
if i[1]["anim"]:
os.system(f"lottie_convert.py cache/{ran}_{i[0]}.tgs cache/{ran}_{i[0]}.gif")
(im:=Image.open(f"cache/{ran}_{i[0]}.gif")).save(f"cache/{ran}_{i[0]}.webp", transparency=im.info.get("transparency"), duration=im.info.get("duration",0), quality=20, save_all=True, exif=stickerExif(packname="Telegram"))
else:
(im:=Image.open(f"cache/{ran}_{i[0]}.webp")).resize(tuple(patternRes(im.width, im.height)))
polosan=Image.new("RGBA", (512, 512), color=(0, 0, 0, 0))
polosan.paste(im, (256-(int(im.width/2)), 256-(int(im.height/2))))
polosan.save(f"cache/{ran}_{i[0]}.webp", exif=stickerExif(packname="Telegram"))
if len(open(f"cache/{ran}_{i[0]}.webp","rb").read()) > 1024*1024:
Msg.reply_message("Sticker melebihi batas max")
else:
threading.Thread(target=driver.wapi_functions.sendImageAsSticker, args=(convert_to_base64(f"cache/{ran}_{i[0]}.webp")[23:],Msg.chat_id,{})).start()
else:
Msg.reply_message("Masukan Nama Stciker")
elif kpt == "nsearchs":
if get_nsfw(chat_id) or "@c.us" in chat_id:
if args:
if (ada:=nsearch(chat[len(kpt)+1:])):
Msg.reply_message("\n".join(map(lambda x:f"Title: {x['title']}\nNuclear: {x['nuklir']}", ada)))
else:
Msg.reply_message("Not Found")
else:
Msg.reply_message("input nuclear code")
else:
Msg.reply_message("NSFW Tidak Aktif Harap Private Chat Untuk Menggunakan Perintah ini")
elif kpt == "tiktok2":
if args:
tik=tiktok2(args[0]).download()
driver.wapi_functions.sendImage(convert_to_base64(BytesIO(tik[0].get(tik[1]["url"][0], headers=tik[2]).content)), chat_id, "hasil.mp4", f"*Judul:*: {tik[1]['title']}\n*Pada*: {tik[1]['date']}")
else:
Msg.reply_message("Masukan URL")
elif kpt == "wasted":
rep=GetRepMedia(Msg)
if rep.type in ["image", "sticker"]:
buf=BytesIO()
paste_transparant_layer(Image.open(BytesIO(driver.download_media(rep).read()))).save(buf, format="jpg")
driver.wapi_functions.sendImage(convert_to_base64(buf), chat_id, "wasted.jpg", "berhasil")
else:
Msg.reply_message("Masukan Gambar")
elif kpt == "refresh":
if Msg.sender.id in author:
Msg.reply_message("BOT Sedang Merefresh Halaman Whatsapp")
driver.driver.refresh()
else:
Msg.reply_message("Anda Bukan Author Bot")
elif kpt == "ifilter":
rep=GetRepMedia(Msg)
if rep.type == "image":
if args:
tp=instagram_filter(BytesIO(driver.download_media(rep).read()), args[0])
if isinstance(tp, str):
Msg.reply_message(tp)
else:
Image.open(tp).save(f"cache/{ran}.png")
driver.send_media(f"cache/{ran}.png", chat_id,f"*Filter*: {args[0]}")
#driver.wapi_functions(convert_to_base64(tp), Msg.chat_id, "ig.png", f"Filter: {args[0]}")
else:
Msg.reply_message("Masukan Nama Filter")
else:
Msg.reply_message("Reply Gambar Untuk Di Filter")
elif kpt == "iphone":
rep=GetRepMedia(Msg)
if rep.type == "video":
open(f"cache/{ran}.mp4", "wb").write(driver.download_media(rep).read())
Convert(f"cache/{ran}.mp4").Merge(f"cache/{ran}.mp4")
driver.send_media(f'cache/{ran}.mp4',chat_id,"SUKSES")
else:
Msg.reply_message("Untuk Video")
elif kpt == "nsearch":
if get_nsfw(chat_id) or "@c.us" in chat_id:
if args:
if (ada:=random.choice(nsearch(chat[len(kpt)+1:]))):
driver.wapi_functions.sendImage(convert_to_base64(BytesIO(requests.get(ada['thumbnail']).content)),chat_id, f"{ada['title']}.jpg",f"Title: {ada['title']}\nNuklir: {ada['nuklir']}")
else:
Msg.reply_message("Not Found")
else:
Msg.reply_message("input nuclear code")
else:
Msg.reply_message("NSFW Tidak Aktif Harap Private Chat Untuk Menggunakannya")
elif kpt == "pyexec":
if Msg.sender.id in author:
ret=""">>> """
try:
with stdoutIO() as e:
exec(chat[len(kpt)+1:])
Msg.reply_message(f"{ret}{chat[len(kpt)+1:]}\n{e.getvalue()}")
except Exception as e:
Msg.reply_message(f"{ret}{chat[len(kpt)+1:]}\nError: {e}")
else:
Msg.reply_message("Anda Bukan Author Bot")
elif kpt == "dadu":
driver.wapi_functions.sendImageAsSticker(convert_to_base64(f"assets/dadoo/_{random.randint(1,6)}.webp")[23:],Msg.chat_id,{})
elif kpt == "blackpink":
blackpink(chat[len(kpt)+1:]).save(f"cache/{ran}.jpg")
driver.send_media(f"cache/{ran}.jpg",chat_id, "*Berhasil Dibuat*")
elif kpt == "save_sticker":
rep=GetRepMedia(Msg)
open(f"cache/{ran}.webp","wb").write(driver.download_media(rep).read())
if rep.type == "sticker":
if args:
Msg.reply_message(stickerSave(user=Msg.sender.id, name=chat[len(kpt)+1:], url=f"cache/{ran}.webp"))
else:
Msg.reply_message("Masukan Nama Sticker")
else:
Msg.reply_message("Tag Sticker Yg ingin Di Simpan")
elif kpt == "get_sticker":
if args:
hasil=getSticker(Msg.sender.id,chat[len(kpt)+1:])
if hasil.get("status"):
downloadDrive(hasil.get("konten"),f"cache/{ran}.webp")
ocke=Image.open(f"cache/{ran}.webp")
if "ANMF" in open(f"cache/{ran}.webp","rb").read().decode("latin"):
os.mkdir(f"cache/{ran}")
fn=[]
for i in range(ocke.n_frames):
ocke.seek(i)
ocke.save(f"cache/{ran}/{i}.png")
fn.append(f"cache/{ran}/{i}.png")
editor.ImageSequenceClip(fn, fps=15, durations=ocke.info["duration"]).write_videofile(f"cache/{ran}/{ran}.mp4")
os.system(f"""ffmpeg -i cache/{ran}/{ran}.mp4 -y -vcodec libwebp -filter_complex "scale='min(512,512)':min'(512,512)':force_original_aspect_ratio=decrease,fps=15, pad=512:512:-1:-1:color=white@0.0,split[a][b];[a]palettegen=reserve_transparent=on:transparency_color=ffffff[p];[b][p]paletteuse" -f webp cache/{ran}.webp""")
os.system(f"rm -rf cache/{ran}")
open(f"cache/{ran}.exif","wb").write(stickerExif(packname=driver.wapi_functions.getMe().get('pushname')))
os.system(f"webpmux -set exif cache/{ran}.exif cache/{ran}.webp -o cache/{ran}.webp")
driver.wapi_functions.sendImageAsSticker(convert_to_base64("cache/%s.webp"%ran)[23:],Msg.chat_id,{})
#driver.wapi_functions.sendImage(convert_to_base64(f"cache/{ran}/{ran}.mp4"), chat_id, "pitch.mp4","Sticker Berhasil Di Download")
else:
ocke.save(f"cache/{ran}.webp", exif=stickerExif(packname=driver.wapi_functions.getMe().get('pushname')))
driver.wapi_functions.sendImageAsSticker(convert_to_base64("cache/%s.webp"%ran)[23:],Msg.chat_id,{})
else:
Msg.reply_message("Nama Sticker Tidak Di Temukan")
else:
Msg.reply_message("Masukan Nama Sticker")
elif kpt == "delete_sticker":
if args:
Msg.reply_message(deleteSticker(Msg.sender.id, chat[len(kpt)+1:]))
else:
Msg.reply_message("Masukan Nama Sticker")
elif kpt == "list_sticker":
Msg.reply_message(getListSticker(Msg.sender.id))
elif kpt == "status":
Msg.reply_message(system_info())
elif kpt == "cari_gambar":
res=goimage(chat[len(kpt)+1:])
for i in range(5):
img=requests.get(random.choice(res[random.choice(["png","jpeg","jpg"])]))
if img.status_code == 200:
driver.wapi_functions.sendImage(convert_to_base64(BytesIO(img.content)), chat_id, "cari_gambar.jpg", f"*Query:* {chat[len(kpt)+1:]}")
break
elif kpt == "pitch":
rep=GetRepMedia(Msg)
if rep.type in ["audio","ptt"]:
open(f"{ran}.mp3","wb").write(driver.download_media(rep).read())
if rep.type == "ptt":
editor.AudioFileClip(f"{ran}.mp3").write_audiofile(f"{ran}.mp3")
if args:
try:
level=float(args[0])
except ValueError:
level=0.5
pitch(f"{ran}.mp3", f"{ran}.mp3", level_pitch=level)
else:
pitch(f"{ran}.mp3",f"{ran}.mp3")
driver.wapi_functions.sendImage(convert_to_base64(f"{ran}.mp3"), chat_id, "pitch.mp3","")
os.remove(f"{ran}.mp3")
else:
Msg.reply_message("Tag Audio Yg Ingin Di Pitch")
elif kpt == 'toimg':
rep=GetRepMedia(Msg)
if rep.type == "sticker":
open(f"cache/{ran}.webp","wb").write(driver.download_media(rep).read())
if 'ANMF' in open(f"cache/{ran}.webp","rb").read().decode('latin'):
Image.open(f"cache/{ran}.webp").save(f"cache/{ran}.gif", save_all=True)
editor.VideoFileClip(f"cache/{ran}.gif").write_videofile(f"cache/{ran}.mp4")
driver.wapi_functions.sendImage(convert_to_base64(f"cache/{ran}.mp4"), chat_id, "toimg.mp4", "*Berhasil*")
os.remove(f"cache/{ran}.gif")
os.remove(f"cache/{ran}.mp4")
else:
Image.open(f"cache/{ran}.webp").save(f"cache/{ran}.png")
driver.wapi_functions.sendImage(convert_to_base64(f"cache/{ran}.png"), chat_id, "toimg.png", "*Berhasil*")
os.remove(f"{ran}.png")
os.remove(f"{ran}.webp")
elif kpt == "other_bots":
broadcast_serv(chat_id, "activate_bot")
Msg.reply_message("Please Wait")
elif kpt == "runtime":
runtime=time.time()-starttime
Msg.reply_message(f"*Bot Berjalan Selama {int(runtime//3600)} Jam {int(runtime%3600//60)} Menit {int(runtime%60)} Detik*")
elif kpt == "pembersihan":
if Msg.sender.id in author:
for i in driver.get_all_groups():
threading.Thread(target=driver.wapi_functions.sendMessage, args=(i.id,f"Bot akan Keluar dikarnakan {driver.wapi_functions.getMe().get('pushname')} sedang pembersihan, Harap Tunggu 20 menit lagi untuk menginvite kembali")).start()
threading.Thread(target=driver.wapi_functions.leaveGroup, args=(i.id)).start()
threading.Thread(target=driver.wapi_functions.deleteConversation, args=(i.id)).start()
for i in driver.get_all_chats():
threading.Thread(target=driver.delete_chat, args=(i.id)).start()
elif kpt == "sclear":
if Msg.sender.id in author:
for i in driver.get_all_chats():
threading.Thread(target=driver.wapi_functions.leaveGroup, args=(i.id)).start()
for i in driver.get_all_groups():
threading.Thread(target=driver.wapi_functions.deleteConversation, args=(i.id)).start()
else:
Msg.reply_message("Anda Bukan Author Bot")
elif kpt == "twitter_download":
if args:
res=twettdownload(args[0])
if res:
Sum=list(map(lambda x:int(x["res"][0])+int(x["res"][1]), res["url"]))
driver.wapi_functions.sendImage(convert_to_base64(BytesIO(requests.get(res["url"][Sum.index(max(Sum))]["url"]).content)), chat_id, "tweet.mp4", f"""
*Author :* {res.get("author")}
*Caption:* {res.get("caption")}
""".strip())
else:
Msg.reply_message("masukan url video yg valid")
else:
Msg.reply_message("Masukan Url Video Twitter")
elif kpt == "execute":
if args:
if args[0].isnumeric():
ex=langExecute(int(args[0]),chat[len(kpt)+len(args[0])+2:])
if '{' in ex.__str__():
Msg.reply_message(f"""
*Output:*
{ex.get('output')}
*CpuTime:*
{ex.get('cpuTime')}
*Memory:*
{ex.get('memory')}
*ExecuteTime:*
{ex.get('executeTime')}""")
else:
Msg.reply_message(ex)
else:
Msg.reply_message(ListLang())
else:
Msg.reply_message(ListLang())
elif kpt == "cmd":
if Msg.sender.id in author:
Msg.reply_message(os.popen(chat[len(kpt)+1:]).read())
else:
Msg.reply_message("Anda Bukan Author Bot")
elif kpt == "ping":
try:
res = subprocess.Popen(["/bin/ping", "-c1","web.whatsapp.com"], stdout=subprocess.PIPE).stdout.read().decode()
Exp, js =re.search("time\=([0-9]{1,9}.[0-9]{1,4} ms)",res), requests.get("https://api.myip.com").json()
Msg.reply_message(f"Kecepatan: {Exp[1]}\nIp: {js['ip']}\nNegara: {js['country']}" if Exp else "Gagal Menyambung Koneksi")
except Exception as e:
print(f"error -> {str(e)}")
elif kpt == "kquote":
if args:
pilih=difflib.get_close_matches(chat[len(kpt)+1:], [i for i in mutiara.keys()], n=1)
if pilih:
Msg.reply_message(f"*Tag:* ```{pilih[0]}```\n _{random.choice(mutiara[pilih[0]])}_")
else:
Msg.reply_message("*Tags Tidak Di Temukan*")
else:
tags=random.choice([i for i in mutiara.keys()])
Msg.reply_message(f"*Tag:* ```{tags}```\n _{random.choice(mutiara[tags])}_")
elif kpt == "pintdown":
try:
if args:
vid=vidPinDownload(args[0])
vid.download().write_videofile(f"{ran}.mp4",threads=8)
driver.send_media(f"{ran}.mp4",chat_id,"*Berhasil*")
os.remove(f"{ran}.mp4")
else:
Msg.reply_message(f"{prefix}pintdown [Pinterest Url Video]")
except Exception as e:
Msg.reply_message("*Mengambil Video Gagal*")
print(f"Error -> {str(e)}")
elif kpt == "check":
if args:
if Msg.sender.id in running:
Msg.reply_message("Harap Tunggu Yg Tadi")
elif args[0].count('x') < 3:
running.append(Msg.sender.id)
pesan=""
for i in CCGenrate(f"{args[0]}@c.us"):
if driver.wapi_functions.checkNumberStatus(i).get("status") == 200:
pesan+=f"https://wa.me/{i[:-5]}\n"
Msg.reply_message(pesan.strip())
running.remove(Msg.sender.id)
else:
Msg.reply_message("Masukan Nomer dengan x")
elif kpt == "whatimage":
rep=GetRepMedia(Msg)
if rep.type == "image":
Msg.reply_message(searchWithImage(imgUploader(base64.b64encode(driver.download_media(rep).read())).get("url")))
elif kpt == "img2ascii":
rep=GetRepMedia(Msg)
if rep.type == "image":
open(f"{ran}.jpg", "wb").write(driver.download_media(rep).read())
driver.wapi_functions.sendImage(convert_to_base64(img2ascii(f"{ran}.jpg")), chat_id, "jp2a.png","*berhasil*")
os.remove(f"{ran}.jpg")
else:
Msg.reply_message("Tag Gambar Yg ingin di konversi")
elif kpt == "8bit":
rep=GetRepMedia(Msg)
if rep.type == "image":
open(f"{ran}.jpg", "wb").write(driver.download_media(rep).read())
driver.wapi_functions.sendImage(convert_to_base64(eight_bit(f"{ran}.jpg")), chat_id, "jp2a.png","*berhasil*")
os.remove(f"{ran}.jpg")
elif rep.type == "sticker":
im=Image.open(BytesIO(driver.download_media(rep).read()))
im.seek(0)
im.save(f"{ran}.jpg")
driver.wapi_functions.sendImage(convert_to_base64(eight_bit(f"{ran}.jpg")), chat_id, "jp2a.png","*berhasil*")
os.remove(f"{ran}.jpg")
else:
Msg.reply_message("Tag Gambar Yg ingin di konversi")
elif kpt == "whoisthis":
rep=GetRepMedia(Msg)
if rep.type == "image":
res=imgUploader(base64.b64encode(driver.download_media(rep).read())).get("url")
if res:
Msg.reply_message(detect(res))
else:
Msg.reply_message("Gagal Mengindetifikasi Gambar")
else:
Msg.reply_message("Tag Gambar YG Ingin Di Indentifikasi")
elif kpt == "transcript":
rep=GetRepMedia(Msg)
if rep.type == "ptt":
open(f"{ran}.ogg","wb").write(driver.download_media(rep).read())
if args:
Msg.reply_message(SpeechToText(os.path.abspath(f"{ran}.ogg"), lang=args[0]))
else:
Msg.reply_message(SpeechToText(os.path.abspath(f"{ran}.ogg")))
else:
Msg.reply_message("Hanya Berlaku Untuk Pesan Suara")
elif kpt == "tstiker":
QuoteTrans(chat[len(kpt)+1:]).save(f"cache/{ran}.png")
driver.send_image_as_sticker(f"cache/{ran}.png",Msg.chat_id)
os.remove(f"cache/{ran}.png")
elif kpt == "report":
pesan=f"""
---------➤REPORT
*Dari* : {Msg.sender.id.replace("@c.us","")}
*Pesan* : {''.join(filter(lambda x:ord(x) < 600, chat[len(kpt)+1:]))}
"""
pyqrcode.create(base64.b64encode(pickle.dumps({"chat_id":chat_id,"msg_id":Msg.id})).decode()).png('cache/report.png', scale=6)
for i in author:
driver.send_media('cache/report.png',i,pesan)
Msg.reply_message("Report Terkirim")
elif kpt == "cimage":
rep=GetRepMedia(Msg)
arg=chat[len(kpt)+1:].split("|")
if rep.type in ["image","sticker"]:
open("cache/%s.png"%ran,"wb").write(driver.download_media(rep).read())
if len(arg) == 3:
resizeTo("cache/%s.png"%ran).save("cache/%s.png"%ran)
EditR(fn="cache/%s.png"%ran,top=arg[0],bot=arg[1],color=((0,0,0) if arg[2] == "1" else (255, 255, 255))).ExecuteCommand()
pasteLayer("cache/%s.png"%ran,packname="".join(filter(lambda ch:ord(ch)<256, chat[len(kpt)+1:] if args else driver.wapi_functions.getMe().get('pushname') )))
driver.wapi_functions.sendImageAsSticker(convert_to_base64("cache/%s.png.webp"%ran)[23:],Msg.chat_id,{})
os.remove("%s.png"%ran)
else:
Msg.reply_message(f"{prefix}cimage Atas|Bawah|1\n1:hitam\n0: putih")
elif kpt == "replyreport":
if Msg.sender.id in author:
rep=GetRepMedia(Msg)
if rep.type == "image":
img=decode(Image.open(driver.download_media(rep)))
info = pickle.loads(base64.b64decode(img[0][0].decode()))
chatId,msgId=info["chat_id"], info["msg_id"]
driver.wapi_functions.reply(chatId,f"""
---------➤REPLY REPORT
*Dari* : Author
*Pesan* : {chat[len(kpt)+1:]}
""", msgId) if img else Msg.reply_message('Gambar Tidak Valid')
Msg.reply_message("Berhasil Terkirim")
else:
Msg.reply_message("Anda Bukan Author")
elif kpt == "tiktok":
if args:
TikTok=tiktok()
tk=TikTok.download(args[0])
if tk.get("video"):
driver.wapi_functions.sendImage(convert_to_base64(BytesIO(requests.get(tk.get("video")[0]).content)), chat_id, "stalk.mp4", '*Berhasil*')
else:
Msg.reply_message("Url YG Anda Masukan Salah")
elif kpt == "igstalk":
if args:
driver.wapi_functions.sendMessage(chat_id,"Sedang Mencari 🔍")
userProperty=igstalker(args[0].replace("@",""))
if userProperty:
driver.wapi_functions.sendImage(convert_to_base64(BytesIO(requests.get(userProperty["pic"]).content)), chat_id, "stalk.jpg", f'''
*Nama Pengguna* : {userProperty["username"]}
*Mengikuti* : {userProperty["following"]}
*Di Ikuti* : {userProperty["follower"]}
*Jumlah Post* : {userProperty["post"]}
----------➤BIO
{userProperty["bio"]}
''')
else:
Msg.reply_message("Nama Pengguna Tidak Ada ❌")
else:
Msg.reply_message("Masukan Nama Pengguna Yg Ingin Di Stalk")
elif kpt == "simi":
Msg.reply_message(chatbot(chat[len(kpt)+1:]))
elif kpt == "quote1":
rep=GetRepMedia(Msg)
if rep.type == "image":
arg=chat[7:].split('|')
for i in range(arg.count('')):
arg.remove('')
if len(arg) == 3:
color = (0, 0, 0) if arg[2] == "1" else (255, 255, 255)
wri = driver.download_media(rep)
open("cache/%s.jpg"%ran,"wb").write(wri.read())
desain("cache/%s.jpg"%ran, katakata=arg[0], author=arg[1], col=color)
driver.send_media("cache/%s.jpg"%ran, chat_id, "Apakah Kamu Suka")
else:
Msg.reply_message("Perintah Salah")
elif kpt == 'qrreader':
rep=GetRepMedia(Msg)
if rep.type == "image":
wri = driver.download_media(rep)
img=decode(Image.open(wri))
Msg.reply_message('Text : %s\nType : %s'%(img[0][0].decode(), img[0][1])) if img else Msg.reply_message('Gambar Tidak Valid')
elif kpt == "wait":
rep=GetRepMedia(Msg)
if rep.type == "image":
wri = driver.download_media(rep)
open("cache/%s.jpg"%ran,"wb").write(wri.read())
res=WhatAnimeIsThis("cache/%s.jpg"%ran)
if res["status"]:
driver.wapi_functions.sendImage(convert_to_base64(BytesIO(res["video"].content)), Msg.chat_id, "wait.mp4")
Msg.reply_message(res["hasil"])
else:
Msg.reply_message("Gagal di cari")
os.remove("cache/%s.jpg"%ran)
elif kpt == "grup":
if '@g.us' in Msg.chat_id:
desc=(js_obj:=driver.get_chat_from_id(chat_id)._js_obj)["groupMetadata"].get("desc")
owner=js_obj["groupMetadata"]["owner"].replace("@c.us","")
cht=js_obj["contact"].get("formattedName")
create=datetime.datetime.fromtimestamp(js_obj["groupMetadata"].get("creation")).strftime("%H:%M:%S %A %e %B %Y")
pesan=f"""
*Name :* {cht}
*created by:* {owner}
*On :* {create}
*Desc :* {desc}
*AntiToxic:* { at if (at:=get_AntiToxic(chat_id)) else 'Nonaktif'}
*Nsfw :* {['Nonaktif', 'Aktif'][get_nsfw(chat_id)]}
""".strip()
driver.wapi_functions.sendImage(convert_to_base64(BytesIO(res if (res:=driver.get_profile_pic_from_id(chat_id)) else requests.get('https://cdn4.iconfinder.com/data/icons/small-n-flat/24/user-group-512.png').content)), chat_id, "grup.jpg",pesan)
else:
Msg.reply_message("Hanya Berlaku Di Dalam Grup")
elif kpt == "set_prefix":
#Msg.reply_message("Fitur Ini Dinonaktifkan karna menggangu performa bot")
"""if Msg.sender.id in driver.wapi_functions.getGroupAdmins(chat_id):
if args:
set_prefix(chat_id,args[0], driver.get_chat_from_id(chat_id)._js_obj["contact"].get("formattedName"))
Msg.reply_message(f"Awalan berhasil di set ke *{args[0]}*")
else:
Msg.reply_message("Masukan Parameter contoh : ! % * #")
else:
Msg.reply_message("Anda Bukan Admin Grup")"""
elif kpt == "set":
if Msg.sender.id in author:
prefix = chat[len(kpt)+1:]
Msg.reply_message(f"Awalan Perintah Berhasil Diganti dengan {prefix}")
else:
Msg.reply_message("Anda Bukan Author Bot")
elif kpt == "tulis":
tulisan=tulis(chat[len(kpt)+1:])
for i in tulisan:
ran=secrets.token_hex(7)
i.save("cache/%s.jpg"%ran)
driver.send_media("cache/%s.jpg"%ran, chat_id,"Berhasil Ditulis 📝")
os.remove("cache/%s.jpg"%ran)
elif kpt == "upimg":
rep=GetRepMedia(Msg)
if rep.type == "image":
wri = driver.download_media(rep)
Msg.reply_message(imgUploader(base64.b64encode(wri.read()).decode()).get("msg"))
elif kpt == "ocr":
rep=GetRepMedia(Msg)
if rep.type == "image":
wri = driver.download_media(rep)
open("%s.jpg"%ran, "wb").write(wri.read())
Msg.reply_message(tesserocr.file_to_text("%s.jpg"%ran, lang="eng+ind+jap+chi").strip())
os.remove("%s.jpg"%ran)
elif kpt == "gf":
if isUsers(Msg.sender.id[:-5]):
hasil=get_female()
pesan=f"""
╭───────「 PROFILE 」─────
│ Name : {hasil.get('nama')}
│ Gender: Female
│ Age : {hasil.get('umur')}
│ Bio : {hasil.get('bio')}
│ Whatsapp: {hasil.get('chat_id')}
╰──────────────────────
"""
driver.wapi_functions.sendImage(convert_to_base64(BytesIO(requests.get(hasil.get("profile")).content)), chat_id, "profile.jpg", pesan.strip())
else:
Msg.reply_message(f"type *{prefix}reg* to use this feature")
elif kpt == "bf":
if isUsers(Msg.sender.id[:-5]):
hasil=get_male()
pesan=f"""
╭───────「 PROFILE 」──────
│ Name : {hasil.get('nama')}
│ Gender: Male
│ Age : {hasil.get('umur')}
│ Bio : {hasil.get('bio')}
│ Whatsapp: {hasil.get('chat_id')}
╰──────────────────────
"""
driver.wapi_functions.sendImage(convert_to_base64(BytesIO(requests.get(hasil.get("profile")).content)), chat_id, "profile.jpg", pesan.strip())
else:
Msg.reply_message(f"type *{prefix}reg* to use this feature")
elif kpt == "reg":
rep=GetRepMedia(Msg)
if rep.type =="image":
capt=chat[len(kpt)+1:].split('|')
fn=Msg.save_media('./cache',Msg.media_key)
if ((nama:=capt[0]) and (umur:=capt[1]).isnumeric() and (gender:= capt[2] if capt[2] in ["male","female"] else None) and (bio:=capt[3])):
set_user(nama=nama, umur=umur, gender=capt[2], bio=bio, profile=imgUploader(base64.b64encode(driver.download_media(rep).read())).get("url"), chat_id=Msg.sender.id[:-5], from_bot=driver.wapi_functions.getMe()["wid"], from_id=Msg.chat_id)
else:
Msg.reply_message(f"*e.g:*\n {prefix}reg name|age|gender[male|female]|bio")
else:
Msg.reply_message("captions and images are required")
elif kpt == "gif":
rep= GetRepMedia(Msg)
try:
if rep.type == "video":
wri = driver.download_media(rep)
open("%s.mp4"%ran, "wb").write(wri.read())
mv=editor.VideoFileClip("%s.mp4"%ran)
if int(mv.duration) <= 10:
if mv.size[0] < 512 or mv.size[1] < 512:
pattern=patternRes(mv.size[0], mv.size[1])
sticker=mv.resize(*pattern)
sticker.write_videofile(f"{ran}.mp4")
os.system(f"""ffmpeg -i {ran}.mp4 -y -vcodec libwebp -filter_complex "scale='min(512,512)':min'(512,512)':force_original_aspect_ratio=decrease,fps=15, pad=512:512:-1:-1:color=white@0.0,split[a][b];[a]palettegen=reserve_transparent=on:transparency_color=ffffff[p];[b][p]paletteuse" -f webp {ran}.webp""")
open(f"cache/{ran}.exif","wb").write(stickerExif(packname="".join(filter(lambda ch:ord(ch)<256, chat[len(kpt)+1:] if args else driver.wapi_functions.getMe().get('pushname')))))
os.system(f"webpmux -set exif cache/{ran}.exif {ran}.webp -o {ran}.webp")
if len(open(f"{ran}.webp","rb").read()) > 1253376:
Msg.reply_message("Sticker Melebihi Batas Maksimal")
else:
driver.wapi_functions.sendImageAsSticker(convert_to_base64("%s.webp"%ran)[23:],Msg.chat_id,{})
os.remove(f"{ran}.mp4")
os.remove(f"{ran}.webp")
os.remove(f"cache/{ran}.exif")
else:
Msg.reply_message("Max 10 Detik")
else:
Msg.reply_message("Masukan Video Max 10 Detik")
except Exception as e:
print(f"Error -> {str(e)}")
elif kpt == "url2sticker":
try:
if args:
img=Image.open(BytesIO(requests.get(args[0]).content))
patt=patternRes(*img.size)
fr_=[]
if not (img.width == 512 and img.height == 512):
if "is_animated" in dir(img):
for i in range(img.n_frames):
img.seek(i)
fr_.append(img.resize(tuple(patt)))
fr_[0].save(f"cache/{ran}.webp", save_all=True, quality=20, duration=img.info.get("duration",0),append_images=fr_[1:], exif=stickerExif(packname=chat[len(kpt)+1+len(args[0])+1:]))
else:
img.resize(tuple(patt)).save(f"cache/{ran}.webp", exif=stickerExif(packname=chat[len(kpt)+1+len(args[0])+1:]))
else:
img.save(f"cache/{ran}.webp", save_all=True, quality=20, duration=img.info.get("duration",0), exif=stickerExif(packname=chat[len(kpt)+1+len(args[0])+1:]))
if len(open(f"cache/{ran}.webp",'rb').read()) > 1253376:
Msg.reply_message("Sticker Melebihi Batas Maksimal")
else:
driver.wapi_functions.sendImageAsSticker(convert_to_base64("cache/%s.webp"%ran)[23:],Msg.chat_id,{"width":patt[0], "height":patt[1]})
else:
Msg.reply_message("Masukan Url Gambar")
except Exception as e:
print(f"Error->{str(e)}")
Msg.reply_message("Masukan Url ")
elif kpt in ["sticker","stiker"]:
rep = GetRepMedia(Msg)
if rep.type == "image":
wri = driver.download_media(rep)
open("cache/%s.png"%ran,"wb").write(wri.read())
pasteLayer("cache/%s.png"%ran,packname="".join(filter(lambda ch:ord(ch)<256, chat[len(kpt)+1:] if args else driver.wapi_functions.getMe().get('pushname') )))
driver.wapi_functions.sendImageAsSticker(convert_to_base64("cache/%s.png.webp"%ran)[23:],Msg.chat_id,{})
os.remove("cache/%s.png.webp"%ran)
elif kpt == 'fb':
try:
link=fbvid(args[0])
driver.wapi_functions.sendImage(convert_to_base64(BytesIO(requests.get(link["url"]).content)), chat_id, "fb.mp4","") if link["status"] else Msg.reply_message("Kemungkinan Link video salah/ video di privasikan")
except Exception as e:
print(f"Error -> {str(e)}")
pass
elif kpt == 'intro':
Msg.reply_message(f"---------➤INTRO\n➤🙋♂Hallo Saya {driver.wapi_functions.getMe().get('pushname')} Saya Di Bangun 🛠️ Dengan Bahasa Python3.8 🐍 Dan Beberapa API🔥")
elif kpt in ['menu','help']:
driver.wapi_functions.sendMessage(chat_id, MenuList(prefix,driver.wapi_functions.getMe().get('pushname'), author, Msg.sender.push_name))
elif kpt == 'joke':
ffff=None
_help, dat=f'''
-------------➤JOKE
{prefix}joke [CATEGORY] [FLAGS]
-------➤CATEGORY
1: Programming
2: Miscellaneous
3: Dark
4: Funny
-------➤FLAGS
1: Nsfw
2: Religious
3: Political
4: Racist
5: Sexist
*Masukan Categori Flags Dengan Pilihan Angka*''', {'flags':{'1':'nsfw','2':'religious','3':'political','4':'racist','5':'sexist'},'category':{'1':'Programming','2':'Miscellaneous','3':'Dark','4':'Pun'}}
if(len(args) == 2 and args[0].isnumeric()) and (args[1].isnumeric()):
try:
ffff=requests.get('https://sv443.net/jokeapi/v2/joke/%s?blacklistFlags=%s'%(dat['category'][args[0]],dat['flags'][args[0]])).json()
except:
Msg.reply_message(_help)
if ffff['error']:
Msg.reply_message(_help)
else:
if ffff["type"] == "single":
Msg.reply_message(tra.translate(text=ffff['joke'], dest='id').text)
elif ffff["type"] == "twopart":
Msg.reply_message(tra.translate(text='%s\n%s'%(ffff['setup'], ffff['delivery']), dest='id').text)
else:
Msg.reply_message("Harap Ulangi Terjadi Kesalahan Dalam System")
else:
Msg.reply_message(_help)
elif kpt == 'bct':
try:
Msg.reply_message(bacot(chat[len(kpt)+1:]))
except:
Msg.reply_message('masukan Text')
elif kpt == "xnx2mp4":
if ("@g.us" in Msg.chat_id and get_nsfw(chat_id) == 1) or "@c.us" in Msg.chat_id:
result=scrapX(args[0])
if not result:
Msg.reply_message("*Video Tidak Di Temukan Harap Masukan Url Dengan Benar !*")
elif result.get("msg") == "max":
Msg.reply_message("*Video Melebihi Batas Maksimum*")
else:
driver.wapi_functions.sendImage(convert_to_base64(BytesIO(requests.get(result["thumb"]).content)), chat_id, "bo.jpg",f'*Title* : {result["judul"]}\n*Size* : {result["size"]}\n*Desc* : {result["desc"]}\n\n\n*Harap Tunggu Proses Uploadnya*')
driver.wapi_functions.sendImage(convert_to_base64(BytesIO(requests.get(result["vid"]).content)), chat_id, "bo.mp4","*Note* : Dosa Di Tanggung Sendiri")
else:
Msg.reply_message("Mode Nsfw Nonaktif Atau Anda Bisa Chat Pribadi Dengan Saya")
elif kpt == "nsfw":
if "@g.us" in Msg.chat_id:
if Msg.sender.id in driver.wapi_functions.getGroupAdmins(chat_id):
if args[0].isnumeric():
if int(args[0]) == 1:
set_nsfw(Msg.chat_id, 1, driver.get_chat_from_id(chat_id)._js_obj["contact"].get("formattedName"), from_bot=driver.wapi_functions.getMe()["wid"])
elif int(args[0]) == 0:
set_nsfw(Msg.chat_id, 0, driver.get_chat_from_id(chat_id)._js_obj["contact"].get("formattedName"), from_bot=driver.wapi_functions.getMe()["wid"])
else:
driver.wapi_functions.sendMessage(chat_id,"Masukan 1 untuk *mengaktifkan* dan 0 untuk *menonaktifkan*")
else:
driver.wapi_functions.sendMessage(chat_id,"Masukan 1 untuk *mengaktifkan* dan 0 untuk *menonaktifkan*")
else:
Msg.reply_message('Anda Bukan Admin Group')
else:
Msg.reply_message("Group Only")
elif kpt == "chord":
hasil=cordIndo(chat[len(kpt)+1:])
driver.wapi_functions.sendMessage(chat_id, hasil if args else "Masukan Judul Lagu")
elif kpt == "notoxic":
if Msg.sender.id in driver.wapi_functions.getGroupAdmins(chat_id):
if isAdmin(chat_id):
if int(args[0]) == 1:
if len(args) == 2:
if args[1].isnumeric():
set_AntiToxic(chat_id, int(args[1]), driver.get_chat_from_id(chat_id)._js_obj["contact"].get("formattedName"), from_bot=driver.wapi_functions.getMe()["wid"])
else:
driver.wapi_functions.sendMessage(chat_id, "Masukan Jumlah Max peringatan")
else:
driver.wapi_functions.sendMessage(chat_id, "Masukan Jumlah Max peringatan")
elif int(args[0]) == 0:
set_AntiToxic(chat_id, 0, driver.get_chat_from_id(chat_id)._js_obj["contact"].get("formattedName"))
driver.wapi_functions.sendMessage(chat_id, "Menonaktifkan Anti Toxic Berhasil")
else:
driver.wapi_functions.sendMessage(chat_id, "Masukan 1 untuk *mengaktifkan* dan 0 untuk *menonaktifkan*")
else:
driver.wapi_functions.sendMessage(chat_id, "Jadikan Saya Menjadi Admin Terlebih Dahulu")
else:
Msg.reply_message('Anda Bukan Admin Group')
elif kpt == 'kick':
if "@g.us" in Msg.chat_id:
for i in args:
try:
if Msg.sender.id in driver.wapi_functions.getGroupAdmins(chat_id):
if isAdmin(chat_id):
if driver.remove_participant_group(chat_id, args[0].replace("@","")+"@c.us"):
Msg.reply_message("Berhasil")
else:
Msg.reply_message("Kick Gagal")
else:
driver.wapi_functions.sendMessage(chat_id, "Bot Belum Jadi Admin")
else:
Msg.reply_message('Anda Bukan Admin')
except Exception as e:
print(f"Error -> {str(e)}")
Msg.reply_message("Gagal")
else:
Msg.reply_message("Hanya Berlaku Di Dalam Grup")
elif kpt == "delete":
if "@g.us" in Msg.chat_id:
if Msg._js_obj["quotedMsgObj"]:
id_ = Msg._js_obj["quotedMsgObj"]["id"]
chat_id = Msg.chat_id
Msg.reply_message("Hanya Pesan Bot Yg Bisa Di Hapus") if not driver.wapi_functions.deleteMessage(chat_id,id_,True) else True if Msg.sender.id in driver.wapi_functions.getGroupAdmins(chat_id) else Msg.reply_message("Tag Pesan Bot Yg Ingin Di Hapus")
else:
Msg.reply_message("Hanya Berlaku Di Dalam Grup")
elif kpt == "pinterest":
if args:
try:
shr=gsearch(f"'{chat[len(kpt)+1:]}' site:pinterest.com inurl:/pin")[:-1]
if shr:
sh=pinterest(random.choice(shr))
if sh:
if sh[-4:] == ".gif":
editor.VideoFileClip(sh).write_videofile(f"{ran}.mp4")
driver.send_media(f"{ran}.mp4", chat_id,f"*{chat[len(kpt)+1:]}*")
os.remove(f"{ran}.mp4")
elif sh[-4:] == ".mp4":
driver.wapi_functions.sendImage(convert_to_base64(BytesIO(requests.get(sh).content)), chat_id, "pin.mp4",f"*{chat[len(kpt)+1:]}*")
else:
driver.wapi_functions.sendImage(convert_to_base64(BytesIO(requests.get(sh).content)), chat_id, "pin.jpg",f"*{chat[len(kpt)+1:]}*")
else:
Msg.reply_message("Gambar Tidak Di Temukan")
else:
Msg.reply_message("Query Tidak Ditemukan")
except Exception as e:
print(f"Error -> {str(e)}")