-
Notifications
You must be signed in to change notification settings - Fork 75
/
Self.py
3754 lines (3645 loc) · 151 KB
/
Self.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 -*-
import TOBY
import goslate
import requests
import urllib
import urllib2
import subprocess
import profile
import client
import wikipedia
import requests
from gtts import gTTS
from TOBY.lib.curve.ttypes import *
from datetime import datetime
import time,random,sys,json,codecs,threading,glob,re
from bs4 import BeautifulSoup
from threading import Thread
cl = TOBY.LINE() #Bot Utama
cl.login(qr=True)
cl.loginResult()
kc = kk = ki = kl = cl
print "Login Berhasil"
reload(sys)
sys.setdefaultencoding('utf-8')
#album = None
#image_path = 'tmp/tmp.jpg'
helpMessage ="""
════════════════
║śєʟғ ṭȏɞʏ║ɞȏṭ ṭȏɞʏ║
════════════════
║> /pяȏṭєċṭ [ċȏṃṃѧṅԀ קяȏṭєċṭ]
║> /śṭєѧʟ [ċȏṃṃѧṅԀ śṭєѧʟ]
║> /ɢıғṭ [ċȏṃṃѧṅԀ ɢıғṭ]
║> /ṭяѧṅśʟѧṭє [ċȏṃṃѧṅԀ ṭяѧṅśʟѧṭє]
║> /śȏċṃєԀ [ċȏṃṃѧṅԀ śȏċṃєԀ]
║> /ɞȏṭ [ċȏṃṃѧṅԀ ɞȏṭ]
║> /śєṭṭıṅɢ [ċȏṃṃѧṅԀ śєṭṭıṅɢ]
╠═══════════════
║> ċяєѧṭȏя :
║=> line://ti/p/~tobyg74
╠═══════════════
║> ṿєяśıȏṅ :
║=> 1.7.5ɞєṭѧ
╠═══════════════
║> ṭʏקє ɞȏṭ :
║=> ṭċя
╠═══════════════
║> єԀıṭєԀ ɞʏ :
║=> ṭȏɞʏ
║=> ғıԀһȏ
════════════════
"""
protectMessage ="""
║śєʟғ ṭȏɞʏ║ɞȏṭ ṭȏɞʏ║Protect
════════════════
║> qr on/oғғ
║> gυeѕт on/oғғ
║> мeмвer on/oғғ
║> groυp on/oғғ
║> ĸιcĸ on/oғғ
║> cancel on/oғғ
╠═══════════════
║> ċяєѧṭȏя :
║=> line://ti/p/~tobyg74
╠═══════════════
║> ṿєяśıȏṅ :
║=> 1.7.5ɞєṭѧ
╠═══════════════
║> ṭʏקє ɞȏṭ :
║=> ṭċя
╠═══════════════
║> єԀıṭєԀ ɞʏ :
║=> ṭȏɞʏ
║=> ғıԀһȏ
════════════════
"""
socmedMessage ="""
║śєʟғ ṭȏɞʏ║ɞȏṭ ṭȏɞʏ║Socmed
════════════════
║> wιĸι [тeхт]
║> ιg [тeхт]
║> ιмage [тeхт]
║> vιdeo [тeхт]
║> zodιaĸ [тeхт]
║> yoυтυвe [тeхт]
║> lιrιĸ [тeхт]
║> ιdlιne [тeхт]
║> мυѕιc [тeхт]
║> тιмe [тιмe]
║> ѕay [тeхт]
╠═══════════════
║> ċяєѧṭȏя :
║=> line://ti/p/~tobyg74
╠═══════════════
║> ṿєяśıȏṅ :
║=> 1.7.5ɞєṭѧ
╠═══════════════
║> ṭʏקє ɞȏṭ :
║=> ṭċя
╠═══════════════
║> єԀıṭєԀ ɞʏ :
║=> ṭȏɞʏ
║=> ғıԀһȏ
════════════════
"""
translateMessage ="""
║śєʟғ ṭȏɞʏ║ɞȏṭ ṭȏɞʏ║Translate
════════════════
║> тr-ιd = ιndoneѕιa
║> тr-мy = мyanмar
║> тr-en = englιѕн
║> тr-тн = тнaιland
║> тr-ja = japaneѕe
║> тr-мѕ = мalayѕιa
║> тr-ιт = ιтalιan
║> тr-тr = тυrĸιѕн
║> тr-aғ = aғrιĸaanѕ
║> тr-ѕq = alвanιan
║> тr-aм = aмнarιc
║> тr-ar = araвιc
║> тr-нy = arмenιan
╠═══════════════
║> ċяєѧṭȏя :
║=> line://ti/p/~tobyg74
╠═══════════════
║> ṿєяśıȏṅ :
║=> 1.7.5ɞєṭѧ
╠═══════════════
║> ṭʏקє ɞȏṭ :
║=> ṭċя
╠═══════════════
║> єԀıṭєԀ ɞʏ :
║=> ṭȏɞʏ
║=> ғıԀһȏ
════════════════
"""
botMessage ="""
║śєʟғ ṭȏɞʏ║ɞȏṭ ṭȏɞʏ║Bot
════════════════
║> nĸ [naмe]
║> vĸ [naмe]
║> nυĸe
║> lυrĸιng > lυrĸerѕ
║> тeѕт
║> reѕpon
║> ѕpeed
║> glιѕт
║> тagall
║> reѕтarт
║> cn [тeхт]
║> cѕ [тeхт]
║> мe
║> craѕн
╠═══════════════
║> ċяєѧṭȏя :
║=> line://ti/p/~tobyg74
╠═══════════════
║> ṿєяśıȏṅ :
║=> 1.7.5ɞєṭѧ
╠═══════════════
║> ṭʏקє ɞȏṭ :
║=> ṭċя
╠═══════════════
║> єԀıṭєԀ ɞʏ :
║=> ṭȏɞʏ
║=> ғıԀһȏ
════════════════
"""
settingMessage ="""
║śєʟғ ṭȏɞʏ║ɞȏṭ ṭȏɞʏ║Setting
════════════════
║> ѕeт
║> тag on/oғғ
║> тag2 on/oғғ
║> aυтolιĸe on/oғғ
║> add on/oғғ
║> joιn on/oғғ
║> ѕнare on/oғғ
║> coммenт on/oғғ
║> ĸ on/oғғ
║> njoιn on/oғғ
║> nleave on/oғғ
╠═══════════════
║> ċяєѧṭȏя :
║=> line://ti/p/~tobyg74
╠═══════════════
║> ṿєяśıȏṅ :
║=> 1.7.5ɞєṭѧ
╠═══════════════
║> ṭʏקє ɞȏṭ :
║=> ṭċя
╠═══════════════
║> єԀıṭєԀ ɞʏ :
║=> ṭȏɞʏ
║=> ғıԀһȏ
════════════════
"""
giftMessage ="""
║śєʟғ ṭȏɞʏ║ɞȏṭ ṭȏɞʏ║Gift
════════════════
║> gιғт
║> gιғт 1
║> gιғт 2
║> gιғт 3
╠═══════════════
║> ċяєѧṭȏя :
║=> line://ti/p/~tobyg74
╠═══════════════
║> ṿєяśıȏṅ :
║=> 1.7.5ɞєṭѧ
╠═══════════════
║> ṭʏקє ɞȏṭ :
║=> ṭċя
╠═══════════════
║> єԀıṭєԀ ɞʏ :
║=> ṭȏɞʏ
║=> ғıԀһȏ
════════════════
"""
stealMessage ="""
║śєʟғ ṭȏɞʏ║ɞȏṭ ṭȏɞʏ║Steal
════════════════
║> geтnaмe @
║> geтвιo @
║> geтιnғo @
║> geтpp @
║> geтcover @
║> geтмιd @
║> geтgroυp
║> ѕeтιмage [lιnĸ]
║> papιмage
║> ѕeтvιdeo [lιnĸ]
║> papvιdeo
║> мycopy @
║> мyвacĸυp
╠═══════════════
║> ċяєѧṭȏя :
║=> line://ti/p/~tobyg74
╠═══════════════
║> ṿєяśıȏṅ :
║=> 1.7.5ɞєṭѧ
╠═══════════════
║> ṭʏקє ɞȏṭ :
║=> ṭċя
╠═══════════════
║> єԀıṭєԀ ɞʏ :
║=> ṭȏɞʏ
║=> ғıԀһȏ
════════════════
"""
KAC=[cl,ki,kk,kc,kl]
mid = cl.getProfile().mid
Amid = ki.getProfile().mid
Bmid = kk.getProfile().mid
Cmid = kc.getProfile().mid
Dmid = kl.getProfile().mid
Bots=[mid,Amid,Bmid,Cmid]
admin=["ua7fb5762d5066629323d113e1266e8ca","u76afd5ee45544818f285ca2ea21eb242","u3a4ffa2e5bf130bdc4c89b0db4f772a3","u9e89034ee9d93f92a350bc813bdcc702"]
creator=["ua7fb5762d5066629323d113e1266e8ca","u76afd5ee45544818f285ca2ea21eb242","u3a4ffa2e5bf130bdc4c89b0db4f772a3","u9e89034ee9d93f92a350bc813bdcc702"]
wait = {
'contact':False,
'autoJoin':True,
'autoCancel':{"on":True,"members":1},
'leaveRoom':True,
'timeline':True,
'autoAdd':True,
'message':"""Owner : line://ti/p/~tobyg74\n\n<=<[OpenJasaBot]>=>\n\n> SelfBotProtect\n>BotProtectTora 5 bot\n\nSelf Dan Bot DiPisah\n#KaloMinatAddAja!!\nhttps://line.me/R/ti/p/%40qua3481v""",
"lang":"JP",
"comment":"""Owner : line://ti/p/~tobyg74\n\n<=<[OpenJasaSelfBot]>=>\n\n> SelfBotProtect\n> BotProtectTora\n#KaloMinatAddAja\nhttps://line.me/R/ti/p/%40qua3481v""",
"commentOn":True,
"commentBlack":{},
"wblack":False,
"dblack":False,
"clock":False,
"blacklist":{},
"wblacklist":False,
"dblacklist":False,
"QrProtect":False,
"MProtection":False,
"Protectguest":False,
"Protectcancel":False,
"autoKick":False,
"tag":False,
"tag2":False,
"likeOn":False,
"Wc":False,
"Lv":False,
"pname":False,
"pnharfbot":{},
"pname":{},
"pro_name":{},
"protectionOn":True,
"atjointicket":True
}
wait2 = {
'readPoint':{},
'readMember':{},
'setTime':{},
'ROM':{}
}
mimic = {
"copy":False,
"copy2":False,
"status":False,
"target":{}
}
setTime = {}
setTime = wait2['setTime']
contact = cl.getProfile()
mybackup = cl.getProfile()
mybackup.displayName = contact.displayName
mybackup.statusMessage = contact.statusMessage
mybackup.pictureStatus = contact.pictureStatus
contact = cl.getProfile()
backup = cl.getProfile()
backup.displayName = contact.displayName
backup.statusMessage = contact.statusMessage
backup.pictureStatus = contact.pictureStatus
mulai = time.time()
agent = {'User-Agent' : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)"}
def translate(to_translate, to_language="auto", language="auto"):
bahasa_awal = "auto"
bahasa_tujuan = to_language
kata = to_translate
url = 'https://translate.google.com/m?sl=%s&tl=%s&ie=UTF-8&prev=_m&q=%s' % (bahasa_awal, bahasa_tujuan, kata.replace(" ", "+"))
agent = {'User-Agent':'Mozilla/5.0'}
cari_hasil = 'class="t0">'
request = urllib2.Request(url, headers=agent)
page = urllib2.urlopen(request).read()
result = page[page.find(cari_hasil)+len(cari_hasil):]
result = result.split("<")[0]
return result
def download_page(url):
version = (3,0)
cur_version = sys.version_info
if cur_version >= version: #If the Current Version of Python is 3.0 or above
import urllib,request #urllib library for Extracting web pages
try:
headers = {}
headers['User-Agent'] = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
req = urllib,request.Request(url, headers = headers)
resp = urllib,request.urlopen(req)
respData = str(resp.read())
return respData
except Exception as e:
print(str(e))
else: #If the Current Version of Python is 2.x
import urllib2
try:
headers = {}
headers['User-Agent'] = "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17"
req = urllib2.Request(url, headers = headers)
response = urllib2.urlopen(req)
page = response.read()
return page
except:
return"Page Not found"
#Finding 'Next Image' from the given raw page
def _images_get_next_item(s):
start_line = s.find('rg_di')
if start_line == -1: #If no links are found then give an error!
end_quote = 0
link = "no_links"
return link, end_quote
else:
start_line = s.find('"class="rg_meta"')
start_content = s.find('"ou"',start_line+90)
end_content = s.find(',"ow"',start_content-90)
content_raw = str(s[start_content+6:end_content-1])
return content_raw, end_content
#Getting all links with the help of '_images_get_next_image'
def _images_get_all_items(page):
items = []
while True:
item, end_content = _images_get_next_item(page)
if item == "no_links":
break
else:
items.append(item) #Append all the links in the list named 'Links'
time.sleep(0.1) #Timer could be used to slow down the request for image downloads
page = page[end_content:]
return items
def autolike():
for zx in range(0,100):
hasil = cl.activity(limit=100)
if hasil['result']['posts'][zx]['postInfo']['liked'] == False:
try:
cl.like(hasil['result']['posts'][zx]['userInfo']['mid'],hasil['result']['posts'][zx]['postInfo']['postId'],likeType=1002)
cl.comment(hasil['result']['posts'][zx]['userInfo']['mid'],hasil['result']['posts'][zx]['postInfo']['postId'],"Auto Like By TobyBots!!\nID LINE : line://ti/p/~tobyg74\nIG : instagram.com/tobygaming74")
print "DiLike"
except:
pass
else:
print "Sudah DiLike"
time.sleep(500)
thread2 = threading.Thread(target=autolike)
thread2.daemon = True
thread2.start()
def yt(query):
with requests.session() as s:
isi = []
if query == "":
query = "S1B tanysyz"
s.headers['user-agent'] = 'Mozilla/5.0'
url = 'http://www.youtube.com/results'
params = {'search_query': query}
r = s.get(url, params=params)
soup = BeautifulSoup(r.content, 'html5lib')
for a in soup.select('.yt-lockup-title > a[title]'):
if '&list=' not in a['href']:
if 'watch?v' in a['href']:
b = a['href'].replace('watch?v=', '')
isi += ['youtu.be' + b]
return isi
def waktu(secs):
mins, secs = divmod(secs,60)
hours, mins = divmod(mins,60)
return '%02d Jam %02d Menit %02d Detik' % (hours, mins, secs)
def upload_tempimage(client):
'''
Upload a picture of a kitten. We don't ship one, so get creative!
'''
config = {
'album': album,
'name': 'bot auto upload',
'title': 'bot auto upload',
'description': 'bot auto upload'
}
print("Uploading image... ")
image = client.upload_from_path(image_path, config=config, anon=False)
print("Done")
print()
return image
def sendMessage(to, text, contentMetadata={}, contentType=0):
mes = Message()
mes.to, mes.from_ = to, profile.mid
mes.text = text
mes.contentType, mes.contentMetadata = contentType, contentMetadata
if to not in messageReq:
messageReq[to] = -1
messageReq[to] += 1
def sendMessage(to, text, contentMetadata={}, contentType=0):
mes = Message()
mes.to, mes.from_ = to, profile.mid
mes.text = text
mes.contentType, mes.contentMetadata = contentType, contentMetadata
if to not in messageReq:
messageReq[to] = -1
messageReq[to] += 1
def sendImage(self, to_, path):
M = Message(to=to_,contentType = 1)
M.contentMetadata = None
M.contentPreview = None
M_id = self.Talk.client.sendMessage(0,M).id
files = {
'file': open(path, 'rb'),
}
params = {
'name': 'media',
'oid': M_id,
'size': len(open(path, 'rb').read()),
'type': 'image',
'ver': '1.0',
}
data = {
'params': json.dumps(params)
}
r = self.post_content('https://os.line.naver.jp/talk/m/upload.nhn', data=data, files=files)
if r.status_code != 201:
raise Exception('Upload image failure.')
return True
def sendImageWithURL(self, to_, url):
path = '%s/pythonLine-%i.data' % (tempfile.gettempdir(), randint(0, 9))
r = requests.get(url, stream=True)
if r.status_code == 200:
with open(path, 'w') as f:
shutil.copyfileobj(r.raw, f)
else:
raise Exception('Download image failure.')
try:
self.sendImage(to_, path)
except Exception as e:
raise e
def restart_program():
python = sys.executable
os.execl(python, python, * sys.argv)
def post_content(self, urls, data=None, files=None):
return self._session.post(urls, headers=self._headers, data=data, files=files)
def sendMessage(to, text, contentMetadata={}, contentType=0):
mes = Message()
mes.to, mes.from_ = to, profile.mid
mes.text = text
mes.contentType, mes.contentMetadata = contentType, contentMetadata
if to not in messageReq:
messageReq[to] = -1
messageReq[to] += 1
def NOTIFIED_READ_MESSAGE(op):
try:
if op.param1 in wait2['readPoint']:
Name = cl.getContact(op.param2).displayName
if Name in wait2['readMember'][op.param1]:
pass
else:
wait2['readMember'][op.param1] += "\n9§9" + Name
wait2['ROM'][op.param1][op.param2] = "9§9" + Name
else:
pass
except:
pass
def sendAudio(self, to_, path):
M = Message(to=to_, text=None, contentType = 3)
M_id = self.Talk.client.sendMessage(0,M).id
files = {
'file': open(path, 'rb'),
}
params = {
'name': 'media',
'oid': M_id,
'size': len(open(path, 'rb').read()),
'type': 'audio',
'ver': '1.0',
}
data = {
'params': json.dumps(params)
}
r = self.post_content('https://os.line.naver.jp/talk/m/upload.nhn', data=data, files=files)
print r
if r.status_code != 201:
raise Exception('Upload audio failure.')
def sendAudioWithURL(self, to_, url):
path = '%s/pythonLine-%i.data' % (tempfile.gettempdir(), randint(0, 9))
r = requests.get(url, stream=True)
if r.status_code == 200:
with open(path, 'w') as f:
shutil.copyfileobj(r.raw, f)
else:
raise Exception('Download audio failure.')
try:
self.sendAudio(to_, path)
except Exception as e:
raise e
def sendVoice(self, to_, path):
M = Message(to=to_, text=None, contentType = 3)
M.contentPreview = None
M_id = self._client.sendMessage(0,M).id
files = {
'file': open(path, 'rb'),
}
params = {
'name': 'voice_message',
'oid': M_id,
'size': len(open(path, 'rb').read()),
'type': 'audio',
'ver': '1.0',
}
data = {
'params': json.dumps(params)
}
r = self.post_content('https://os.line.naver.jp/talk/m/upload.nhn', data=data, files=files)
if r.status_code != 201:
raise Exception('Upload voice failure.')
return True
def mention(to,nama):
aa = ""
bb = ""
strt = int(12)
akh = int(12)
nm = nama
#print nm
for mm in nm:
akh = akh + 2
aa += """{"S":"""+json.dumps(str(strt))+""","E":"""+json.dumps(str(akh))+""","M":"""+json.dumps(mm)+"},"""
strt = strt + 6
akh = akh + 4
bb += "► @c \n"
aa = (aa[:int(len(aa)-1)])
msg = Message()
msg.to = to
msg.text = "「Mention」\n"+bb
msg.contentMetadata = {'MENTION':'{"MENTIONEES":['+aa+']}','EMTVER':'4'}
#print msg
try:
cl.sendMessage(msg)
except Exception as error:
print error
def bot(op):
try:
if op.type == 0:
return
if op.type == 13:
cl.acceptGroupInvitation(op.param1)
cl.sendText(op.param1, "Terima Kasih Telah Invite")
if op.type == 5:
if wait["autoAdd"] == True:
cl.findAndAddContactsByMid(op.param1)
ki.findAndAddContactsByMid(op.param1)
kc.findAndAddContactsByMid(op.param1)
kl.findAndAddContactsByMid(op.param1)
kk.findAndAddContactsByMid(op.param1)
if (wait["message"] in [""," ","\n",None]):
pass
else:
cl.sendText(op.param1,str(wait["message"]))
ki.sendText(op.param1,str(wait["message"]))
kc.sendText(op.param1,str(wait["message"]))
kk.sendText(op.param1,str(wait["message"]))
#------------------NOTIFIED_READ_MESSAGE----------------#
if op.type == 55:
try:
group_id = op.param1
user_id=op.param2
subprocess.Popen('echo "'+ user_id+'|'+str(op.createdTime)+'" >> dataSeen/%s.txt' % group_id, shell=True, stdout=subprocess.PIPE, )
except Exception as e:
print e
if op.type == 26:
msg = op.message
if msg.text is None:
return
if "@"+cl.getProfile().displayName in msg.text:
if wait["tag"] == True:
tanya = msg.text.replace("@"+cl.getProfile().displayName,"")
jawab = ("Jangan tag si " +cl.getProfile().displayName+" dia sedang off/sibuk\nAutochat By Bots")
jawaban = (jawab)
cl.sendText(msg.to,jawaban)
if op.type == 26:
msg = op.message
if msg.text is None:
return
if "@"+cl.getProfile().displayName in msg.text:
if wait["tag2"] == True:
tanya = msg.text.replace("@"+cl.getProfile().displayName,"")
jawab = "Jangan tag si "+cl.getProfile().displayName+" dia sedang sibuk/off!!\n\n#AutoChatByBots!!"
jawaban = (jawab)
cl.sendAudio(msg.to,jawaban)
#--CANCEL KICK--#
if op.type == 32:
if wait["Protectcancel"] == True:
if op.param2 not in Bots or staff:
random.choice(KAC).kickoutFromGroup(op.param1,[op.param2])
#------Invite User Kick start------#
if op.type == 13:
if wait["Protectguest"] == True:
if op.param2 not in Bots:
random.choice(KAC).cancelGroupInvitation(op.param1,[op.param3])
random.choice(KAC).kickoutFromGroup(op.param1,[op.param2])
#------Invite User Kick Finish------#
#----MemberProtection------#
if op.type == 19:
if wait["MProtection"] == True:
if op.param2 not in Bots and staff:
random.choice(KAC).kickoutFromGroup(op.param1,[op.param2])
random.choice(KAC).inviteIntoGroup(op.param1,[op.param3])
#------Open QR Kick start------#
if op.type == 11:
if wait["QrProtect"] == True:
if op.param2 not in Bots:
G = random.choice(KAC).getGroup(op.param1)
G.preventJoinByTicket = True
random.choice(KAC).kickoutFromGroup(op.param1,[op.param3])
random.choice(KAC).updateGroup(G)
#------Open QR Kick finish-----#
if op.type == 17:
if wait["Wc"] == True:
if op.param2 in Bots:
return
ginfo = cl.getGroup(op.param1)
random.choice(KAC).sendText(op.param1, "Selamat Datang Di Grup : " + str(ginfo.name))
random.choice(KAC).sendText(op.param1, "Pembuat Grup : " + str(ginfo.name) + " :\n" + ginfo.creator.displayName)
random.choice(KAC).sendText(op.param1,"Jgn nakal ya!!")
print "MEMBER HAS JOIN THE GROUP"
if op.type == 15:
if wait["Lv"] == True:
if op.param2 in Bots:
return
ki.sendText(op.param1, "Good Bye Kaka")
print "MemberLeft"
#-----------------------------------------------
if op.type == 11:
if op.param3 == '1':
if op.param1 in wait['pname']:
try:
G = cl.getGroup(op.param1)
except:
try:
G = ki.getGroup(op.param1)
except:
try:
G = kk.getGroup(op.param1)
except:
try:
G = kc.getGroup(op.param1)
except:
try:
G = ks.getGroup(op.param1)
except:
try:
G = kt.getGroup(op.param1)
except:
pass
G.name = wait['pro_name'][op.param1]
try:
cl.updateGroup(G)
except:
try:
ki.updateGroup(G)
except:
try:
kk.updateGroup(G)
except:
try:
kc.updateGroup(G)
except:
try:
ks.updateGroup(G)
except:
try:
kt.updateGroup(G)
except:
pass
if op.param2 in Bots:
pass
else:
try:
ki.kickoutFromGroup(op.param1,[op.param2])
except:
try:
kk.kickoutFromGroup(op.param1,[op.param2])
except:
try:
kc.kickoutFromGroup(op.param1,[op.param2])
except:
try:
cl.kickoutFromGroup(op.param1,[op.param2])
except:
try:
kt.kickoutFromGroup(op.param1,[op.param2])
except:
pass
kk.sendText(op.param1,"please do not change group name-_-")
#--------------NOTIFIED_INVITE_INTO_GROUP----------------
if op.type == 13:
print op.param3
if op.param3 in mid:
if op.param2 in creator:
cl.acceptGroupInvitation(op.param1)
if op.param3 in Amid:
if op.param2 in creator:
ki.acceptGroupInvitation(op.param1)
if op.param3 in Bmid:
if op.param2 in creator:
kk.acceptGroupInvitation(op.param1)
if op.param3 in Cmid:
if op.param2 in creator:
kc.acceptGroupInvitation(op.param1)
#--------------------------------------------------------
if op.param3 in mid:
if op.param2 in Amid:
cl.acceptGroupInvitation(op.param1)
if op.param3 in mid:
if op.param2 in Bmid:
cl.acceptGroupInvitation(op.param1)
if op.param3 in mid:
if op.param2 in Cmid:
cl.acceptGroupInvitation(op.param1)
#--------------------------------------------------------
if op.param3 in Amid:
if op.param2 in mid:
ki.acceptGroupInvitation(op.param1)
if op.param3 in Amid:
if op.param2 in Bmid:
ki.acceptGroupInvitation(op.param1)
if op.param3 in Amid:
if op.param2 in Cmid:
ki.acceptGroupInvitation(op.param1)
#--------------------------------------------------------
if op.param3 in Bmid:
if op.param2 in mid:
kk.acceptGroupInvitation(op.param1)
if op.param3 in Bmid:
if op.param2 in Amid:
kk.acceptGroupInvitation(op.param1)
if op.param3 in Bmid:
if op.param2 in Cmid:
kk.acceptGroupInvitation(op.param1)
#--------------------------------------------------------
if op.param3 in Cmid:
if op.param2 in mid:
kc.acceptGroupInvitation(op.param1)
if op.param3 in Cmid:
if op.param2 in Amid:
kc.acceptGroupInvitation(op.param1)
if op.param3 in Cmid:
if op.param2 in Bmid:
kc.acceptGroupInvitation(op.param1)
#--------------------------------------------------------
if mid in op.param3:
if wait["autoJoin"] == True:
cl.acceptGroupInvitation(op.param1)
else:
cl.rejectGroupInvitation(op.param1)
else:
if wait["autoCancel"] == True:
if op.param3 in admin:
pass
else:
cl.cancelGroupInvitation(op.param1, [op.param3])
else:
if op.param3 in wait["blacklist"]:
cl.cancelGroupInvitation(op.param1, [op.param3])
cl.sendText(op.param1, "Itu kicker jgn di invite!")
else:
pass
#-----------------NOTIFIED_KICKOUT_FROM_GROUP-----------------
if op.type == 19:
if op.param3 in admin:
random.choice(KAC).kickoutFromGroup(op.param1,[op.param2])
random.choice(KAC).inviteIntoGroup(op.param1,admin)
else:
pass
#------NOTIFIED_KICKOUT_FROM_GROUP-----------------
if op.type == 19:
if wait["autoKick"] == True:
if op.param2 in admin:
pass
try:
cl.kickoutFromGroup(op.param1,[op.param2])
cl.inviteIntoGroup(op.param1,[op.param3])
except:
try:
cl.kickoutFromGroup(op.param1,[op.param2])
cl.inviteIntoGroup(op.param1,[op.param3])
except:
print ("client Kick regulation or Because it does not exist in the group\ngid=["+op.param1+"]\nmid=["+op.param2+"]")
if op.param2 in wait["blacklist"]:
pass
else:
if op.param2 in admin:
pass
else:
wait["blacklist"][op.param2] = True
if op.param2 in wait["blacklist"]:
pass
else:
if op.param2 in admin:
pass
else:
wait["blacklist"][op.param2] = True
#------------------NOTIFIED_KICKOUT_FROM_GROUP-----------------
if op.type == 22:
if wait["leaveRoom"] == True:
cl.leaveRoom(op.param1)
if op.type == 24:
if wait["leaveRoom"] == True:
cl.leaveRoom(op.param1)
if op.type == 25:
msg = op.message
#-----------------------------------------
if msg.toType == 1:
if wait["leaveRoom"] == True:
cl.leaveRoom(msg.to)
if msg.contentType == 16:
url = msg.contentMetadata("line://home/post?userMid="+mid+"&postId="+"new_post")
cl.like(url[25:58], url[66:], likeType=1001)
if op.type == 25:
msg = op.message
if msg.contentType == 13:
if wait["wblack"] == True:
if msg.contentMetadata["mid"] in wait["commentBlack"]:
cl.sendText(msg.to,"already")
wait["wblack"] = False
else:
wait["commentBlack"][msg.contentMetadata["mid"]] = True
wait["wblack"] = False
cl.sendText(msg.to,"decided not to comment")
elif wait["dblack"] == True:
if msg.contentMetadata["mid"] in wait["commentBlack"]:
del wait["commentBlack"][msg.contentMetadata["mid"]]
cl.sendText(msg.to,"deleted")
ki.sendText(msg.to,"deleted")
kk.sendText(msg.to,"deleted")
kc.sendText(msg.to,"deleted")
wait["dblack"] = False
else:
wait["dblack"] = False
cl.sendText(msg.to,"It is not in the black list")
ki.sendText(msg.to,"It is not in the black list")
kk.sendText(msg.to,"It is not in the black list")
kc.sendText(msg.to,"It is not in the black list")
elif wait["wblacklist"] == True:
if msg.contentMetadata["mid"] in wait["blacklist"]:
cl.sendText(msg.to,"already")
ki.sendText(msg.to,"already")
kk.sendText(msg.to,"already")
kc.sendText(msg.to,"already")
wait["wblacklist"] = False
else:
wait["blacklist"][msg.contentMetadata["mid"]] = True
wait["wblacklist"] = False
cl.sendText(msg.to,"aded")
ki.sendText(msg.to,"aded")
kk.sendText(msg.to,"aded")
kc.sendText(msg.to,"aded")
elif wait["dblacklist"] == True:
if msg.contentMetadata["mid"] in wait["blacklist"]:
del wait["blacklist"][msg.contentMetadata["mid"]]
cl.sendText(msg.to,"deleted")
ki.sendText(msg.to,"deleted")
kk.sendText(msg.to,"deleted")
kc.sendText(msg.to,"deleted")
wait["dblacklist"] = False
else:
wait["dblacklist"] = False
cl.sendText(msg.to,"It is not in the black list")
ki.sendText(msg.to,"It is not in the black list")
kk.sendText(msg.to,"It is not in the black list")
kc.sendText(msg.to,"It is not in the black list")
elif wait["contact"] == True:
msg.contentType = 0
cl.sendText(msg.to,msg.contentMetadata["mid"])
if 'displayName' in msg.contentMetadata:
contact = cl.getContact(msg.contentMetadata["mid"])
try:
cu = cl.channel.getCover(msg.contentMetadata["mid"])
except:
cu = ""
cl.sendText(msg.to,"[displayName]:\n" + msg.contentMetadata["displayName"] + "\n[mid]:\n" + msg.contentMetadata["mid"] + "\n[statusMessage]:\n" + contact.statusMessage + "\n[pictureStatus]:\nhttp://dl.profile.line-cdn.net/" + contact.pictureStatus + "\n[coverURL]:\n" + str(cu))
else:
contact = cl.getContact(msg.contentMetadata["mid"])
try:
cu = cl.channel.getCover(msg.contentMetadata["mid"])
except: