-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path131.py
1368 lines (1330 loc) · 74.7 KB
/
131.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
# -*- coding: utf-8 -*-
from LineAPI.linepy import *
from LineAPI.akad.ttypes import Message
from LineAPI.akad.ttypes import ContentType as Type
from time import sleep
from datetime import datetime, timedelta
from bs4 import BeautifulSoup
from googletrans import Translator
from humanfriendly import format_timespan, format_size, format_number, format_length
from ffmpy import FFmpeg
import time, random, sys, json, codecs, threading, glob, re, string, os, requests, six, ast, pytz, urllib, urllib3, urllib.parse, traceback, atexit
#client = LINE()
#client = LINE("EsciEQ8XV7baVM1HZyJ5.IqtJipTzyCWvcrgownX/bq.pH6Y+zX3kYrZhVYsyvSP+cAwqp/tVaL/KuSx20OE7X0=")
client = LINE("EA9ws7qu8xUVtGL188j5.IqtJipTzyCWvcrgownX/bq.yQ/2KgspbDbXYrmE+DatSCSWkwk6kSQInqwG7AvFoEI=")
clientMid = client.profile.mid
clientProfile = client.getProfile()
clientSettings = client.getSettings()
clientPoll = OEPoll(client)
ki = LINE("EA9ws7qu8xUVtGL188j5.IqtJipTzyCWvcrgownX/bq.yQ/2KgspbDbXYrmE+DatSCSWkwk6kSQInqwG7AvFoEI=")
#ki = LINE("EtY5oIeOo5OELzIc9fX2.J6sEygXMkhHTW7MEt5CVCG.NAyGm0AvDMF22PIOxuD9TulvI3p4oZxZUlGVJ08TLNA=")
kiMid = ki.profile.mid
kiProfile = ki.getProfile()
kiSettings = ki.getSettings()
kiPoll = OEPoll(ki)
botStart = time.time()
clientMID = client.profile.mid
kiMID = ki.profile.mid
admin = ["u8904e320fb5961cc1509118e58dc7e05"]
msg_dict = {}
wordban = []
images = {}
settingss = {
"userAgent": [
"Mozilla/5.0 (X11; U; Linux i586; de; rv:5.0) Gecko/20100101 Firefox/5.0",
"Mozilla/5.0 (X11; U; Linux amd64; rv:5.0) Gecko/20100101 Firefox/5.0 (Debian)",
"Mozilla/5.0 (X11; U; Linux amd64; en-US; rv:5.0) Gecko/20110619 Firefox/5.0",
"Mozilla/5.0 (X11; Linux) Gecko Firefox/5.0",
"Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0 FirePHP/0.5",
"Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0 Firefox/5.0",
"Mozilla/5.0 (X11; Linux x86_64) Gecko Firefox/5.0",
"Mozilla/5.0 (X11; Linux ppc; rv:5.0) Gecko/20100101 Firefox/5.0",
"Mozilla/5.0 (X11; Linux AMD64) Gecko Firefox/5.0",
"Mozilla/5.0 (X11; FreeBSD amd64; rv:5.0) Gecko/20100101 Firefox/5.0",
"Mozilla/5.0 (Windows NT 6.2; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0",
"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:5.0) Gecko/20110619 Firefox/5.0",
"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:5.0) Gecko/20100101 Firefox/5.0",
"Mozilla/5.0 (Windows NT 6.1; rv:6.0) Gecko/20100101 Firefox/5.0",
"Mozilla/5.0 (Windows NT 6.1.1; rv:5.0) Gecko/20100101 Firefox/5.0",
"Mozilla/5.0 (Windows NT 5.2; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0",
"Mozilla/5.0 (Windows NT 5.1; U; rv:5.0) Gecko/20100101 Firefox/5.0",
"Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/5.0",
"Mozilla/5.0 (Windows NT 5.0; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0",
"Mozilla/5.0 (Windows NT 5.0; rv:5.0) Gecko/20100101 Firefox/5.0"
]
}
settings = {
"autoAdd": False,
"autoJoin": True,
"autoLeave": False,
"autoRead": False,
"autoRespon": False,
"autoJoinTicket": True,
"checkContact": False,
"checkPost": False,
"suf": True,
"simsimi": False,
"ya": True,
"checkSticker": False,
"changeVideoProfile": False,
"changeVideoProfile2": False,
"ChangeVideoProfilePicture": False,
"ChangeVideoProfilePicture2": False,
"changePictureProfile2": False,
"ChangeVideoProfilevid": False,
"ChangeVideoProfilevid2": False,
"changePictureProfile": False,
"changeGroupPicture": [],
"changeGroupPicture2": [],
"keyCommand": "",
"myProfile": {
"displayName": "",
"coverId": "",
"pictureStatus": "",
"statusMessage": ""
},
"Addsticker":{
"name": "",
"status":False
},
"Addsticker":{
"name": "",
"status":False
},
"stk":{},
"selfbot":True,
"Images":{},
"Img":{},
"Addimage":{
"name": "",
"status":False
},
"Videos":{},
"Addaudio":{
"name": "",
"status":False
},
"Addvideo":{
"name": "",
"status":False
},
"mimic": {
"copy": False,
"status": False,
"target": {}
},
"setKey": False,
"unsendMessage": False
}
read = {
"ROM": {},
"readPoint": {},
"readMember": {},
"readTime": {}
}
Setmain = {
"ayam": {},
}
list_language = {
"list_textToSpeech": {
"id": "Indonesia",
"af" : "Afrikaans",
"sq" : "Albanian",
"ar" : "Arabic",
"hy" : "Armenian",
"bn" : "Bengali",
"ca" : "Catalan",
"zh" : "Chinese",
"zh-cn" : "Chinese (Mandarin/China)",
"zh-tw" : "Chinese (Mandarin/Taiwan)",
"zh-yue" : "Chinese (Cantonese)",
"hr" : "Croatian",
"cs" : "Czech",
"da" : "Danish",
"nl" : "Dutch",
"en" : "English",
"en-au" : "English (Australia)",
"en-uk" : "English (United Kingdom)",
"en-us" : "English (United States)",
"eo" : "Esperanto",
"fi" : "Finnish",
"fr" : "French",
"de" : "German",
"el" : "Greek",
"hi" : "Hindi",
"hu" : "Hungarian",
"is" : "Icelandic",
"id" : "Indonesian",
"it" : "Italian",
"ja" : "Japanese",
"km" : "Khmer (Cambodian)",
"ko" : "Korean",
"la" : "Latin",
"lv" : "Latvian",
"mk" : "Macedonian",
"no" : "Norwegian",
"pl" : "Polish",
"pt" : "Portuguese",
"ro" : "Romanian",
"ru" : "Russian",
"sr" : "Serbian",
"si" : "Sinhala",
"sk" : "Slovak",
"es" : "Spanish",
"es-es" : "Spanish (Spain)",
"es-us" : "Spanish (United States)",
"sw" : "Swahili",
"sv" : "Swedish",
"ta" : "Tamil",
"th" : "Thai",
"tr" : "Turkish",
"uk" : "Ukrainian",
"vi" : "Vietnamese",
"cy" : "Welsh"
},
"list_translate": {
"af": "afrikaans",
"sq": "albanian",
"am": "amharic",
"ar": "arabic",
"hy": "armenian",
"az": "azerbaijani",
"eu": "basque",
"be": "belarusian",
"bn": "bengali",
"bs": "bosnian",
"bg": "bulgarian",
"ca": "catalan",
"ceb": "cebuano",
"ny": "chichewa",
"zh-cn": "chinese (simplified)",
"zh-tw": "chinese (traditional)",
"co": "corsican",
"hr": "croatian",
"cs": "czech",
"da": "danish",
"nl": "dutch",
"en": "english",
"eo": "esperanto",
"et": "estonian",
"tl": "filipino",
"fi": "finnish",
"fr": "french",
"fy": "frisian",
"gl": "galician",
"ka": "georgian",
"de": "german",
"el": "greek",
"gu": "gujarati",
"ht": "haitian creole",
"ha": "hausa",
"haw": "hawaiian",
"iw": "hebrew",
"hi": "hindi",
"hmn": "hmong",
"hu": "hungarian",
"is": "icelandic",
"ig": "igbo",
"id": "indonesian",
"ga": "irish",
"it": "italian",
"ja": "japanese",
"jw": "javanese",
"kn": "kannada",
"kk": "kazakh",
"km": "khmer",
"ko": "korean",
"ku": "kurdish (kurmanji)",
"ky": "kyrgyz",
"lo": "lao",
"la": "latin",
"lv": "latvian",
"lt": "lithuanian",
"lb": "luxembourgish",
"mk": "macedonian",
"mg": "malagasy",
"ms": "malay",
"ml": "malayalam",
"mt": "maltese",
"mi": "maori",
"mr": "marathi",
"mn": "mongolian",
"my": "myanmar (burmese)",
"ne": "nepali",
"no": "norwegian",
"ps": "pashto",
"fa": "persian",
"pl": "polish",
"pt": "portuguese",
"pa": "punjabi",
"ro": "romanian",
"ru": "russian",
"sm": "samoan",
"gd": "scots gaelic",
"sr": "serbian",
"st": "sesotho",
"sn": "shona",
"sd": "sindhi",
"si": "sinhala",
"sk": "slovak",
"sl": "slovenian",
"so": "somali",
"es": "spanish",
"su": "sundanese",
"sw": "swahili",
"sv": "swedish",
"tg": "tajik",
"ta": "tamil",
"te": "telugu",
"th": "thai",
"tr": "turkish",
"uk": "ukrainian",
"ur": "urdu",
"uz": "uzbek",
"vi": "vietnamese",
"cy": "welsh",
"xh": "xhosa",
"yi": "yiddish",
"yo": "yoruba",
"zu": "zulu",
"fil": "Filipino",
"he": "Hebrew"
}
}
try:
with open("Log_data.json","r",encoding="utf_8_sig") as f:
msg_dict = json.loads(f.read())
except:
print("Couldn't read Log data")
settings["myProfile"]["displayName"] = clientProfile.displayName
settings["myProfile"]["statusMessage"] = clientProfile.statusMessage
settings["myProfile"]["pictureStatus"] = clientProfile.pictureStatus
coverId = client.getProfileDetail()["result"]["objectId"]
settings["myProfile"]["coverId"] = coverId
imagesOpen = codecs.open("image.json","r","utf-8")
images = json.load(imagesOpen)
def restartBot():
print ("[ INFO ] BOT RESTART")
python = sys.executable
os.execl(python, python, *sys.argv)
def logError(text):
client.log("[ ERROR ] {}".format(str(text)))
tz = pytz.timezone("Asia/Jakarta")
timeNow = datetime.now(tz=tz)
timeHours = datetime.strftime(timeNow,"(%H:%M)")
day = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday","Friday", "Saturday"]
hari = ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"]
bulan = ["Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"]
inihari = datetime.now(tz=tz)
hr = inihari.strftime('%A')
bln = inihari.strftime('%m')
for i in range(len(day)):
if hr == day[i]: hasil = hari[i]
for k in range(0, len(bulan)):
if bln == str(k): bln = bulan[k-1]
time = "{}, {} - {} - {} | {}".format(str(hasil), str(inihari.strftime('%d')), str(bln), str(inihari.strftime('%Y')), str(inihari.strftime('%H:%M:%S')))
with open("logError.txt","a") as error:
error.write("\n[ {} ] {}".format(str(time), text))
def cTime_to_datetime(unixtime):
return datetime.fromtimestamp(int(str(unixtime)[:len(str(unixtime))-3]))
def dt_to_str(dt):
return dt.strftime('%H:%M:%S')
def delete_log():
ndt = datetime.now()
for data in msg_dict:
if (datetime.utcnow() - cTime_to_datetime(msg_dict[data]["createdTime"])) > timedelta(1):
if "path" in msg_dict[data]:
client.deleteFile(msg_dict[data]["path"])
del msg_dict[data]
def sendMention(to, text="", mids=[]):
arrData = ""
arr = []
mention = "@zeroxyuuki "
if mids == []:
raise Exception("Invalid mids")
if "@!" in text:
if text.count("@!") != len(mids):
raise Exception("Invalid mids")
texts = text.split("@!")
textx = ""
for mid in mids:
textx += str(texts[mids.index(mid)])
slen = len(textx)
elen = len(textx) + 15
arrData = {'S':str(slen), 'E':str(elen - 4), 'M':mid}
arr.append(arrData)
textx += mention
textx += str(texts[len(mids)])
else:
textx = ""
slen = len(textx)
elen = len(textx) + 15
arrData = {'S':str(slen), 'E':str(elen - 4), 'M':mids[0]}
arr.append(arrData)
textx += mention + str(text)
ki.sendMessage(to, textx, {'MENTION': str('{"MENTIONEES":' + json.dumps(arr) + '}')}, 0)
def sendMessageWithMention(to, mid):
try:
aa = '{"S":"0","E":"3","M":'+json.dumps(mid)+'}'
text_ = '@x '
client.sendMessage(to, text_, contentMetadata={'MENTION':'{"MENTIONEES":['+aa+']}'}, contentType=0)
except Exception as error:
logError(error)
def command(text):
pesan = text.lower()
if settings["setKey"] == True:
if pesan.startswith(settings["keyCommand"]):
cmd = pesan.replace(settings["keyCommand"],"")
else:
cmd = "Undefined command"
else:
cmd = text.lower()
return cmd
#Dont sell it fcking bitch *Akhirnya bisa bhs inggris
def changeVideoAndPictureProfile(pict, vids):
try:
files = {'file': open(vids, 'rb')}
obs_params = client.genOBSParams({'oid': clientMID, 'ver': '2.0', 'type': 'video', 'cat': 'vp.mp4', 'name': 'Hello_World.mp4'})
data = {'params': obs_params}
r_vp = client.server.postContent('{}/talk/vp/upload.nhn'.format(str(client.server.LINE_OBS_DOMAIN)), data=data, files=files)
if r_vp.status_code != 201:
return "Failed update profile"
client.updateProfilePicture(pict, 'vp')
return "Success update profile"
except Exception as e:
raise Exception("Error change video and picture profile %s"%str(e))
def changeVideoAndPictureProfile2(pict, vids):
try:
files = {'file': open(vids, 'rb')}
obs_params = ki.genOBSParams({'oid': kiMID, 'ver': '2.0', 'type': 'video', 'cat': 'vp.mp4', 'name': 'Hello_World.mp4'})
data = {'params': obs_params}
r_vp = ki.server.postContent('{}/talk/vp/upload.nhn'.format(str(ki.server.LINE_OBS_DOMAIN)), data=data, files=files)
if r_vp.status_code != 201:
return "Failed update profile"
ki.updateProfilePicture(pict, 'vp')
return "Success update profile"
except Exception as e:
raise Exception("Error change video and picture profile %s"%str(e))
def clientBot(op):
try:
if op.type == 0:
return
if op.type == 10 or op.type == 11:
print ("[ 5 ] cvp ADD CONTACT")
try:
videos = "tmp/LINE_MOVIE_1532404146855.mp4"
pictures = "tmp/imag.jpg"
changeVideoAndPictureProfile(pictures, videos)
except Exception as error:
logError(error)
traceback.print_tb(error.__traceback__)
if op.type == 13:
print ("[ 13 ] NOTIFIED INVITE INTO GROUP")
if clientMid in op.param3:
if settings["autoJoin"] == True:
ki.acceptGroupInvitation(op.param1)
if op.type in [22, 24]:
print ("[ 22 And 24 ] NOTIFIED INVITE INTO ROOM & NOTIFIED LEAVE ROOM")
if settings["autoLeave"] == True:
client.leaveRoom(op.param1)
if op.type == 25 or op.type == 26:
try:
msg = op.message
text = msg.text
msg_id = msg.id
receiver = msg.to
sender = msg._from
setKey = settings["keyCommand"].title()
if settings["setKey"] == False:
setKey = ''
if msg.toType == 0 or msg.toType == 1 or msg.toType == 2:
if msg.toType == 0:
if sender != client.profile.mid:
to = sender
else:
to = receiver
elif msg.toType == 1:
to = receiver
elif msg.toType == 2:
to = receiver
if msg.contentType == 0:
if text is None:
return
else:
for image in images:
if sender in admin:
if text.lower() == image:
ki.sendImage(msg.to, images[image])
cmd = command(text)
if cmd == "983jwmslsuahoihelp":
helpMessage = helpmessage()
ki.sendMessage(to, str(helpMessage))
elif cmd.startswith("changetsg5443key:"):
sep = text.split(" ")
key = text.replace(sep[0] + " ","")
if " " in key:
ki.sendMessage(to, "Key tidak bisa menggunakan spasi")
else:
settings["keyCommand"] = str(key).lower()
ki.sendMessage(to, "Berhasil mengubah key command menjadi [ {} ]".format(str(key).lower()))
elif cmd == "runtime":
if msg._from in admin:
timeNow = time.time()
runtime = timeNow - botStart
runtime = format_timespan(runtime)
ki.sendMessage(to, "Bot sudah berjalan selama {}".format(str(runtime)))
elif cmd in ["kizuna gpicture","trapchan gpicture"]:
if msg._from in admin:
group = ki.getGroup(to)
path = "http://dl.profile.line-cdn.net/" + group.pictureStatus
ki.sendImageWithURL(to, path)
elif cmd == "restart":
if msg._from in admin:
ki.sendMessage(to, "Berhasil merestart Bot")
restartBot()
elif cmd in ["about kizuna","about trapchan"]:
try:
arr = []
owner = "u8904e320fb5961cc1509118e58dc7e05"
creator = ki.getContact(owner)
contact = ki.getContact(kiMID)
grouplist = ki.getGroupIdsJoined()
contactlist = ki.getAllContactIds()
blockedlist = ki.getBlockedContactIds()
ret_ = "「 About @! 」"
ret_ += "\n Name : {}".format(contact.displayName)
ret_ += "\n Group : {}".format(str(len(grouplist)))
ret_ += "\n Friend : {} ".format(str(len(contactlist)))
ret_ += "\n Blocked : 736 "
sendMention(to, str(ret_), [kiMID])
except Exception as e:
ki.sendMessage(msg.to, str(e))
# Pembatas Script #
elif cmd == "autoadd on":
if sender in admin:
settings["autoAdd"] = True
ki.sendMessage(to, "Berhasil mengaktifkan auto add")
elif cmd == "autoadd off":
if sender in admin:
settings["autoAdd"] = False
ki.sendMessage(to, "Berhasil mengaktifkan auto add")
elif cmd == "autojoin on":
if sender in admin:
settings["autoJoin"] = True
ki.sendMessage(to, "Berhasil mengaktifkan auto join")
elif cmd == "autojoin off":
if sender in admin:
settings["autoJoin"] = False
ki.sendMessage(to, "Berhasil menonaktifkan auto join")
elif cmd == "ya on":
if sender in admin:
settings["ya"] = True
ki.sendMessage(to, "Berhasil mengaktifkan sc")
elif cmd == "ya off":
if sender in admin:
settings["ya"] = False
ki.sendMessage(to, "Berhasil menonaktifkan sc")
elif cmd == "autoleave on":
if sender in admin:
settings["autoLeave"] = True
ki.sendMessage(to, "Berhasil mengaktifkan auto leave")
elif cmd == "autoleave off":
if sender in admin:
settings["autoLeave"] = False
ki.sendMessage(to, "Berhasil menonaktifkan auto leave")
elif cmd == "autorespon on":
if sender in admin:
settings["autoRespon"] = True
ki.sendMessage(to, "Berhasil mengaktifkan auto respon")
elif cmd == "autorespon off":
if sender in admin:
settings["autoRespon"] = False
ki.sendMessage(to, "Berhasil menonaktifkan auto respon")
elif cmd == "autoread on":
if sender in admin:
settings["autoRead"] = True
ki.sendMessage(to, "Berhasil mengaktifkan auto read")
elif cmd == "autoread off":
if sender in admin:
settings["autoRead"] = False
ki.sendMessage(to, "Berhasil menonaktifkan auto read")
elif cmd == "autojointicket on":
if msg._from in admin:
settings["autoJoinTicket"] = True
ki.sendMessage(to, "Berhasil mengaktifkan auto join by ticket")
elif cmd == "autoJoinTicket off":
if msg._from in admin:
settings["autoJoinTicket"] = False
ki.sendMessage(to, "Berhasil menonaktifkan auto join by ticket")
elif cmd == "checkcontact on":
if sender in admin:
settings["checkContact"] = True
ki.sendMessage(to, "Berhasil mengaktifkan check details contact")
elif cmd == "checkcontact off":
if sender in admin:
settings["checkContact"] = False
ki.sendMessage(to, "Berhasil menonaktifkan check details contact")
elif cmd == "checkpost on":
if sender in admin:
settings["checkPost"] = True
ki.sendMessage(to, "Berhasil mengaktifkan check details post")
elif cmd == "checkpost off":
if sender in admin:
settings["checkPost"] = False
ki.sendMessage(to, "Berhasil menonaktifkan check details post")
elif cmd == "checksticker on":
if sender in admin:
settings["checkSticker"] = True
ki.sendMessage(to, "Berhasil mengaktifkan check details sticker")
elif cmd == "checksticker off":
if sender in admin:
settings["checkSticker"] = False
ki.sendMessage(to, "Berhasil menonaktifkan check details sticker")
elif cmd == "unsendchat on":
if sender in admin:
settings["unsendMessage"] = True
ki.sendMessage(to, "Berhasil mengaktifkan unsend message")
elif cmd == "unsendchat off":
if sender in admin:
settings["unsendMessage"] = False
ki.sendMessage(to, "Berhasil menonaktifkan unsend message")
elif cmd == "suf on":
if sender in admin:
settings["suf"] = True
ki.sendMessage(to, "Berhasil mengaktifkan suf message")
elif cmd == "suf off":
if sender in admin:
settings["suf"] = False
ki.sendMessage(to, "Berhasil menonaktifkan suf message")
elif cmd == "status":
if sender in admin:
try:
ret_ = "âââ[ Status ]"
if settings["autoAdd"] == True: ret_ += "\nâ ââ[ ON ] Auto Add"
else: ret_ += "\nâ ââ[ OFF ] Auto Add"
if settings["suf"] == True: ret_ += "\nâ ââ[ ON ] suf"
else: ret_ += "\nâ ââ[ OFF ] suf"
if settings["ya"] == True: ret_ += "\nâ ââ[ ON ] ya"
else: ret_ += "\nâ ââ[ OFF ] ya"
if settings["autoJoin"] == True: ret_ += "\nâ ââ[ ON ] Auto Join"
else: ret_ += "\nâ ââ[ OFF ] Auto Join"
if settings["autoLeave"] == True: ret_ += "\nâ ââ[ ON ] Auto Leave Room"
else: ret_ += "\nâ ââ[ OFF ] Auto Leave Room"
if settings["autoJoinTicket"] == True: ret_ += "\nâ ââ[ ON ] Auto Join Ticket"
else: ret_ += "\nâ ââ[ OFF ] Auto Join Ticket"
if settings["autoRead"] == True: ret_ += "\nâ ââ[ ON ] Auto Read"
else: ret_ += "\nâ ââ[ OFF ] Auto Read"
if settings["autoRespon"] == True: ret_ += "\nâ ââ[ ON ] Detect Mention"
else: ret_ += "\nâ ââ[ OFF ] Detect Mention"
if settings["checkContact"] == True: ret_ += "\nâ ââ[ ON ] Check Contact"
else: ret_ += "\nâ ââ[ OFF ] Check Contact"
if settings["checkPost"] == True: ret_ += "\nâ ââ[ ON ] Check Post"
else: ret_ += "\nâ ââ[ OFF ] Check Post"
if settings["checkSticker"] == True: ret_ += "\nâ ââ[ ON ] Check Sticker"
else: ret_ += "\nâ ââ[ OFF ] Check Sticker"
if settings["setKey"] == True: ret_ += "\nâ ââ[ ON ] Set Key"
else: ret_ += "\nâ ââ[ OFF ] Set Key"
if settings["unsendMessage"] == True: ret_ += "\nâ ââ[ ON ] Unsend Message"
else: ret_ += "\nâ ââ[ OFF ] Unsend Message"
ret_ += "\nâââ[ Status ]"
ki.sendMessage(to, str(ret_))
except Exception as e:
ki.sendMessage(msg.to, str(e))
# Pembatas Script #
elif cmd == "me":
if sender in admin:
sendMention(to, "@!", [sender])
ki.sendContact(to, sender)
elif cmd == "mymid":
if sender in admin:
client.sendMessage(to, "[ MID ]\n{}".format(sender))
elif cmd == "myname":
if sender in admin:
contact = client.getContact(sender)
client.sendMessage(to, "[ Display Name ]\n{}".format(contact.displayName))
elif cmd == "mybio":
if sender in admin:
contact = client.getContact(sender)
client.sendMessage(to, "[ Status Message ]\n{}".format(contact.statusMessage))
elif cmd == "mypicture":
if sender in admin:
contact = client.getContact(sender)
client.sendImageWithURL(to,"http://dl.profile.line-cdn.net/{}".format(contact.pictureStatus))
elif cmd == "myvideoprofile":
if msg._from in admin:
contact = client.getContact(sender)
client.sendVideoWithURL(to,"http://dl.profile.line-cdn.net/{}/vp".format(contact.pictureStatus))
elif cmd == "mycover":
if sender in admin:
channel = client.getProfileCoverURL(sender)
path = str(channel)
client.sendImageWithURL(to, path)
elif cmd == "my ticket":
if sender in admin:
client.sendMessage(to, '? Your Ticket ?\nhttp://line.me/ti/p/{}'.format(client.getUserTicket().id))
elif cmd == "changedp":
if msg._from in admin:
settings["changePictureProfile"] = True
client.sendMessage(to, "Silahkan kirim gambarnya")
elif cmd in ["kizuna changedp","trapchan changedp"]:
if msg._from in admin:
settings["changePictureProfile2"] = True
ki.sendMessage(to, "Silahkan kirim gambarnya")
elif cmd == "kizuna cvp":
if msg._from in admin:
settings["ChangeVideoProfilevid2"] = True
client.sendMessage(to, "「Profile 」\nType : Change Profile Video Picture\nStatus : Send the video...")
elif cmd == "cvp":
if msg._from in admin:
settings["ChangeVideoProfilevid"] = True
client.sendMessage(to, "「Profile 」\nType : Change Profile Video Picture\nStatus : Send the video....")
elif cmd == 'gcreator':
if msg._from in admin:
group = ki.getGroup(to)
GS = group.creator.mid
ki.sendContact(to, GS)
elif msg.text.lower().startswith("kizuna kick "):
if msg._from in admin:
targets = []
key = eval(msg.contentMetadata["MENTION"])
key["MENTIONEES"][0]["M"]
for x in key["MENTIONEES"]:
targets.append(x["M"])
for target in targets:
try:
ki.kickoutFromGroup(msg.to,[target])
except:
ki.sendMessage(msg.to,"Error")
elif cmd == 'inv:gcreator':
if msg.toType == 2:
ginfo = ki.getGroup(msg.to)
gCreator = ginfo.creator.mid
try:
ki.findAndAddContactsByMid(gCreator)
ki.inviteIntoGroup(msg.to,[gCreator])
print ("success inv gCreator")
except:
pass
elif cmd == 'lgid':
gid = ki.getGroupIdsJoined()
h = ""
for i in gid:
h += "[%s]:%s\n" % (ki.getGroup(i).name,i)
ki.sendMessage(msg.to,h)
elif cmd in ["kizuna change gpicture","trapchan change gpicture"]:
if msg._from in admin:
if msg.toType == 2:
if to not in settings["changeGroupPicture"]:
settings["changeGroupPicture"].append(to)
ki.sendMessage(to, "Silahkan kirim gambarnya")
elif cmd in ["kizuna mention","trapchan mention"]:
if msg._from in admin:
group = ki.getGroup(msg.to)
nama = [contact.mid for contact in group.members]
k = len(nama)//100
for a in range(k+1):
txt = u''
s=0
b=[]
for i in group.members[a*100 : (a+1)*100]:
b.append({"S":str(s), "E" :str(s+6), "M":i.mid})
s += 7
txt += u'@Zero \n'
ki.sendMessage(to, text=txt, contentMetadata={u'MENTION': json.dumps({'MENTIONEES':b})}, contentType=0)
ki.sendMessage(to, "Total {} Members".format(str(len(nama))))
elif cmd.startswith("accept"):
if msg._from in admin:
gid = ki.getGroupIdsInvited()
_list = ""
for i in gid:
if i is not None:
gids = ki.getGroup(i)
_list += gids.name
ki.acceptGroupInvitation(i)
else:
break
if gid is not None:
ki.sendMessage(msg.to,"Berhasil terima semua undangan dari grup :\n" + _list)
else:
ki.sendMessage(msg.to,"Tidak ada grup yang tertunda saat ini")
elif cmd == 'listgroup':
groups = ki.getGroupIdsJoined()
ret_ = "「 Group List 」"
no = 0 + 1
for gid in groups:
group = ki.getGroup(gid)
ret_ += "\nâ {}. {} - {}".format(str(no), str(group.name), str(len(group.members)))
no += 1
ret_ += "\n「 Total {} Groups 」".format(str(len(groups)))
ki.sendMessage(to, str(ret_))
# Pembatas Script #
elif cmd.startswith("kizuna getpp"):
if 'MENTION' in msg.contentMetadata.keys()!= None:
names = re.findall(r'@(\w+)', text)
mention = ast.literal_eval(msg.contentMetadata['MENTION'])
mentionees = mention['MENTIONEES']
lists = []
for mention in mentionees:
if mention["M"] not in lists:
lists.append(mention["M"])
for ls in lists:
contact = ki.getContact(ls)
path = "http://dl.profile.line.naver.jp/{}".format(contact.pictureStatus)
ki.sendImageWithURL(to, str(path))
elif cmd.startswith("kizuna getvp "):
if 'MENTION' in msg.contentMetadata.keys()!= None:
names = re.findall(r'@(\w+)', text)
mention = ast.literal_eval(msg.contentMetadata['MENTION'])
mentionees = mention['MENTIONEES']
lists = []
for mention in mentionees:
if mention["M"] not in lists:
lists.append(mention["M"])
for ls in lists:
contact = ki.getContact(ls)
path = "http://dl.profile.line.naver.jp/{}/vp".format(contact.pictureStatus)
ki.sendVideoWithURL(to, str(path))
elif cmd.startswith("tag: "):
if msg._from in admin:
proses = text.split(":")
strnum = text.replace(proses[0] + ":","")
num = int(strnum)
Setmain["ayam"] = num
ki.sendMessage(msg.to,"[ Status Spamtag ]\nBerhasil diubah jadi {} kali".format(str(strnum)))
elif "tag @" in msg.text:
if msg._from in admin:
_name = msg.text.replace("tag @","")
_nametarget = _name.rstrip(' ')
gs = ki.getGroup(msg.to)
for g in gs.members:
if _nametarget == g.displayName:
jmlh = int(Setmain["ayam"])
if jmlh <= 1000:
for x in range(jmlh):
try:
sendMention(to, "@!",[g.mid])
except Exception as e:
ki.sendMessage(msg.to,str(e))
else:
pass
elif "tag hai @" in msg.text:
if msg._from in admin:
_name = msg.text.replace("tag hai @","")
_nametarget = _name.rstrip(' ')
gs = ki.getGroup(msg.to)
for g in gs.members:
if _nametarget == g.displayName:
jmlh = int(Setmain["ayam"])
if jmlh <= 1000:
for x in range(jmlh):
try:
sendMention(to, "@! hai",[g.mid])
except Exception as e:
ki.sendMessage(msg.to,str(e))
else:
pass
elif cmd.startswith("kizuna getcover "):
if ki != None:
if 'MENTION' in msg.contentMetadata.keys()!= None:
names = re.findall(r'@(\w+)', text)
mention = ast.literal_eval(msg.contentMetadata['MENTION'])
mentionees = mention['MENTIONEES']
lists = []
for mention in mentionees:
if mention["M"] not in lists:
lists.append(mention["M"])
for ls in lists:
channel = ki.getProfileCoverURL(ls)
path = str(channel)
ki.sendImageWithURL(to, str(path))
elif msg.text.lower().startswith("gbc "):
if msg._from in admin:
sep = text.split(" ")
txt = text.replace(sep[0] + " ","")
groups = ki.getGroupIdsJoined()
for group in groups:
ki.sendMessage(group, "{}".format(str(txt)))
ki.sendMessage(to, "Success broadcast to 198 group")
elif cmd.startswith("kizuna ssweb"):
if msg._from in admin:
try:
sep = text.split(" ")
query = text.replace(sep[0] + " ","")
r = requests.get("http://rahandiapi.herokuapp.com/sswebAPI?key=betakey&link={}".format(urllib.parse.quote(query)))
data = r.text
data = json.loads(data)
ki.sendImageWithURL(to, data["result"])
except Exception as error:
logError(error)
elif cmd in ["kizuna invgcall","trapchan invgcall"]:
if msg._from in admin:
if msg.toType == 2:
sep = text.split(" ")
strnum = text.replace(sep[0] + " ","")
num = int(strnum)
for var in range(0,num):
group = ki.getGroup(to)
members = [mem.mid for mem in group.members]
ki.acquireGroupCallRoute(to)
ki.inviteIntoGroupCall(to, contactIds=members)
#ki.sendMessage(to, "Berhasil mengundang kedalam telponan group")
elif text.lower() == 'rejectall':
ginvited = client.ginvited
if ginvited != [] and ginvited != None:
for gid in ginvited:
client.rejectGroupInvitation(gid)
client.sendMessage(to, "Berhasil tolak sebanyak {} undangan grup".format(str(len(ginvited))))
else:
client.sendMessage(to, "Tidak ada undangan yang tertunda")
elif text.startswith("imagetext"):
if msg._from in admin:
sep = text.split(" ")
textnya = text.replace(sep[0] + " ","")
url = "http://chart.apis.google.com/chart?chs=480x80&cht=p3&chtt=" + textnya + "&chts=FFFFFF,70&chf=bg,s,000000"
ki.sendImageWithURL(msg.to, url)
elif cmd in ["kizuna invite","trapchan invite"]:
if msg._from in admin:
key = msg.text[-33:]
ki.findAndAddContactsByMid(key)
ki.inviteIntoGroup(msg.to, [key])
contact = ki.getContact(key)
elif cmd.startswith("searchvid "):
if msg._from in admin:
sep = msg.text.split(" ")
search = msg.text.replace(sep[0] + " ","")
with requests.session() as web:
web.headers["User-Agent"] = random.choice(settingss["userAgent"])
url = web.get("http://rahandiapi.herokuapp.com/youtubeapi/search?key=betakey&q={}".format(urllib.parse.quote(search)))
data = url.text
data = json.loads(data)
if data["result"] != []:
video = random.choice(data["result"]["videolist"])
vid = video["url"]
start = time.time()
ki.sendVideoWithURL(msg.to, str(vid))
elif cmd.startswith("searchanime "):
if msg._from in admin:
sep = msg.text.split(" ")
anime = msg.text.replace(sep[0] + " ","%20")
with requests.session() as web:
web.headers["user-agent"] = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
r = web.get("https://kitsu.io/api/edge/anime?filter[text]={}".format(urllib.parse.quote(anime)))
data = r.text
data = json.loads(data)
ret_ = ''
if data["data"] != []:
for a in data["data"]:
if a["attributes"]["subtype"] == "TV":
sin = a["attributes"]["synopsis"]
translator = Translator()
hasil = translator.translate(sin, dest='id')
sinop = hasil.text
ret_ += 'Anime : {} '.format(str(a["attributes"]["canonicalTitle"]))
ret_ += '\nRilis : '+str(a["attributes"]["startDate"])
ret_ += '\nRating : '+str(a["attributes"]["ratingRank"])
ret_ += '\nType : '+str(a["attributes"]["subtype"])
ret_ += '\nSinopsis :\n'+str(sinop)
ret_ += '\n\n'
ki.sendImageWithURL(msg.to, str(a["attributes"]["posterImage"]["small"]))
ki.sendMessage(msg.to, str(ret_))
elif cmd.startswith("searchgif "):
if msg._from in admin:
proses = text.split(" ")
urutan = text.replace(proses[0] + " ","")
count = urutan.split("|")
search = str(count[0])
r = requests.get("https://api.tenor.com/v1/search?key=PVS5D2UHR0EV&limit=10&q="+str(search))
data = json.loads(r.text)
if len(count) == 1:
no = 0
hasil = "「 Searching result 」\n"
for aa in data["results"]:
no += 1
hasil += "\n" + str(no) + ". " + str(aa["title"])
ret_ = "\nType: searchgif {} | number\ntoo see the gif".format(str(search))
ki.sendMessage(msg.to,hasil+ret_)
elif len(count) == 2:
try:
num = int(count[1])
b = data["results"][num - 1]
c = str(b["id"])
dl = str(b["media"][0]["loopedmp4"]["url"])
ki.sendVideoWithURL(msg.to,dl)
except Exception as e:
ki.sendMessage(msg.to," "+str(e))
elif 'yutubmp4 ' in text.lower():
if msg._from in admin:
textToSearch = (msg.text).replace('youtubemp4 ', "").strip()
query = urllib.parse.quote(textToSearch)
url = "https://www.youtube.com/results?search_query=" + query
response = urllib.request.urlopen(url)
html = response.read()
soup = BeautifulSoup(html, "html.parser")
results = soup.find(attrs={'class':'yt-uix-tile-link'})
dl = 'https://www.youtube.com' + results['href']
vid = pafy.new(dl)
stream = vid.streams
for s in stream:
vin = s.url
hasil = ' Informasi \n\n'